forked from owasp-modsecurity/ModSecurity-nginx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not use main/server contexts for creating/merging configuration
- Loading branch information
Showing
1 changed file
with
50 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e00e2cc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In comparison with the previous implementation, the
msc_init()
is called for every configuration context, but this does not lead to significant increase in memory consumption. Here's the results of nginx running with 100 server blocks like this:where
/etc/nginx/modsec/main.conf
is:So, previous (old) implementation:
New simplified implementation:
e00e2cc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nginx startup time is also almost the same for the above configuration, previous implementation:
New implementation:
e00e2cc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zimmerle @victorhora would love to hear you thoughts on what is the ideal pattern of calling
msc_init()
from a connector, i.e. should a new instance be "global", or we can create as many instances as we'd like to? (for various contexts / configurations, etc)e00e2cc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zimmerle @victorhora anyway, I checked the library's code and decided to return to the scenario when an instance is being created only once (in main/http context, in nginx terminology), see this one for details: owasp-modsecurity@7b8f1ef