-
Notifications
You must be signed in to change notification settings - Fork 3
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
How do you calculate the number of rules in CRS? #3
Comments
@yashhere a number comes from total amount of loaded rules, and the default You may check the following code to see how it's being calculated: That is, you see the exact number of loaded rules as they are being represented architecturally within the library. (Tagging @zimmerle for visibility.) |
I was thinking that the number of rules is the total number of rules in CRS, not the rules that are actually loaded in ModSecurity. That's why I was trying to grep the occurrences of the word "Sec" to get the approximate count of all the rules. Still, from my testing, the word "Sec" occurs for ~847 times in CRS, so at any time, the number of loaded rules in ModSecurity cannot be more than 847, provided that a rule can't be loaded twice (which is actually the case, if I am not wrong). Then how are you getting almost twice of my result? Is it because of the fact, that the |
@yashhere rules are tied to an object of nginx configuration (which can be separated by levels, e.g. http, server, location, etc), so when you're loading even the identical modsecurity configuration from the same file into two different contexts (locations, servers), you'll get a sum of rules. You can check nginx development guide for the configuration parts here: |
re: "a rule can't be loaded twice" - in fact, it can (cc'ing @zimmerle again to confirm) |
Hi, I am trying to reproduce the results given on the wiki page. But I am not able to get the number of rules in CRS that you have posted on the very bottom of the wiki page. It says that CRS v3.1.0 has 1634 rules. How did you calculate this? I tried calculating, but I am getting 847 as a result. I used the following command -
I think I am missing something here. Can you share your method/command of counting the number of rules? It would be of great help.
Thank you :)
The text was updated successfully, but these errors were encountered: