Giter Club home page Giter Club logo

Comments (6)

csanders-git avatar csanders-git commented on August 22, 2024 1

A more correct answer is that Nginx with modsecurity v2.x does not use the kleene operator '*' in the same way Apache does. This means that CRS will be loaded out of order. However, the ModSecurity-Nginx connection (libmodsecurity) fixes this issue. Let me know if that solves the issue. If you have other CRS issues feel free to ask on the CRS github https://github.com/SpiderLabs/owasp-modsecurity-crs

from modsecurity-nginx.

met3or avatar met3or commented on August 22, 2024

Hello @Bali2016, hope I can help. I am using a similar setup and have a single includes file, say for example:

/etc/nginx/modsec_includes.conf

This will contain -all- of my modsecurity related configuration, and within my nginx virtual host, I will apply it like:

server {
        ...
        location / {
            modsecurity on;
            modsecurity_rules_file /usr/local/nginx/modsec_includes.conf;
            root   html;
            index  index.html index.htm;
        }
}

This include file will have include statements for modsecurity.conf, crs-setup.conf and all of the rules files within the owasp-crs folder,

This setup works quite well for me.

Hope that helps,

Regards,

met3or

from modsecurity-nginx.

victorhora avatar victorhora commented on August 22, 2024

Yes, this is a known "limitation" with nginx. "Include rules/*.conf" doesn't work. You need to manually specify each configuration file to be loaded as per:

https://github.com/SpiderLabs/owasp-modsecurity-crs/blob/v3.0/master/INSTALL#L132

from modsecurity-nginx.

leibaogit avatar leibaogit commented on August 22, 2024

@csanders-git @victorhora @met3or thanks all your help, now I include all the rules' conf in a file, don't use *.conf, and can see the mailicous attack is blocked.

from modsecurity-nginx.

defanator avatar defanator commented on August 22, 2024

Just to confirm the above explanation from @csanders-git - we were facing exactly the same issue with loading CRS files with * mask on earlier versions of libmodsecurity; now it works like a charm.

I did a quick search in git log, but was unable to determine the exact changeset, probably @zimmerle has better insights here. :)

from modsecurity-nginx.

zimmerle avatar zimmerle commented on August 22, 2024

Hi @defanator,

Hard to tell the exactly commit. Most likely it was fixed by one of the parser refactoring commits, where I was working more on a macro view. Collateral benefit ? :)

from modsecurity-nginx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.