From 5da32dfb2cfc9d499fb571bf5b6ee9451ba7df96 Mon Sep 17 00:00:00 2001 From: Vadim Kurland Date: Sun, 29 May 2011 21:39:44 -0700 Subject: [PATCH] added unit tests skeleton for PF import; fixed warning that appeared at the end of import, saying no rules have been created --- src/import/PFImporter.cpp | 24 + src/import/PFImporterRun.cpp | 7 + .../test_data/pf-block-return-actions.fwb | 1057 +++++++++++++++++ .../test_data/pf-block-return-actions.output | 33 + .../test_data/pf-icmp-matches.fwb | 742 ++++++++++++ .../test_data/pf-icmp-matches.output | 11 + .../test_data/pf-interface-matches.fwb | 571 +++++++++ .../test_data/pf-interface-matches.output | 8 + .../test_data/pf-port-matches.fwb | 862 ++++++++++++++ .../test_data/pf-port-matches.output | 21 + .../test_data/pf-set-commands.fwb | 456 +++++++ .../test_data/pf-set-commands.output | 14 + .../test_data/pf-state-matches.fwb | 612 ++++++++++ .../test_data/pf-state-matches.output | 8 + .../test_data/pf-tcp-flags-matches.fwb | 698 +++++++++++ .../test_data/pf-tcp-flags-matches.output | 16 + 16 files changed, 5140 insertions(+) create mode 100644 src/unit_tests/PFImporterTest/test_data/pf-block-return-actions.fwb create mode 100644 src/unit_tests/PFImporterTest/test_data/pf-block-return-actions.output create mode 100644 src/unit_tests/PFImporterTest/test_data/pf-icmp-matches.fwb create mode 100644 src/unit_tests/PFImporterTest/test_data/pf-icmp-matches.output create mode 100644 src/unit_tests/PFImporterTest/test_data/pf-interface-matches.fwb create mode 100644 src/unit_tests/PFImporterTest/test_data/pf-interface-matches.output create mode 100644 src/unit_tests/PFImporterTest/test_data/pf-port-matches.fwb create mode 100644 src/unit_tests/PFImporterTest/test_data/pf-port-matches.output create mode 100644 src/unit_tests/PFImporterTest/test_data/pf-set-commands.fwb create mode 100644 src/unit_tests/PFImporterTest/test_data/pf-set-commands.output create mode 100644 src/unit_tests/PFImporterTest/test_data/pf-state-matches.fwb create mode 100644 src/unit_tests/PFImporterTest/test_data/pf-state-matches.output create mode 100644 src/unit_tests/PFImporterTest/test_data/pf-tcp-flags-matches.fwb create mode 100644 src/unit_tests/PFImporterTest/test_data/pf-tcp-flags-matches.output diff --git a/src/import/PFImporter.cpp b/src/import/PFImporter.cpp index 2fdd6fef1..3b5c998af 100644 --- a/src/import/PFImporter.cpp +++ b/src/import/PFImporter.cpp @@ -558,6 +558,18 @@ void PFImporter::pushPolicyRule() { RuleSet *ruleset = RuleSet::cast( getFirewallObject()->getFirstByType(Policy::TYPENAME)); + + // this importer does not use UnidirectionalRuleSet objects but + // base class uses dictionary all_rulesets to do some checks (e.g. + // countRules()) so we'll create one dummy UnidirectionalRuleSet object + string ruleset_name = ruleset->getName(); + if (checkUnidirRuleSet(ruleset_name) == NULL) + { + UnidirectionalRuleSet *rs = new UnidirectionalRuleSet(); + rs->name = ruleset_name; + rs->ruleset = ruleset; + all_rulesets[ruleset_name] = rs; + } assert(current_rule!=NULL); // populate all elements of the rule @@ -735,6 +747,18 @@ void PFImporter::pushNATRule() RuleSet *ruleset = RuleSet::cast( getFirewallObject()->getFirstByType(NAT::TYPENAME)); + // this importer does not use UnidirectionalRuleSet objects but + // base class uses dictionary all_rulesets to do some checks (e.g. + // countRules()) so we'll create one dummy UnidirectionalRuleSet object + string ruleset_name = ruleset->getName(); + if (checkUnidirRuleSet(ruleset_name) == NULL) + { + UnidirectionalRuleSet *rs = new UnidirectionalRuleSet(); + rs->name = ruleset_name; + rs->ruleset = ruleset; + all_rulesets[ruleset_name] = rs; + } + assert(current_rule!=NULL); } diff --git a/src/import/PFImporterRun.cpp b/src/import/PFImporterRun.cpp index 08dd5e88b..85260a9e2 100644 --- a/src/import/PFImporterRun.cpp +++ b/src/import/PFImporterRun.cpp @@ -154,6 +154,13 @@ void PFImporter::run() err << parser_err + " " + e.what(); } + if (fwbdebug) + { + qDebug() << "haveFirewallObject()=" << haveFirewallObject() + << "countInterfaces()=" << countInterfaces() + << "countRules()=" << countRules(); + } + if (haveFirewallObject()) { if (countInterfaces()==0) err << noInterfacesErrorMessage(); diff --git a/src/unit_tests/PFImporterTest/test_data/pf-block-return-actions.fwb b/src/unit_tests/PFImporterTest/test_data/pf-block-return-actions.fwb new file mode 100644 index 000000000..3ebc3a03f --- /dev/null +++ b/src/unit_tests/PFImporterTest/test_data/pf-block-return-actions.fwb @@ -0,0 +1,1057 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + established + + established + -m state --state ESTABLISHED,RELATED + established + + + + established + + established + -m state --state ESTABLISHED,RELATED + established + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -m record_rpc + + + + + + + + + + -m irc + + + + + + + + + + -m psd --psd-weight-threshold 5 --psd-delay-threshold 10000 + + + + + + + + + + -m string --string test_pattern + + + + + + + + + + -m talk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/unit_tests/PFImporterTest/test_data/pf-block-return-actions.output b/src/unit_tests/PFImporterTest/test_data/pf-block-return-actions.output new file mode 100644 index 000000000..090c57085 --- /dev/null +++ b/src/unit_tests/PFImporterTest/test_data/pf-block-return-actions.output @@ -0,0 +1,33 @@ +5: filtering rule: action block; interfaces: +8: filtering rule: action block; interfaces: +10: filtering rule: action block; interfaces: +10: Error: 'block return' is not supported in fwbuilder, replacing with 'block return-icmp' +11: filtering rule: action block; interfaces: +11: Error: 'block return' is not supported in fwbuilder, replacing with 'block return-icmp' +12: filtering rule: action block; interfaces: +12: Error: 'block return' is not supported in fwbuilder, replacing with 'block return-icmp' +13: filtering rule: action block; interfaces: +13: Error: 'block return' is not supported in fwbuilder, replacing with 'block return-icmp' +14: filtering rule: action block; interfaces: +14: Error: 'block return' is not supported in fwbuilder, replacing with 'block return-icmp' +16: filtering rule: action block; interfaces: +18: filtering rule: action block; interfaces: +20: filtering rule: action block; interfaces: +21: filtering rule: action block; interfaces: +22: filtering rule: action block; interfaces: +23: filtering rule: action block; interfaces: +24: filtering rule: action block; interfaces: +26: filtering rule: action block; interfaces: +27: filtering rule: action block; interfaces: +29: filtering rule: action block; interfaces: +30: filtering rule: action block; interfaces: +32: filtering rule: action block; interfaces: +33: filtering rule: action block; interfaces: +35: filtering rule: action block; interfaces: +36: filtering rule: action block; interfaces: +38: filtering rule: action block; interfaces: +39: filtering rule: action block; interfaces: +41: filtering rule: action block; interfaces: +42: filtering rule: action block; interfaces: +Could not find enough information in the data file to create firewall interface objects. + diff --git a/src/unit_tests/PFImporterTest/test_data/pf-icmp-matches.fwb b/src/unit_tests/PFImporterTest/test_data/pf-icmp-matches.fwb new file mode 100644 index 000000000..30f853a5b --- /dev/null +++ b/src/unit_tests/PFImporterTest/test_data/pf-icmp-matches.fwb @@ -0,0 +1,742 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + established + + established + -m state --state ESTABLISHED,RELATED + established + + + + established + + established + -m state --state ESTABLISHED,RELATED + established + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -m record_rpc + + + + + + + + + + -m irc + + + + + + + + + + -m psd --psd-weight-threshold 5 --psd-delay-threshold 10000 + + + + + + + + + + -m string --string test_pattern + + + + + + + + + + -m talk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/unit_tests/PFImporterTest/test_data/pf-icmp-matches.output b/src/unit_tests/PFImporterTest/test_data/pf-icmp-matches.output new file mode 100644 index 000000000..878d91b52 --- /dev/null +++ b/src/unit_tests/PFImporterTest/test_data/pf-icmp-matches.output @@ -0,0 +1,11 @@ +5: New interface: pcn0 +5: filtering rule: action pass; interfaces: pcn0 +6: filtering rule: action pass; interfaces: pcn0 +7: filtering rule: action pass; interfaces: pcn0 +8: filtering rule: action pass; interfaces: pcn0 +9: filtering rule: action pass; interfaces: pcn0 +10: filtering rule: action pass; interfaces: pcn0 +11: filtering rule: action pass; interfaces: pcn0 +12: filtering rule: action pass; interfaces: pcn0 +13: filtering rule: action pass; interfaces: pcn0 +14: filtering rule: action pass; interfaces: pcn0 diff --git a/src/unit_tests/PFImporterTest/test_data/pf-interface-matches.fwb b/src/unit_tests/PFImporterTest/test_data/pf-interface-matches.fwb new file mode 100644 index 000000000..4a010d3ec --- /dev/null +++ b/src/unit_tests/PFImporterTest/test_data/pf-interface-matches.fwb @@ -0,0 +1,571 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + established + + established + -m state --state ESTABLISHED,RELATED + established + + + + established + + established + -m state --state ESTABLISHED,RELATED + established + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -m record_rpc + + + + + + + + + + -m irc + + + + + + + + + + -m psd --psd-weight-threshold 5 --psd-delay-threshold 10000 + + + + + + + + + + -m string --string test_pattern + + + + + + + + + + -m talk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/unit_tests/PFImporterTest/test_data/pf-interface-matches.output b/src/unit_tests/PFImporterTest/test_data/pf-interface-matches.output new file mode 100644 index 000000000..b2ef06476 --- /dev/null +++ b/src/unit_tests/PFImporterTest/test_data/pf-interface-matches.output @@ -0,0 +1,8 @@ +4: New interface: pcn0 +4: filtering rule: action pass; interfaces: +5: filtering rule: action pass; interfaces: +5: Error: import of 'interface:broadcast' is not supported. +6: filtering rule: action pass; interfaces: +6: Error: import of 'interface:peer' is not supported. +7: filtering rule: action pass; interfaces: +7: Error: import of 'interface:0' is not supported. diff --git a/src/unit_tests/PFImporterTest/test_data/pf-port-matches.fwb b/src/unit_tests/PFImporterTest/test_data/pf-port-matches.fwb new file mode 100644 index 000000000..5f80ef998 --- /dev/null +++ b/src/unit_tests/PFImporterTest/test_data/pf-port-matches.fwb @@ -0,0 +1,862 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + established + + established + -m state --state ESTABLISHED,RELATED + established + + + + established + + established + -m state --state ESTABLISHED,RELATED + established + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -m record_rpc + + + + + + + + + + -m irc + + + + + + + + + + -m psd --psd-weight-threshold 5 --psd-delay-threshold 10000 + + + + + + + + + + -m string --string test_pattern + + + + + + + + + + -m talk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/unit_tests/PFImporterTest/test_data/pf-port-matches.output b/src/unit_tests/PFImporterTest/test_data/pf-port-matches.output new file mode 100644 index 000000000..3c7ef68bb --- /dev/null +++ b/src/unit_tests/PFImporterTest/test_data/pf-port-matches.output @@ -0,0 +1,21 @@ +4: filtering rule: action pass; interfaces: +5: filtering rule: action pass; interfaces: +6: filtering rule: action pass; interfaces: +7: filtering rule: action pass; interfaces: +8: filtering rule: action pass; interfaces: +9: filtering rule: action pass; interfaces: +10: filtering rule: action pass; interfaces: +13: filtering rule: action pass; interfaces: +14: filtering rule: action pass; interfaces: +15: filtering rule: action pass; interfaces: +15: Error: 'except ranges' ('<>') for port numbers are not supported yet. +18: filtering rule: action pass; interfaces: +19: filtering rule: action pass; interfaces: +20: filtering rule: action pass; interfaces: +21: filtering rule: action pass; interfaces: +22: filtering rule: action pass; interfaces: +23: filtering rule: action pass; interfaces: +24: filtering rule: action pass; interfaces: +25: filtering rule: action pass; interfaces: +Could not find enough information in the data file to create firewall interface objects. + diff --git a/src/unit_tests/PFImporterTest/test_data/pf-set-commands.fwb b/src/unit_tests/PFImporterTest/test_data/pf-set-commands.fwb new file mode 100644 index 000000000..fae96e19b --- /dev/null +++ b/src/unit_tests/PFImporterTest/test_data/pf-set-commands.fwb @@ -0,0 +1,456 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + established + + established + -m state --state ESTABLISHED,RELATED + established + + + + established + + established + -m state --state ESTABLISHED,RELATED + established + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -m record_rpc + + + + + + + + + + -m irc + + + + + + + + + + -m psd --psd-weight-threshold 5 --psd-delay-threshold 10000 + + + + + + + + + + -m string --string test_pattern + + + + + + + + + + -m talk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/unit_tests/PFImporterTest/test_data/pf-set-commands.output b/src/unit_tests/PFImporterTest/test_data/pf-set-commands.output new file mode 100644 index 000000000..7f9f728c5 --- /dev/null +++ b/src/unit_tests/PFImporterTest/test_data/pf-set-commands.output @@ -0,0 +1,14 @@ +2: Warning: import of 'set' commands has not been implemented yet. +3: Warning: import of 'set' commands has not been implemented yet. +4: Warning: import of 'set' commands has not been implemented yet. +5: Warning: import of 'set' commands has not been implemented yet. +6: Warning: import of 'set' commands has not been implemented yet. +7: Warning: import of 'set' commands has not been implemented yet. +8: Warning: import of 'set' commands has not been implemented yet. +9: Warning: import of 'set' commands has not been implemented yet. +10: Warning: import of 'set' commands has not been implemented yet. +Parser error: +Could not find enough information in the data file to create firewall object. + + +Please check that the file you are trying to import is in one of supported formats. Currently fwbuilder can only import iptables configuration saved with 'iptables-restore' command and Cisco routers (IOS) configurations saved with 'show run' command. Import of cisco ASA (PIX) configuration is not supported at this time \ No newline at end of file diff --git a/src/unit_tests/PFImporterTest/test_data/pf-state-matches.fwb b/src/unit_tests/PFImporterTest/test_data/pf-state-matches.fwb new file mode 100644 index 000000000..fe91bf9db --- /dev/null +++ b/src/unit_tests/PFImporterTest/test_data/pf-state-matches.fwb @@ -0,0 +1,612 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + established + + established + -m state --state ESTABLISHED,RELATED + established + + + + established + + established + -m state --state ESTABLISHED,RELATED + established + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -m record_rpc + + + + + + + + + + -m irc + + + + + + + + + + -m psd --psd-weight-threshold 5 --psd-delay-threshold 10000 + + + + + + + + + + -m string --string test_pattern + + + + + + + + + + -m talk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/unit_tests/PFImporterTest/test_data/pf-state-matches.output b/src/unit_tests/PFImporterTest/test_data/pf-state-matches.output new file mode 100644 index 000000000..d94337bac --- /dev/null +++ b/src/unit_tests/PFImporterTest/test_data/pf-state-matches.output @@ -0,0 +1,8 @@ +5: filtering rule: action pass; interfaces: +6: filtering rule: action pass; interfaces: +7: filtering rule: action pass; interfaces: +10: filtering rule: action pass; interfaces: +11: filtering rule: action pass; interfaces: +12: filtering rule: action pass; interfaces: +Could not find enough information in the data file to create firewall interface objects. + diff --git a/src/unit_tests/PFImporterTest/test_data/pf-tcp-flags-matches.fwb b/src/unit_tests/PFImporterTest/test_data/pf-tcp-flags-matches.fwb new file mode 100644 index 000000000..80aa42f7d --- /dev/null +++ b/src/unit_tests/PFImporterTest/test_data/pf-tcp-flags-matches.fwb @@ -0,0 +1,698 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + established + + established + -m state --state ESTABLISHED,RELATED + established + + + + established + + established + -m state --state ESTABLISHED,RELATED + established + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -m record_rpc + + + + + + + + + + -m irc + + + + + + + + + + -m psd --psd-weight-threshold 5 --psd-delay-threshold 10000 + + + + + + + + + + -m string --string test_pattern + + + + + + + + + + -m talk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/unit_tests/PFImporterTest/test_data/pf-tcp-flags-matches.output b/src/unit_tests/PFImporterTest/test_data/pf-tcp-flags-matches.output new file mode 100644 index 000000000..45aa3bf59 --- /dev/null +++ b/src/unit_tests/PFImporterTest/test_data/pf-tcp-flags-matches.output @@ -0,0 +1,16 @@ +4: filtering rule: action pass; interfaces: +5: filtering rule: action pass; interfaces: +6: filtering rule: action pass; interfaces: +7: filtering rule: action pass; interfaces: +9: filtering rule: action block; interfaces: +9: Error: TCP flag matches 'E' and 'W' are not supported. +10: filtering rule: action block; interfaces: +10: Error: TCP flag matches 'E' and 'W' are not supported. +11: filtering rule: action block; interfaces: +11: Error: TCP flag matches 'E' and 'W' are not supported. +12: filtering rule: action block; interfaces: +12: Error: TCP flag matches 'E' and 'W' are not supported. +13: filtering rule: action block; interfaces: +14: filtering rule: action block; interfaces: +Could not find enough information in the data file to create firewall interface objects. +