【发布时间】:2021-04-05 13:00:47
【问题描述】:
我为 Apache 配置了 mod_security 和 GeoIP2。 GeoLite2-Country.mmdb 由 cron 每周触发的geoipupdate 下载。我的/etc/modsecurity/modsecurity.conf 配置如下:
SecRuleEngine On
SecRule ARGS:modsecparam "@contains test" "id:4321,deny,status:403,msg:'ModSecurity test rule has triggered'"
SecRule REMOTE_ADDR "@geoLookup" "chain,id:20000,deny,status:403,msg:'NON PL IP addresses'"
SecRule GEO:COUNTRY_CODE "!@streq PL"
...
我的/etc/modsecurity/crs-setup.conf 指向 GeoIP 数据库:
SecGeoLookupDB /etc/modsecurity/GeoLite2-Country.mmdb
从我的本地机器运行 curl:curl 'https://host/login/index.html?modsecparam=test'
在日志中留下痕迹:
...
SecRule "TX:EXECUTING_PARANOIA_LEVEL" "@lt 2" "phase:1,auditlog,id:980013,nolog,skipAfter:END-RESPONSE-980-CORRELATION"
SecRule "ARGS:modsecparam" "@contains test" "phase:2,log,auditlog,id:4321,deny,status:403,msg:'ModSecurity test rule has triggered'"
SecRule "&TX:dos_burst_time_slice" "@eq 0" "phase:5,auditlog,id:912110,t:none,nolog,ver:OWASP_CRS/3.2.0,chain,skipAfter:END-DOS-PROTECTION-CHECKS"
SecRule "&TX:dos_counter_threshold" "@eq 0" "chain"
SecRule "&TX:dos_block_timeout" "@eq 0"
...
但由于某种原因,它不会阻止 PL 以外的国家/地区。我做错了什么?
【问题讨论】:
-
对不起,“在日志中留下痕迹”后面的内容不是日志内容,它们是规则。你能给我们看看 debug.log 的内容吗?
标签: apache mod-security2 geoip2