Beispiel #1
0
    def test_ssi_disabled7(self):
        test_list = []
        line = DirectiveInfo(DirectiveLine("Options", ["None"]), 0, 'file.txt')
        test_list.append(line)
        line = DirectiveInfo(DirectiveLine("Options", ["+Includes"]), 0,
                             'file.txt')
        test_list.append(line)

        auditor = ApacheConfigAuditor(test_list)
        self.assertFalse(auditor.ssi_disabled())
Beispiel #2
0
    def test_override_denied2(self):
        test_list = []
        line = DirectiveInfo(DirectiveLine("<Directory", ["/>"]), 0,
                             'file.txt')
        test_list.append(line)
        line = DirectiveInfo(DirectiveLine("AllowOverride", ["All"]), 0,
                             'file.txt')
        test_list.append(line)
        line = DirectiveInfo(DirectiveLine("</Directory>", [""]), 0,
                             'file.txt')
        test_list.append(line)

        auditor = ApacheConfigAuditor(test_list)
        self.assertFalse(auditor.override_denied())
Beispiel #3
0
    def test_indexing_disabled2(self):
        test_list = []
        line = DirectiveInfo(DirectiveLine("Options", ["None"]), 0, 'file.txt')
        test_list.append(line)

        auditor = ApacheConfigAuditor(test_list)
        self.assertTrue(auditor.indexing_disabled())
Beispiel #4
0
    def test_keepalive_set1(self):
        test_list = []
        line = DirectiveInfo(DirectiveLine("KeepAlive", ["On"]), 0, 'file.txt')
        test_list.append(line)

        auditor = ApacheConfigAuditor(test_list)
        self.assertTrue(auditor.keepalive_set())
Beispiel #5
0
    def test_maxclients_set3(self):
        test_list = []
        line = DirectiveInfo(DirectiveLine("MaxClients", ["22"]), 0,
                             'file.txt')
        test_list.append(line)

        auditor = ApacheConfigAuditor(test_list)
        self.assertTrue(auditor.maxclients_set())
Beispiel #6
0
    def test_http_header_limited2(self):
        test_list = []
        line = DirectiveInfo(DirectiveLine("LimitRequestFields", ["0"]), 0,
                             'file.txt')
        test_list.append(line)

        auditor = ApacheConfigAuditor(test_list)
        self.assertFalse(auditor.http_header_limited())
Beispiel #7
0
    def test_http_message_limited4(self):
        test_list = []
        line = DirectiveInfo(DirectiveLine("LimitRequestBody", ["2"]), 0,
                             'file.txt')
        test_list.append(line)

        auditor = ApacheConfigAuditor(test_list)
        self.assertTrue(auditor.http_message_limited())
Beispiel #8
0
    def test_multiviews_disabled4(self):
        test_list = []
        line = DirectiveInfo(DirectiveLine("Options", ["-Multiview"]), 0,
                             'file.txt')
        test_list.append(line)

        auditor = ApacheConfigAuditor(test_list)
        self.assertTrue(auditor.multiviews_disabled())
Beispiel #9
0
    def test_symlinks_disabled4(self):
        test_list = []
        line = DirectiveInfo(DirectiveLine("Options", ["+FollowSymLinks"]), 0,
                             'file.txt')
        test_list.append(line)

        auditor = ApacheConfigAuditor(test_list)
        self.assertFalse(auditor.symlinks_disabled())
Beispiel #10
0
    def test_ssi_disabled4(self):
        test_list = []
        line = DirectiveInfo(DirectiveLine("Options", ["-IncludesNoExec"]), 0,
                             'file.txt')
        test_list.append(line)

        auditor = ApacheConfigAuditor(test_list)
        self.assertTrue(auditor.ssi_disabled())
Beispiel #11
0
    def test_http_header_field_limited3(self):
        test_list = []
        line = DirectiveInfo(DirectiveLine("LimitRequestFieldSize", ["8190"]),
                             0, 'file.txt')
        test_list.append(line)

        auditor = ApacheConfigAuditor(test_list)
        self.assertTrue(auditor.http_header_field_limited())
Beispiel #12
0
    def test_timeout_set4(self):
        test_list = []

        line = DirectiveInfo(DirectiveLine("Timeout", ["301"]), 0, 'file.txt')
        test_list.append(line)

        auditor = ApacheConfigAuditor(test_list)
        self.assertFalse(auditor.timeout_set())
Beispiel #13
0
    def test_minspareservers_set2(self):
        test_list = []

        line = DirectiveInfo(DirectiveLine("MinSpareServers", ["4"]), 0,
                             'file.txt')
        test_list.append(line)

        auditor = ApacheConfigAuditor(test_list)
        self.assertFalse(auditor.minspareservers_set())
Beispiel #14
0
    def test_ports_configured3(self):
        test_list = []

        line = DirectiveInfo(DirectiveLine("Listen", ["0.0.0.0"]), 0,
                             'file.txt')
        test_list.append(line)

        auditor = ApacheConfigAuditor(test_list)
        self.assertFalse(auditor.ports_configured())
Beispiel #15
0
    def test_maxspareservers_set4(self):
        test_list = []

        line = DirectiveInfo(DirectiveLine("MaxSpareServers", ["9"]), 0,
                             'file.txt')
        test_list.append(line)

        auditor = ApacheConfigAuditor(test_list)
        self.assertTrue(auditor.maxspareservers_set())
Beispiel #16
0
    def test_startservers_set_set6(self):
        test_list = []

        line = DirectiveInfo(DirectiveLine("StartServers", ["11"]), 0,
                             'file.txt')
        test_list.append(line)

        auditor = ApacheConfigAuditor(test_list)
        self.assertFalse(auditor.startservers_set())
Beispiel #17
0
    def test_keepalivetimeout_set4(self):
        test_list = []

        line = DirectiveInfo(DirectiveLine("KeepAliveTimeout", ["16"]), 0,
                             'file.txt')
        test_list.append(line)

        auditor = ApacheConfigAuditor(test_list)
        self.assertFalse(auditor.keepalivetimeout_set())
Beispiel #18
0
    def test_ssi_disabled2(self):
        """
        Check case where all Options have value "None"
        """
        test_list = []
        line = DirectiveInfo(DirectiveLine("Options", ["None"]), 0, 'file.txt')
        test_list.append(line)

        auditor = ApacheConfigAuditor(test_list)
        self.assertTrue(auditor.ssi_disabled())
Beispiel #19
0
    def check_end_directory(self, directive_info):
        directive = directive_info.get_directive()
        if directive == END_DIRECTORY:
            return True
        else:
            return False

    def pid_file_secure(self):
        """
        Check SV-33222r1_rule: The process ID (PID)
        file must be properly secured.

        Finding ID: V-26305
        """
        return False


if __name__ == "__main__":
    test_list = []
    line = DirectiveInfo(DirectiveLine("<Directory", ["/>"]), 0, 'file.txt')
    test_list.append(line)
    line = DirectiveInfo(DirectiveLine("AllowOverride", ["None"]), 0,
                         'file.txt')
    test_list.append(line)
    line = DirectiveInfo(DirectiveLine("</Directory>", [""]), 0, 'file.txt')
    test_list.append(line)

    auditor = ApacheConfigAuditor(test_list)

    print(auditor.override_denied())