Closed karljohns0n closed 4 years ago
Hi @karljohns0n,
What do you mean when you mentioned off by default?
Hi,
What do you mean when you mentioned off by default?
I mean that default modsecurity directive is off. It's still spamming the filesystem with modsec-shared-collections files when doing nginx -t
even if modsecurity is off.
That happens because ModSecurity was compiled with the LMDB support and ModSecurity was loaded by nginx. It is ready to be used by any vhost (or similar) that makes use of it. To complete disable it, try not to load the .so file.
I would have to compile it as a dynamic module to be able to unload it. Is it still normal to spam the filesystem with these 2 files? There's no way to avoid that beside using libmodsecurity without LMDB support?
If I understood correctly your use case, apparently you are not using ModSecurity at all. If that is the case, I would recommend to not compile nginx with it, or make it a dynamic module and not load it, unless it is necessary. If you use ModSecurity (even if it is a single vhost), and LMDB is enabled, the files will be generated.
I'm not using it at the moment but I plan to, that's why it's compiled with it. If I use it, is there a way to generate them only one time, in a specific path, instead of multiple time everywhere on the filesystem?
Unfortunately no :( the files are o consequence of the LMDB utilization.
@zimmerle
Maybe add workaround to create the file in /tmp folder, or an option to set the folder.
The current status made the project like amateur.
The current status made the project like amateur.
I cannot disagree. We have to allocate the necessary time/effort to fix this issue. The /tmp folder needs to be take into consideration. The distinction in between whenever it is a configuration check (nginx -t
) or a real server initialization is not clear, thus keeping the collection files on a permissive path as /tmp may lead to less control on who can see/access the content of the collections. That is the challange that we have to consider.
@defanator may be able to help with this one.
Hello,
Everytime I run nginx -t to test the config, files "modsec-shared-collections" and "modsec-shared-collections-lock" are created in the current directory, see below:
Moreover, I see
[notice] 21561#21561: ModSecurity-nginx v1.0.1 (rules loaded inline/local/remote: 0/0/0)
when nginx starts while modsecurity should be off by defaultVersion: nginx 1.16.1 libmodsecurity 3.0.3 modsecurity-nginx 1.0.1
Nginx configue: