On 05/19/2012 08:58 AM, Steven Jan Springl wrote:
On Friday 18 May 2012 01:18:44 Tom Eastep wrote:

     Example - Drop email from Anonymous Proxies and Satellite Providers:

     #ACTION       SOURCE               DEST    PROTO   DEST
     #                                                  PORT(S)
     DROP:info     net:^A1,A2           dmz     tcp     25


Tom

Specifying two country codes as in the above example produces the following
error message:

ERROR: Unknown Host (A2) /etc/shorewall2/rules (line 182)

<Tom hits forehead with palm>

Clearly the country list needs to be delimited. The attached patch allows a single country code to be entered as ^cc and a list as ^[cc,...].

-Tom
--
Tom Eastep        \ When I die, I want to go like my Grandfather who
Shoreline,         \ died peacefully in his sleep. Not screaming like
Washington, USA     \ all of the passengers in his car
http://shorewall.net \________________________________________________
diff --git a/Shorewall/Perl/Shorewall/Chains.pm b/Shorewall/Perl/Shorewall/Chains.pm
index f8ebcf7..53bcd5e 100644
--- a/Shorewall/Perl/Shorewall/Chains.pm
+++ b/Shorewall/Perl/Shorewall/Chains.pm
@@ -5172,7 +5172,7 @@ sub match_source_net( $;$\$ ) {
 	return $result;
     }
 
-    if ( $net =~ /^(!?)\^([A-Z,\d]+)$/ ) {
+    if ( $net =~ /^(!?)\^([A-Z\d]{2})$/ || $net =~ /^(!?)\^\[([A-Z,\d]+)\]$/) {
 	fatal_error "A countrycode list may not be used in this context" if $restriction & ( OUTPUT_RESTRICT | POSTROUTE_RESTRICT );
 
 	require_capability 'GEOIP_MATCH', 'A country-code', '';
@@ -5238,7 +5238,7 @@ sub imatch_source_net( $;$\$ ) {
 	return \@result;
     }
 
-    if ( $net =~ /^(!?)\^([A-Z,\d]+)$/ ) {
+    if ( $net =~ /^(!?)\^([A-Z\d]{2})$/ || $net =~ /^(!?)\^\[([A-Z,\d]+)\]$/) {
 	fatal_error "A countrycode list may not be used in this context" if $restriction & ( OUTPUT_RESTRICT | POSTROUTE_RESTRICT );
 
 	require_capability 'GEOIP_MATCH', 'A country-code', '';
@@ -5301,7 +5301,7 @@ sub match_dest_net( $;$ ) {
 	return $result;
     }
 
-    if ( $net =~ /^(!?)\^([A-Z,\d]+)$/ ) {
+    if ( $net =~ /^(!?)\^([A-Z\d]{2})$/ || $net =~ /^(!?)\^\[([A-Z,\d]+)\]$/) {
 	fatal_error "A countrycode list may not be used in this context" if $restriction & (PREROUTE_RESTRICT | INPUT_RESTRICT );
 
 	require_capability 'GEOIP_MATCH', 'A country-code', '';
@@ -5362,7 +5362,7 @@ sub imatch_dest_net( $;$ ) {
 	return \@result;
     }
 
-    if ( $net =~ /^(!?)\^([A-Z,\d]+)$/ ) {
+    if ( $net =~ /^(!?)\^([A-Z\d]{2})$/ || $net =~ /^(!?)\^\[([A-Z,\d]+)\]$/) {
 	fatal_error "A countrycode list may not be used in this context" if $restriction & (PREROUTE_RESTRICT | INPUT_RESTRICT );
 
 	require_capability 'GEOIP_MATCH', 'A country-code', '';
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Shorewall-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/shorewall-users

Reply via email to