#1068797 modsecurity-crs: IncludeOptional in file owasp-crs.load is incompatible with nginx

#1068797#5
Date:
2024-04-11 09:24:26 UTC
From:
To:
Dear Maintainer,

I configured modsecurity for nginx using the available packages in the bookworm
repository; namely, libmodsecurity3 and libnginx-mod-http-modsecurity. It
worked like charm except with this package modsecuirty-crs. The two
IncludeOptional directives in the file owasp-crs.load had to be changed to
Include since nginx does not support IncludeOptional. This simply worked but by
editing a file that the user is not supposed to edit and is likely to be
overwritten on update.

I believe there may be a way to make the whole modsecurity implementation to
work out of the box for nginx as well by simply changing these two
IncludeOptional directives to Include. Both of them include files that are
already provided by the package hence IncludeOptional is redundant.

Thanks,
Salil

#1068797#10
Date:
2024-04-15 16:48:04 UTC
From:
To:
Hi Salil,

Thanks for reporting.

Unfortunately this is a known bug of libmodsecurity3 + Nginx: this
installation does not support the `IncludeOptional` directive.

The workaround is that you change it manually.

Note, that CRS team suggest (since CRS 4) to use the `Include` form in all
cases - see documentation:
https://coreruleset.org/docs/deployment/extended_install/#includes-for-nginx


Regards,

a.

#1068797#15
Date:
2024-04-15 16:48:04 UTC
From:
To:
Hi Salil,

Thanks for reporting.

Unfortunately this is a known bug of libmodsecurity3 + Nginx: this
installation does not support the `IncludeOptional` directive.

The workaround is that you change it manually.

Note, that CRS team suggest (since CRS 4) to use the `Include` form in all
cases - see documentation:
https://coreruleset.org/docs/deployment/extended_install/#includes-for-nginx


Regards,

a.

#1068797#20
Date:
2024-04-20 12:05:26 UTC
From:
To:
Thank you Ervin,

I was wondering about the possibility of a trigger that would change the
IncludeOptional to Include if the debian machine is running nginx.

Best regards,

Salil

#1068797#25
Date:
2024-04-20 12:05:26 UTC
From:
To:
Thank you Ervin,

I was wondering about the possibility of a trigger that would change the
IncludeOptional to Include if the debian machine is running nginx.

Best regards,

Salil