Skip to content

nginx LogLevel error not working for pass #207

Closed
@void-in

Description

@void-in

Hi, again it is a pleasure to work with ModSecurity day in and out. So the patch in #116 is working as intended as far as deny is concerned. The code mentions that any disruptive action should be able to log with the log level error but the "pass" action which is classified at disruptive at https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual-(v2.x)#pass is not logging when the log level is set to error. It only gets logged to the nginx error log when the log level is info.

An example rule:

SecRule SERVER_NAME "@streq example.com" "id:123456,phase:3,pass,capture,t:none,t:urlDecodeUni,msg:'Login',chain"
    SecRule REQUEST_URI "@beginsWith /myapp/login" "chain"
        SecRule REQUEST_BODY "login:usrnam=(.+?)&" "capture,t:none,t:urlDecodeUni,setvar:tx.username=%{TX.1},chain"
            SecRule RESPONSE_HEADERS:Location "@contains /successful" "logdata:'APPLICATION=example.com,ACTION=login,STATUS=valid,USERNAME=%{tx.username},IP_ADDRESS=%{remote_addr}'"

This rule will only gets logged to the nginx error log when the log level is info. With the log level set to error, only deny rules are logged while the above rule isn't.

Following are the version info:

nginx version: nginx/1.17.9
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
built with LibreSSL 2.9.2
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-stream_ssl_preread_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-http_auth_request_module --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-google_perftools_module --with-debug --add-module=/opt/ModSecurity-nginx

Modsecurity-nginx version:

v1.0.1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions