From 10400f4737bcef8870fe7ae3d4d9e1a4b9439a75 Mon Sep 17 00:00:00 2001 From: Vadim Kurland Date: Thu, 7 Apr 2011 14:05:02 -0700 Subject: [PATCH] * PIXImporter.cpp (pushPolicyRule): see #2297 Added warning when importer enounters access-list command that matches tcp or udp ports with "neq" port operators in both source and destination. This configuration is not supported by import at this time. --- doc/ChangeLog | 6 + src/import/PIXImporter.cpp | 12 + .../PIXImporterTest/test_data/asa8.3-acl.fwb | 1103 +++++++++-------- .../test_data/asa8.3-acl.output | 10 +- .../PIXImporterTest/test_data/asa8.3-acl.test | 2 + 5 files changed, 592 insertions(+), 541 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 21965eb23..f1055f3b8 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,11 @@ 2011-04-07 vadim + * PIXImporter.cpp (pushPolicyRule): see #2297 Added warning when + importer enounters access-list command that matches tcp or udp + ports with "neq" port operators in both source and + destination. This configuration is not supported by import at this + time. + * PIXImporterNat.cpp (buildSNATRule): see #2319 "Imported nat rules with multi-line access-lists have only the first entry" diff --git a/src/import/PIXImporter.cpp b/src/import/PIXImporter.cpp index 36abc77f3..d57149da3 100644 --- a/src/import/PIXImporter.cpp +++ b/src/import/PIXImporter.cpp @@ -437,6 +437,18 @@ void PIXImporter::pushPolicyRule() // ports but used to match source ports in the access-list command. fixServiceObjectUsedForSrcPorts(); + // special exception for rules with "neq" port operator in both + // source and destination. #2297. We have decided to just issue a + // warning at this time and let user fix the rule manually. We + // should handle this case properly some day. + if (src_port_op == "neq" && dst_port_op == "neq") + { + error_tracker->registerError( + QObject::tr("Rule matches tcp or udp ports using \"neq\" port operator in " + "both source and destination. This configuration is " + "not supported by import at this time, please fix manually")); + } + addSrc(); addDst(); addSrv(); diff --git a/src/unit_tests/PIXImporterTest/test_data/asa8.3-acl.fwb b/src/unit_tests/PIXImporterTest/test_data/asa8.3-acl.fwb index ce0cffa44..03ca21c23 100644 --- a/src/unit_tests/PIXImporterTest/test_data/asa8.3-acl.fwb +++ b/src/unit_tests/PIXImporterTest/test_data/asa8.3-acl.fwb @@ -1,6 +1,6 @@ - + @@ -460,193 +460,161 @@ - - + + - - - + + + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - + + + + + + + + - + - + - - + + - + + + + + - - + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -657,7 +625,7 @@ - + @@ -666,47 +634,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -717,7 +645,7 @@ - + @@ -726,7 +654,7 @@ - + @@ -737,7 +665,7 @@ - + @@ -746,27 +674,7 @@ - - - - - - - - - - - - - - - - - - - - - + @@ -777,7 +685,7 @@ - + @@ -786,7 +694,7 @@ - + @@ -794,10 +702,10 @@ - + - + @@ -806,7 +714,7 @@ - + @@ -817,7 +725,7 @@ - + @@ -826,47 +734,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -877,7 +745,7 @@ - + @@ -886,47 +754,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -937,7 +765,7 @@ - + @@ -946,7 +774,107 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -957,7 +885,7 @@ - + @@ -966,7 +894,7 @@ - + @@ -974,10 +902,10 @@ - + - + @@ -986,7 +914,7 @@ - + @@ -994,10 +922,10 @@ - + - + @@ -1006,7 +934,87 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1014,10 +1022,10 @@ - + - + @@ -1026,7 +1034,7 @@ - + @@ -1034,10 +1042,10 @@ - + - + @@ -1046,7 +1054,7 @@ - + @@ -1054,10 +1062,10 @@ - + - + @@ -1067,7 +1075,7 @@ - + @@ -1075,10 +1083,10 @@ - + - + @@ -1088,7 +1096,7 @@ - + @@ -1096,10 +1104,10 @@ - + - + @@ -1109,7 +1117,7 @@ - + @@ -1117,10 +1125,10 @@ - + - + @@ -1131,7 +1139,7 @@ - + @@ -1139,10 +1147,10 @@ - + - + @@ -1153,7 +1161,7 @@ - + @@ -1164,7 +1172,7 @@ - + @@ -1173,38 +1181,18 @@ - + - - - - - - - - - - - - - - - - - - - - - + @@ -1213,47 +1201,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -1264,7 +1212,7 @@ - + @@ -1273,7 +1221,67 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1284,7 +1292,7 @@ - + @@ -1293,7 +1301,7 @@ - + @@ -1304,7 +1312,7 @@ - + @@ -1313,67 +1321,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -1384,7 +1332,7 @@ - + @@ -1393,7 +1341,67 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1404,7 +1412,7 @@ - + @@ -1413,7 +1421,7 @@ - + @@ -1424,7 +1432,7 @@ - + @@ -1433,7 +1441,7 @@ - + @@ -1441,10 +1449,10 @@ - + - + @@ -1453,7 +1461,7 @@ - + @@ -1461,10 +1469,10 @@ - + - + @@ -1473,7 +1481,7 @@ - + @@ -1481,10 +1489,10 @@ - + - + @@ -1493,7 +1501,7 @@ - + @@ -1501,10 +1509,10 @@ - + - + @@ -1513,7 +1521,7 @@ - + @@ -1524,7 +1532,7 @@ - + @@ -1533,7 +1541,7 @@ - + @@ -1544,7 +1552,7 @@ - + @@ -1553,7 +1561,7 @@ - + @@ -1561,10 +1569,10 @@ - + - + @@ -1573,7 +1581,7 @@ - + @@ -1581,10 +1589,10 @@ - + - + @@ -1593,7 +1601,7 @@ - + @@ -1601,10 +1609,10 @@ - + - + @@ -1613,7 +1621,7 @@ - + @@ -1621,10 +1629,10 @@ - + - + @@ -1633,7 +1641,7 @@ - + @@ -1644,7 +1652,7 @@ - + @@ -1653,7 +1661,7 @@ - + @@ -1664,7 +1672,7 @@ - + @@ -1674,7 +1682,7 @@ - + @@ -1682,10 +1690,10 @@ - + - + @@ -1694,7 +1702,7 @@ - + @@ -1702,10 +1710,10 @@ - + - + @@ -1714,7 +1722,7 @@ - + @@ -1722,10 +1730,10 @@ - + - + @@ -1734,7 +1742,7 @@ - + @@ -1745,7 +1753,7 @@ - + @@ -1754,7 +1762,7 @@ - + @@ -1762,10 +1770,10 @@ - + - + @@ -1774,7 +1782,7 @@ - + @@ -1782,10 +1790,10 @@ - + - + @@ -1794,7 +1802,7 @@ - + @@ -1805,7 +1813,7 @@ - + @@ -1814,7 +1822,7 @@ - + @@ -1825,7 +1833,7 @@ - + @@ -1834,7 +1842,7 @@ - + @@ -1845,7 +1853,7 @@ - + @@ -1854,7 +1862,7 @@ - + @@ -1865,7 +1873,7 @@ - + @@ -1874,7 +1882,7 @@ - + @@ -1885,7 +1893,7 @@ - + @@ -1894,7 +1902,7 @@ - + @@ -1905,7 +1913,7 @@ - + @@ -1914,7 +1922,7 @@ - + @@ -1925,7 +1933,7 @@ - + @@ -1934,7 +1942,7 @@ - + @@ -1945,7 +1953,7 @@ - + @@ -1954,7 +1962,28 @@ - + + + + + + + + + + + + + + + + + + + + + + @@ -1965,7 +1994,7 @@ - + @@ -1974,7 +2003,7 @@ - + @@ -1985,7 +2014,7 @@ - + @@ -1994,7 +2023,7 @@ - + @@ -2005,7 +2034,7 @@ - + @@ -2016,17 +2045,17 @@ - + - - + + - + - + @@ -2047,7 +2076,7 @@ - - + + diff --git a/src/unit_tests/PIXImporterTest/test_data/asa8.3-acl.output b/src/unit_tests/PIXImporterTest/test_data/asa8.3-acl.output index 4bc8f47af..153297a20 100644 --- a/src/unit_tests/PIXImporterTest/test_data/asa8.3-acl.output +++ b/src/unit_tests/PIXImporterTest/test_data/asa8.3-acl.output @@ -107,7 +107,9 @@ 248: filtering rule: access list outside_in, action permit 249: filtering rule: access list outside_in, action permit 250: filtering rule: access list outside_in, action permit -268: Interface Vlan1 ruleset inside_in direction 'in' -269: Interface Vlan1 ruleset inside_out direction 'out' -270: Interface Vlan2 ruleset outside_in direction 'in' -271: Interface Vlan2 ruleset outside_out direction 'out' +253: filtering rule: access list outside_in, action permit +253: Error: Rule matches tcp or udp ports using "neq" port operator in both source and destination. This configuration is not supported by import at this time, please fix manually +270: Interface Vlan1 ruleset inside_in direction 'in' +271: Interface Vlan1 ruleset inside_out direction 'out' +272: Interface Vlan2 ruleset outside_in direction 'in' +273: Interface Vlan2 ruleset outside_out direction 'out' diff --git a/src/unit_tests/PIXImporterTest/test_data/asa8.3-acl.test b/src/unit_tests/PIXImporterTest/test_data/asa8.3-acl.test index 20ec99bce..000acbc06 100755 --- a/src/unit_tests/PIXImporterTest/test_data/asa8.3-acl.test +++ b/src/unit_tests/PIXImporterTest/test_data/asa8.3-acl.test @@ -249,6 +249,8 @@ access-list outside_in permit tcp object-group dst-network-group-1 gt 1024 any access-list outside_in permit tcp object-group dst-network-group-1 gt 1024 any object-group test-service-3 access-list outside_in permit tcp object-group dst-network-group-1 gt 1024 any object-group test-service-4 +! unsupported configuration: neq in bouth source and destination +access-list outside_in permit tcp any neq www any neq www ! however named object can not be used to match source ports in ASA ! 8.3 so the following rules are invalid