owasp-modsecurity / owasp-modsecurity/ModSecurity-nginx

IncludeOptional error "modsecurity_rules_file" directive Rules error

Open
#338 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Perl
Stars
1.9k
Forks
312
PR merge metrics
No merged PRs in 30d

Description

We have installed nginx-extras, libnginx-mod-http-modsecurity/stable,now 1.0.3-1+b2 and libnginx-mod-http-modsecurity/stable,now 1.0.3-1+b2.

Enabling (uncommenting) the ModSecurity lines produces the following error:

root@xxxxx:~# nginx -t
2025/01/27 09:43:06 [emerg] 80509#80509: "modsecurity_rules_file" directive Rules error. File: /etc/nginx/modsecurity_includes.conf. Line: 8. Column: 81. Invalid input:  IncludeOptional /etc/modsecurity/crs/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf in /etc/nginx/sites-enabled/default.conf:26
nginx: configuration file /etc/nginx/nginx.conf test failed

I have tested that if I change IncludeOptional to just Include it works.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with nginx -t after enabling the ModSecurity lines, starting with /etc/nginx/modsecurity_includes.conf line 8 and /etc/nginx/sites-enabled/default.conf line 26. Compare the behavior of IncludeOptional and Include, and trace the reported modsecurity_rules_file parsing path. Done means the configuration test handles the shown IncludeOptional directive correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
nginx
Domain
security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.