'Ensure cron permissions check detects files modifiable by non-root.'

def testCronPermisionsCheck(self):

    check_id = 'CIS-CRON-PERMISSIONS'
    artifact_crontab = 'AllLinuxScheduleFiles'
    data_crontab = [self.CreateStat('/etc/cron.d', 0, 0, 16800), self.CreateStat('/etc/cron.daily/test1', 0, 60, 33200), self.CreateStat('/etc/cron.daily/test2', 50, 0, 33060), self.CreateStat('/var/spool/cron/cronfile', 0, 0, 33184), self.CreateStat('/etc/cron.d/cronfile2', 0, 0, 33204)]
    sym_crontab = 'Found:    System    crontabs    can    be    modified    by    non-privileged    users.'
    found_crontab = ['/etc/cron.daily/test1    user:    0,    group:    60,    mode:    -rw-rw----', '/etc/cron.daily/test2    user:    50,    group:    0,    mode:    -r--r--r--']
    artifact_allow_deny = 'CronAtAllowDenyFiles'
    data_allow_deny = [self.CreateStat('/etc/cron.allow', 5, 0, 33184), self.CreateStat('/etc/cron.deny', 0, 60, 33184), self.CreateStat('/etc/at.allow', 0, 0, 33056), self.CreateStat('/etc/at.deny', 0, 0, 33206)]
    sym_allow_deny = 'Found:    System    cron    or    at    allow/deny    files    can    be    modified    by    non-privileged    users.'
    found_allow_deny = ['/etc/cron.allow    user:    5,    group:    0,    mode:    -rw-r-----', '/etc/at.deny    user:    0,    group:    0,    mode:    -rw-rw-rw-']
    results = self.GenResults([artifact_crontab], [data_crontab])
    self.assertCheckDetectedAnom(check_id, results, sym_crontab, found_crontab)
    results = self.GenResults([artifact_allow_deny], [data_allow_deny])
    self.assertCheckDetectedAnom(check_id, results, sym_allow_deny, found_allow_deny)
    results = self.GenResults([artifact_crontab, artifact_allow_deny], [data_crontab, data_allow_deny])
    self._CheckMultipleSymPerCheck(check_id, results, [sym_crontab, sym_allow_deny], [found_crontab, found_allow_deny])
