nbs-system / naxsi

NAXSI is an open-source, high performance, low rules maintenance WAF for NGINX
GNU General Public License v3.0
4.8k stars 606 forks source link

naxsi compile, but dont work #386

Closed patsevanton closed 7 years ago

patsevanton commented 7 years ago

HI I compile naxsi by this script https://github.com/ulyaoth/repository/blob/master/ulyaoth-nginx-naxsi/build-ulyaoth-nginx-mainline-naxsi.sh

nginx -V nginx version: nginx/1.9.12 built by gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) built with OpenSSL 1.0.1e-fips 11 Feb 2013 TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --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_stub_status_module --with-http_auth_request_module --with-http_geoip_module --with-threads --with-stream --with-stream_ssl_module --add-module=/etc/nginx/modules/naxsi/naxsi_src --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-http_v2_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'

Added

http {
   include /etc/nginx/naxsi_core.rules;
}

server { listen 443 ssl; server_name access_log error_log

client_max_body_size 150M;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 90;

underscores_in_headers on;

location / {

Enable naxsi

SecRulesEnabled;

Enable learning mode

LearningMode;

Define where blocked requests go

DeniedUrl "/50x.html";.

CheckRules, determining when naxsi needs to take action

CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$EVADE >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; error_log /var/log/nginx-wallarm/hms-error-naxsi.log;

    proxy_pass 

}

}

But i dont see naxsi work.

curl 'http://127.0.0.1:4242/?a=<>'
curl: (7) couldn't connect to host
netstat -tnlp | grep 4242
nothing
pimperator commented 7 years ago

seems for me not like a naxsi problem but a tcp connection problem. if you connect to nginx then at least you shall recieve a http status code. is nginx running? test your config first via nginx -t

did you turn off your firewall? what does nmap -sT -sU -p 4242 127.0.0.1 say?