Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit connector version in error log #88

Closed
wants to merge 3 commits into from

Conversation

defanator
Copy link
Collaborator

Also, use the same string in msc_set_connector_info().

Ideally, "banner" should be printed in init module function [1], but in this case it won't appear if there are errors in ModSecurity configuration (evaluated by msc_init()), therefore I decided to put it into earlier configuration creation phase.

Example log (valid configuration):

root@vagrant:/# nginx
root@vagrant:/# cat /var/log/nginx/error.log 
2017/12/25 09:38:30 [notice] 13364#13364: ModSecurity-nginx v1.0.0
2017/12/25 09:38:30 [notice] 13364#13364: using the "epoll" event method
2017/12/25 09:38:30 [notice] 13364#13364: nginx/1.13.7
2017/12/25 09:38:30 [notice] 13364#13364: built by gcc 6.3.0 20170406 (Ubuntu 6.3.0-12ubuntu2) 
2017/12/25 09:38:30 [notice] 13364#13364: OS: Linux 4.10.0-30-generic
2017/12/25 09:38:30 [notice] 13364#13364: getrlimit(RLIMIT_NOFILE): 131072:131072
2017/12/25 09:38:30 [notice] 13365#13365: start worker processes
2017/12/25 09:38:30 [notice] 13365#13365: start worker process 13366

Example log (invalid configuration):

root@vagrant:/# nginx
nginx: [emerg] "modsecurity_rules_file" directive Rules error. File: /etc/nginx/modsec/modsecurity.conf. Line: 1. Column: 25. Invalid input:  NonexistentDirective 123 in /etc/nginx/nginx.conf:75
root@vagrant:/# cat /var/log/nginx/error.log 
2017/12/25 09:39:34 [notice] 13373#13373: ModSecurity-nginx v1.0.0
2017/12/25 09:39:34 [emerg] 13373#13373: "modsecurity_rules_file" directive Rules error. File: /etc/nginx/modsec/modsecurity.conf. Line: 1. Column: 25. Invalid input:  NonexistentDirective 123 in /etc/nginx/nginx.conf:75

[1] http://nginx.org/en/docs/dev/development_guide.html#core_modules

Felipe Zimmerle and others added 3 commits December 20, 2017 14:36
@defanator defanator requested a review from zimmerle December 25, 2017 09:40
@defanator
Copy link
Collaborator Author

Also I thought that it would be useful to print ModSecurity information as well, and faced an issue with msc_who_am_i() extern C func. PR is here: owasp-modsecurity/ModSecurity#1640

(cc/ @zimmerle @victorhora)

@zimmerle zimmerle self-assigned this Mar 26, 2018
zimmerle pushed a commit that referenced this pull request Mar 26, 2018
@zimmerle
Copy link
Contributor

Merged! Thanks.

@zimmerle zimmerle closed this Mar 26, 2018
@defanator defanator deleted the issue85-fix branch April 5, 2018 07:22
pracj3am pushed a commit to cdn77/ModSecurity-nginx that referenced this pull request Nov 4, 2022
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