-
Notifications
You must be signed in to change notification settings - Fork 1.7k
modsecurity 3.x about nested variables question #2885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hello @liusir-ht , If you want a variable to exist per IP address, the common way to do that is to use the special During each transaction, the collection needs to be initialized with https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual-%28v3.x%29#initcol Then you can update the variable using a syntax like this
Access is similar:
|
Hello, @martinhsv , |
There is an open issue for the implementation of expirevar functionality: #1803 |
OK,Thanks |
Uh oh!
There was an error while loading. Please reload this page.
Configuration file contents:
Include /usr/local/nginx/conf/modsec/modsecurity.conf SecDefaultAction "phase:1,log,auditlog,deny,status:403" SecRule REQUEST_URI "@streq /phpmyadmin" "id:10001,phase:1,log,pass,msg:' uri = /phpmyadmin'" SecAction "phase:1,pass,log,setvar:ip.counter_%{REMOTE_ADDR}=+1,expirevar:ip.counter_%{REMOTE_ADDR}=3600,msg:'ip.counter_%{REMOTE_ADDR} counter+1,current counter: %{IP:COUNTER_%{REMOTE_ADDR}} '" SecAction "phase:1,pass,log,setvar:ip.cishu=%{IP:COUNTER_%{REMOTE_ADDR} },msg:'cishu=%{IP:COUNTER_%{REMOTE_ADDR} }'" SecAction "phase:1,pass,log,msg:'echo %{IP.CISHU}'" SecRule %{IP:COUNTER_%{REMOTE_ADDR}} "@gt 10" "id:2,phase:1,deny,log,auditlog,status:403,msg:'Access denied.'"
When I use/usr/local/nginx/sbin/nginx - c/usr/local/nginx/conf/nginx. Conf -s reload
modsecurity 3.x uses nested variables and has the following error:
nginx: [emerg] "modsecurity_rules_file" directive Rules error. File: /usr/local/nginx/conf/modsec/main.conf. Line: 11. Column: 114. Expecting a variable, got: : %{IP:COUNTER_%{REMOTE_ADDR}} "@gt 10" "id:2,phase:1,deny,log,auditlog,status:403,msg:'Access denied.'" in /usr/local/nginx/conf/nginx.conf:82
The text was updated successfully, but these errors were encountered: