owasp-modsecurity / ModSecurity-nginx

ModSecurity v3 Nginx Connector
Apache License 2.0
1.56k stars 281 forks source link

./configure: error: ngx_http_modsecurity_module requires the ModSecurity library #257

Closed GaneshKandu closed 2 years ago

GaneshKandu commented 2 years ago

Hi,

I am trying to install modsecurity module for nginx

OS on i trying to install is Centos 6

steps i followed are

#-------------------------------------------------------------------------
cd /src
wget https://github.com/SpiderLabs/ModSecurity/releases/download/v3.0.6/modsecurity-v3.0.6.tar.gz
tar -xvzf modsecurity-v3.0.6.tar.gz
cd modsecurity-v3.0.6
sh build.sh
./configure --prefix=/usr/local
make
make install
#-------------------------------------------------------------------------
cd /src
wget https://github.com/SpiderLabs/ModSecurity-nginx/releases/download/v1.0.2/modsecurity-nginx-v1.0.2.tar.gz
tar -xvzf modsecurity-nginx-v1.0.2.tar.gz
#-------------------------------------------------------------------------
cd /src
wget http://nginx.org/download/nginx-1.20.2.tar.gz
tar -xvzf nginx-1.20.2.tar.gz
cd nginx-1.20.2
export MODSECURITY_INC="/src/modsecurity-v3.0.6/headers/"
export MODSECURITY_LIB="/src/modsecurity-v3.0.6/src/.libs/"
./configure --add-module=/src/nginx-rtmp-module --add-module=/src/modsecurity-nginx-v1.0.2 
make
make install

Don't know what i am doing wrong , i am getting this error on ./configure command

checking for POSIX semaphores in libpthread ... found
checking for struct msghdr.msg_control ... found
checking for ioctl(FIONBIO) ... found
checking for ioctl(FIONREAD) ... found
checking for struct tm.tm_gmtoff ... found
checking for struct dirent.d_namlen ... not found
checking for struct dirent.d_type ... found
checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
checking for sysconf(_SC_LEVEL1_DCACHE_LINESIZE) ... found
checking for openat(), fstatat() ... found
checking for getaddrinfo() ... found
configuring additional modules
adding module in /src/nginx-rtmp-module
 + ngx_rtmp_module was configured
configuring additional dynamic modules
adding module in /src/modsecurity-nginx-v1.0.2
checking for ModSecurity library in "/src/modsecurity-v3.0.6/src/.libs/" and "/src/modsecurity-v3.0.6/headers/" (specified by the MODSECURITY_LIB and MODSECURITY_INC env) ... not found
        ./configure: error: ngx_http_modsecurity_module requires the ModSecurity library and MODSECURITY_LIB is defined as "/src/modsecurity-v3.0.6/src/.libs/" and MODSECURITY_INC (path for modsecurity.h) "/src/modsecurity-v3.0.6/headers/", but we cannot find ModSecurity there.
martinhsv commented 2 years ago

Hello @GaneshKandu ,

I recently followed these instructions https://serverdiary.com/linux/how-to-install-and-configure-nginx-modsecurity-on-centos-7/ (with the exception that I just use a simple clone for the two git instructions) with nginx-1.20.1 on CentOS7 and did not encounter the error you report.

It's possible that you are encountering some issue related to the additional options and commands that you are using.

It is also possible that there is some difference related to use of CentOS 6. Since that is EOL, I haven't built with that recently.

However, perhaps the most likely explanation is that you didn't do 'make install' after the 'make' within modsecurity-v3.0.6.

That exact error message will be seen if that 'make install' did not occur. See for example https://github.com/SpiderLabs/ModSecurity/issues/1805. I also just confirmed myself that that message appears if the 'make install' is missed.

SinguJ commented 1 year ago

Hi brother who is reading this issues, if you are having similar problems, please first check the version of ModSecurity you have installed and make sure you have v3.x installed instead of v2.x.

(In some lagging package repositories, you may have v2.x installed by default)

Good luck, from a programmer with an exploding mind.

Translated with www.DeepL.com/Translator (free version)