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())
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())
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())
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())
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())
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())
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())
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())
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())
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())
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())
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())
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())
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())
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())
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())
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())
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())
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())