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

Unable to build on Ubuntu20.04 #546

Closed rickripe closed 3 years ago

rickripe commented 3 years ago

Following the instructions here (https://github.com/nbs-system/naxsi/wiki/naxsi-compile):

$ export NAXSI_VER=1.0
$ wget https://github.com/nbs-system/naxsi/archive/$NAXSI_VER.tar.gz -O naxsi_$NAXSI_VER.tar.gz
$ wget https://github.com/nbs-system/naxsi/releases/download/$NAXSI_VER/naxsi-$NAXSI_VER.tar.gz.asc -O naxsi_$NAXSI_VER.tar.gz.asc
$ export NGINX_VER=1.18.0
$ 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

Gives the following errors:

In file included from /usr/include/string.h:495,
                 from src/os/unix/ngx_linux_config.h:27,
                 from src/core/ngx_config.h:26,
                 from ../naxsi-1.0/naxsi_src//naxsi.h:13,
                 from ../naxsi-1.0/naxsi_src//naxsi_skeleton.c:13:
In function ‘strncpy’,
    inlined from ‘ngx_http_dummy_init’ at ../naxsi-1.0/naxsi_src//naxsi_skeleton.c:393:3:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ output truncated before terminating nul copying 17 bytes from a string of the same length [-Werror=stringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘ngx_http_dummy_init’ at ../naxsi-1.0/naxsi_src//naxsi_skeleton.c:394:3:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ output truncated before terminating nul copying 17 bytes from a string of the same length [-Werror=stringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:1353: objs/addon/naxsi_src/naxsi_skeleton.o] Error 1
make[1]: Leaving directory '/root/nginx/nginx-1.18.0'
make: *** [Makefile:14: modules] Error 2

System is fully patched. What am I missing/have done wrong?

wargio commented 3 years ago

can you try with the latest version also? 1.3

rickripe commented 3 years ago

Fantastic - that worked!