31 lines
709 B
Python
31 lines
709 B
Python
import unittest
|
|
|
|
from fgai.policies import audit_policies, parse_policy_config
|
|
|
|
|
|
class PolicyTests(unittest.TestCase):
|
|
def test_policy_audit_finds_broad_unprotected_allow(self):
|
|
policies = parse_policy_config(
|
|
"""
|
|
config firewall policy
|
|
edit 1
|
|
set srcaddr "all"
|
|
set dstaddr "all"
|
|
set service "ALL"
|
|
set action accept
|
|
set logtraffic disable
|
|
next
|
|
end
|
|
"""
|
|
)
|
|
|
|
findings = audit_policies(policies)
|
|
|
|
titles = {finding.title for finding in findings}
|
|
self.assertIn("Broad allow policy", titles)
|
|
self.assertIn("Accepted traffic lacks UTM inspection", titles)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|