Skip to content

Module compilation error with NGINX 1.21.5 #261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
simonepittis opened this issue Dec 29, 2021 · 9 comments
Closed

Module compilation error with NGINX 1.21.5 #261

simonepittis opened this issue Dec 29, 2021 · 9 comments

Comments

@simonepittis
Copy link

After:

git clone --depth 1 https://github.com/SpiderLabs/ModSecurity-nginx.git
wget http://nginx.org/download/nginx-1.21.5.tar.gz
tar zxf nginx-1.21.5.tar.gz
cd nginx-1.21.5
./configure --with-compat --add-dynamic-module=../ModSecurity-nginx
make modules

I can see this error:

make -f objs/Makefile modules
make[1]: Entering directory '/root/nginx-1.21.5'
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 /usr/local/modsecurity/include -I objs -I src/http -I src/http/modules
-o objs/addon/src/ngx_http_modsecurity_module.o
../ModSecurity-nginx/src/ngx_http_modsecurity_module.c
../ModSecurity-nginx/src/ngx_http_modsecurity_module.c: In function 'ngx_http_modsecurity_pcre_malloc_init':
../ModSecurity-nginx/src/ngx_http_modsecurity_module.c:78:9: error: 'pcre_malloc' undeclared (first use in this function); did you mean 'old_pcre_malloc'?
78 | if (pcre_malloc != ngx_http_modsec_pcre_malloc) {
| ^~~~~~~~~~~
| old_pcre_malloc
../ModSecurity-nginx/src/ngx_http_modsecurity_module.c:78:9: note: each undeclared identifier is reported only once for each function it appears in
../ModSecurity-nginx/src/ngx_http_modsecurity_module.c:82:25: error: 'pcre_free' undeclared (first use in this function); did you mean 'pkey_free'?
82 | old_pcre_free = pcre_free;
| ^~~~~~~~~
| pkey_free
../ModSecurity-nginx/src/ngx_http_modsecurity_module.c: In function 'ngx_http_modsecurity_pcre_malloc_done':
../ModSecurity-nginx/src/ngx_http_modsecurity_module.c:102:9: error: 'pcre_malloc' undeclared (first use in this function); did you mean 'old_pcre_malloc'?
102 | pcre_malloc = old_pcre_malloc;
| ^~~~~~~~~~~
| old_pcre_malloc
../ModSecurity-nginx/src/ngx_http_modsecurity_module.c:103:9: error: 'pcre_free' undeclared (first use in this function); did you mean 'pkey_free'?
103 | pcre_free = old_pcre_free;
| ^~~~~~~~~
| pkey_free
make[1]: *** [objs/Makefile:1232: objs/addon/src/ngx_http_modsecurity_module.o] Error 1

@monitmanllc
Copy link

Have the same issue, looks like it's related to a change in nginx (now nginx is built with the PCRE2 library by default).

@defanator
Copy link
Collaborator

@simonepittis @monitmanllc please check this - #260

Long story short: use --without-pcre2 configure argument when building ModSecurity-nginx connector module. PCRE2 support must be added to the library (libmodsecurity) and then to the connector. Applying just the connector's PR will lead to enormous memory leaks in regex processing.

@monitmanllc
Copy link

@defanator Thank you for the info appreciate it, I have used --without-pcre2 and compiled as expected. Have a good afternoon.

@simonepittis
Copy link
Author

yes, works!
@defanator thanks for the help.

@Danrancan
Copy link

@defanator Thank you for the info appreciate it, I have used --without-pcre2 and compiled as expected. Have a good afternoon.

How is it working after compiling with the --without-pcre2 flag? Are you having any of the reported memory allocation problems? What version of Nginx are you compiling with? Thanks for the help and info.

@Danrancan
Copy link

@defanator Thank you for the info appreciate it, I have used --without-pcre2 and compiled as expected. Have a good afternoon.

Are you getting any problems with memory allocation or leaks after compiling and testing?

@simonepittis
Copy link
Author

@Danrancan tested now without "--without-pcre2" and works fine. no performance issue and no memory issue. :-)

@Danrancan
Copy link

@Danrancan tested now without "--without-pcre2" and works fine. no performance issue and no memory issue. :-)

Thank you very much @simonepittis! This is exactly what I needed to know!

@Danrancan
Copy link

@Danrancan tested now without "--without-pcre2" and works fine. no performance issue and no memory issue. :-)

@simonepittis

Wait, I just re-read this. You say you tested it WITHOUT "--without-pcre2". Was that a mistake? or do you actually mean that you did NOT use the "--without-pcre2" arguement, and it is still working? If so, that implies there was an update that I don't know about correct? Otherwise, i believe you made a grammatacal mistake and meant to say.. "tested now with "--without-pcre2" and works fine." Could you please clarify?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants