def testPamConfigPermissions(self):

    data = [self.CreateStat("/etc/pam.d/hit-123", 50, 0, 0o0100640),
            self.CreateStat("/etc/pam.d/hit-234", 0, 60, 0o0040777),
            self.CreateStat("/etc/pam.d/no-hit-123", 0, 6000, 0o0100440),
            self.CreateStat("/etc/pam.d/no-hit-234", 0, 0, 0o0100640),
            self.CreateStat("/etc/pam.d/hit-345", 70, 0, 0o0100660)]

    results = self.GenResults(["LinuxPamConfigs"], [data])

    check_id = "PAM-CONFIG-FILES-WRITABLE-BY-NON-ROOT-USER"
    sym = ("Found: Files or folders in Pam configuration can be modified by "
           "non-privileged users.")
    found = ["/etc/pam.d/hit-123 user: 50, group: 0, mode: -rw-r-----",
             "/etc/pam.d/hit-234 user: 0, group: 60, mode: drwxrwxrwx",
             "/etc/pam.d/hit-345 user: 70, group: 0, mode: -rw-rw----",]

    self.assertCheckDetectedAnom(check_id, results, sym, found)
Ensure check detects Pam config files that non-root users can edit.
dataset/ETHPy150Open google/grr/grr/checks/pam_test.py/PamConfigTests.testPamConfigPermissions