Re: GeoIP match rule, problem
2009-10-01 00:46:10 GMT
thanks.
I may want to allow up to 20 countries finally. using within to block over 140 country code does not sound like a good idea so i am looking at negate <at> winthin.
any easy way of doing so?
This is actually documented as an example for GEO:Yi Li wrote:hi, wish someone could give me a help here.
I want to write a rule that block http traffic whose source IP is from
any country other than US.
I can list all country code and use a <at> within operator, which actually
works.
but i want to find a better way, so I try to negate <at> within then it fails.
here is what I did:
# Specify GeoIP datafeed
SecGeoLookupDb /etc/httpd/conf/modsecurity/GeoIP-106_20090512.dat
# GeoIP blocking rule, including complete country codes
SecRule REMOTE_ADDR <at> geoLookup \
"phase:1,chain,drop,ctl:ruleEngine=DetectionOnly,ctl:auditEngine=On,msg:'banned
country code Geo-IP',logdata:'client ip:
%{REMOTE_ADDR},%{GEO:COUNTRY_CODE}'"
SecRule GEO:COUNTRY_CODE "! <at> within US"
SecRule REMOTE_ADDR " <at> rx ^10\.128\.80\.10$" \
"phase:1,redirect:http://www.yahoo.com,ctl:ruleEngine=On,ctl:auditEngine=Rele
vantOnly,msg:'banned IP',logdata:'client ip: %{REMOTE_ADDR},%{REMOTE_ADDR}'"
my test case:
1. connect to the web server from an internal IP 10.128.x.x.
2. the negate rule never triggers
i checked the GeoIP database, the address '10.128.x.x' does not match
any country IP so the returned geo coutry code should be a blank string,
which should trigger the SecRule GEO:COUNTRY_CODE "! <at> within US".
any thoughts would be appreciated.
another related questions is that whether there is any tool which allows
me to generate http traffics but I can manipulate the source IP of these
http requests.
thanks in advance.
SecRule GEO:COUNTRY_CODE "! <at> streq GB"
Just change that to US?
-B
--
Brian Rectanus
Breach Security
------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf
_______________________________________________ mod-security-users mailing list mod-security-users <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mod-security-users Commercial ModSecurity Appliances, Rule Sets and Support: http://www.modsecurity.org/breach/index.html
RSS Feed