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

Problème to compile naxsi #480

Closed forting closed 4 years ago

forting commented 5 years ago

Hello all,

I would like to compile naxsi on my debian 10 (amd64).

So i run those commands: apt update apt upgrade -y apt install build-essential libpcre3-dev zlib1g-dev export NAXSI_VER=0.56 cd /tmp wget https://github.com/nbs-system/naxsi/archive/$NAXSI_VER.tar.gz -O naxsi_$NAXSI_VER.tar.gz export NGINX_VER=1.17.3 wget https://nginx.org/download/nginx-$NGINX_VER.tar.gz tar vxf naxsi_$NAXSI_VER.tar.gz tar vxf nginx-$NGINX_VER.tar.gz cd nginx-$NGINX_VER ./configure --add-dynamic-module=../naxsi-$NAXSI_VER/naxsi_src/ make modules

So when i run ./configure: ` checking for OS

Configuration summary

and when i run make modules: make -f objs/Makefile modules make[1] : on entre dans le répertoire « /tmp/nginx-1.17.3 » cc -c -fPIC -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \ -o objs/addon/naxsi_src/naxsi_runtime.o \ ../naxsi-0.56/naxsi_src//naxsi_runtime.c ../naxsi-0.56/naxsi_src//naxsi_runtime.c: In function ‘ngx_http_dummy_is_rule_whitelisted_n’: ../naxsi-0.56/naxsi_src//naxsi_runtime.c:728:5: error: ‘strncat’ specified bound 1 equals source length [-Werror=stringop-overflow=] strncat((char*)tmp_hashname.data, "#", 1); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../naxsi-0.56/naxsi_src//naxsi_runtime.c:731:3: error: ‘strncat’ specified bound 1 equals source length [-Werror=stringop-overflow=] strncat((char*)tmp_hashname.data, "#", 1); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors make[1]: *** [objs/Makefile:1235: objs/addon/naxsi_src/naxsi_runtime.o] Error 1 make[1] : on quitte le répertoire « /tmp/nginx-1.17.3 » make: *** [Makefile:14: modules] Error 2

So how i can patch this to build naxsi ?

Thanks, Guillaume F

forting commented 5 years ago

I have solved this issue by the file objs/Makefile of the nginx-VERSION folder. So i have remove all -W.. flags of the CFLAGS option.

So if anyone have another solution?

Christian1998 commented 5 years ago

Have same issue :/

buixor commented 5 years ago

Hello, what version of gcc are you using please ? it might be related to this.

forting commented 5 years ago

Hi, gcc is gcc (Debian 8.3.0-6) 8.3.0 g++ is g++ (Debian 8.3.0-6) 8.3.0

ekxs0109 commented 5 years ago

same question, gcc version 8.3.0 (Debian 8.3.0-6)

ekxs0109 commented 5 years ago

apt install gcc-6; ./configure --add-dynamic-module=../naxsi/naxsi_src make CC=gcc-6 modules

Specify the GCC version to resolve

forting commented 4 years ago

sorry for my late answer but, on debian 10 gcc-6 aren't available. I've used gcc-7 and it's works to compile naxsi module. but gcc-8 doesn't compile.