def testNtpHasMonitorDisabled(self):
    parser = config_file.NtpdParser()

    check_id = "TIME-NTP-REFLECTION"
    artifact_id = "NtpConfFile"
    good_config = {"/etc/ntp.conf": """
        disable monitor
        """}
    good_tricky_config = {"/etc/ntp.conf": """
        disable monitor auth
        enable kernel monitor auth
        disable kernel monitor
        """}
    bad_config = {"/etc/ntp.conf": """
        enable monitor
        """}
    bad_default_config = {"/etc/ntp.conf": """
        """}
    bad_tricky_config = {"/etc/ntp.conf": """
        enable kernel monitor auth
        disable monitor auth
        enable kernel monitor
        """}
    found = ["ntpd.conf has monitor flag set to True."]
    sym = ("Found: ntpd.conf is configured to allow monlist NTP reflection "
           "attacks.")

    results = self.RunChecks(
        self.GenFileData(artifact_id, good_config, parser))
    self.assertCheckUndetected(check_id, results)

    results = self.RunChecks(
        self.GenFileData(artifact_id, good_tricky_config, parser))
    self.assertCheckUndetected(check_id, results)

    results = self.RunChecks(
        self.GenFileData(artifact_id, bad_config, parser))
    self.assertCheckDetectedAnom(check_id, results, sym, found)

    results = self.RunChecks(
        self.GenFileData(artifact_id, bad_default_config, parser))
    self.assertCheckDetectedAnom(check_id, results, sym, found)

    results = self.RunChecks(
        self.GenFileData(artifact_id, bad_tricky_config, parser))
    self.assertCheckDetectedAnom(check_id, results, sym, found)
Test for checking that monitor is disabled.
dataset/ETHPy150Open google/grr/grr/checks/time_test.py/TimeSyncTests.testNtpHasMonitorDisabled