'Ensure log files check detects files modifiable by non-root.'

def testLogFilesCheck(self):

    data = [self.CreateStat('/var/log/syslog', 0, 0, 33206), self.CreateStat('/var/log/auth.log.1', 0, 4, 33276), self.CreateStat('/var/log/debug.1.gz', 10, 0, 33276), self.CreateStat('/var/log/mail.log', 0, 2, 33272), self.CreateStat('/var/log/user.log.1.gz', 0, 4, 33186), self.CreateStat('/var/log/puppet/mail.log', 30, 70, 33279), self.CreateStat('/var/log/dpkg.log', 200, 70, 33204)]
    results = self.GenResults(['LinuxLogFiles'], [data])
    check_id = 'CIS-LOG-FILES-PERMISSIONS-WRONG-OWNER'
    sym = 'Found:    Vital    system    log    files    have    wrong    owner.'
    found = ['/var/log/debug.1.gz    user:    10,    group:    0,    mode:    -rwxrwxr--', '/var/log/dpkg.log    user:    200,    group:    70,    mode:    -rw-rw-r--']
    self.assertCheckDetectedAnom(check_id, results, sym, found)
    check_id = 'CIS-LOG-FILES-PERMISSIONS-WRONG-GROUP'
    sym = 'Found:    Vital    system    log    files    have    wrong    group.'
    found = ['/var/log/mail.log    user:    0,    group:    2,    mode:    -rwxrwx---', '/var/log/dpkg.log    user:    200,    group:    70,    mode:    -rw-rw-r--']
    self.assertCheckDetectedAnom(check_id, results, sym, found)
    check_id = 'CIS-LOG-FILES-PERMISSIONS-WORLD-WRITABLE'
    sym = 'Found:    Log    files    are    world    writable.'
    found = ['/var/log/syslog    user:    0,    group:    0,    mode:    -rw-rw-rw-', '/var/log/puppet/mail.log    user:    30,    group:    70,    mode:    -rwxrwxrwx', '/var/log/user.log.1.gz    user:    0,    group:    4,    mode:    -rw-r---w-']
    self.assertCheckDetectedAnom(check_id, results, sym, found)
