Skip to content

Conversation

@defanator
Copy link
Contributor

This allows to use configurations like the following:

include /etc/nginx/modsec/custom-rules/*.conf

when there's just one .conf file in /etc/nginx/modsec/custom-rules/.

Currently it fails with the following error message:

root@vagrant:/etc/nginx/modsec# nginx -t
nginx: [emerg] "modsecurity_rules_file" directive Rules error. File: /etc/nginx/modsec/main.conf. Line: 1. Column: 45. /etc/nginx/modsec/custom-rules/*.conf: Not able to open file. Looking at: '/etc/nginx/modsec/custom-rules/*.conf', '/etc/nginx/modsec/custom-rules/*.conf', '/etc/nginx/modsec//etc/nginx/modsec/custom-rules/*.conf', '/etc/nginx/modsec//etc/nginx/modsec/custom-rules/*.conf'. in /etc/nginx/nginx.conf:75
nginx: configuration file /etc/nginx/nginx.conf test failed
root@vagrant:/etc/nginx/modsec# find custom-rules/ -type f
custom-rules/foo.conf

And works fine when there're more than 1 matched files:

root@vagrant:/etc/nginx/modsec# touch custom-rules/bar.conf
root@vagrant:/etc/nginx/modsec# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
root@vagrant:/etc/nginx/modsec# find custom-rules/ -type f
custom-rules/foo.conf
custom-rules/bar.conf

@zimmerle zimmerle self-assigned this Feb 23, 2018
@zimmerle zimmerle added this to the v3.0.1 milestone Feb 23, 2018

// What about `*' ?
if (utils::expandEnv(resource, 0).size() > 1) {
if (utils::expandEnv(resource, 0).size() > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ops.

zimmerle pushed a commit that referenced this pull request Feb 23, 2018
@zimmerle
Copy link
Contributor

merged! thanks!

@zimmerle zimmerle closed this Feb 23, 2018
zimmerle pushed a commit that referenced this pull request Feb 26, 2018
@defanator defanator deleted the v3_fix_find_resource_masked branch March 21, 2018 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants