Skip to content
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

PCRE2 support still requires PCRE1 #2966

Closed
zhaoshikui opened this issue Aug 17, 2023 · 7 comments
Closed

PCRE2 support still requires PCRE1 #2966

zhaoshikui opened this issue Aug 17, 2023 · 7 comments
Labels
2.x Related to ModSecurity version 2.x

Comments

@zhaoshikui
Copy link

zhaoshikui commented Aug 17, 2023

libmodsecurity 2.9.7 compiles fine using --with-pcre2 only when both pcre1 and pcre2 dev packages are installed, which is wrong...
Moreover, the resulting binary links against both libraries... which is further wrong.

ldd mod_security2.so |grep pcre
ldd: warning: you do not have execution permission for `./mod_security2.so'
libpcre.so.1 => not found
libpcre2-8.so.0 => /usr/lib64/libpcre2-8.so.0 (0x0000ffffb9194000)
...
If only pcre2 dev package is installed, it fails at ./configure --with-pcre2 saying:

checking for libpcre config script... no
configure: *** pcre library not found.
configure: error: pcre library is required

In other words, --with-pcre2 still requires pcre1 dev.
This question is the same as the previous one,however, this issue is not resolved in v2.9.7.

@martinhsv martinhsv added the 2.x Related to ModSecurity version 2.x label Aug 17, 2023
@martinhsv
Copy link
Contributor

Hello @zhaoshikui ,

Just checking my config.log from when the relevant testing was done and I can see:

configure:16348: checking for libpcre config script
configure:16399: result: no
configure:16412: *** pcre library not found.
configure:16445: checking for libpcre2 config script
configure:16475: result: /usr/bin/pcre2-config
configure:16507: using pcre2 v10.39

... and a successful completion of the configure step.

Moreover, the ModSecurity v2 message 'pcre library is required' was removed here: 8fc0b51

Could you please double-check what you've done? If you still see the same result, a more complete description of your build environment and steps to reproduce might be helpful.

@marcstern
Copy link
Contributor

Compiling master on Rocky 9. pcre is still linked:

> ldd /usr/local/lib64/httpd/modules/mod_security2.so
        [...]
        libpcre.so.1 => /usr/lib64/libpcre.so.1 (0x00007f73ca1b4000)
        libpcre2-8.so.0 => /usr/lib64/libpcre2-8.so.0 (0x00007f73ca118000)
        [...]

@airween
Copy link
Member

airween commented Aug 24, 2023

Compiling master on Rocky 9. pcre is still linked:

you mean the current mod_security2 master?

With 2.9.7 on Debian 12 I get:

$ ldd /usr/lib/apache2/modules/mod_security2.so | grep pcre
	libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007ff7be17b000)

only pcre2 dependency, after commit 0539655.

@marcstern
Copy link
Contributor

Yes, latest v2/master.
Here are my configure flages: --enable-pcre-study --enable-pcre-jit --with-pcre2

@zhaoshikui
Copy link
Author

zhaoshikui commented Aug 24, 2023

My compilation parameters only added -- with pcre2

May be we can compile normally, but we cannot use it。
When I use this library, prompt me:
libpcre.so.1: cannot open shared object file: No such file or directory.

@martinhsv
Copy link
Contributor

Thanks, all, for the various comments and observations.

I cannot reproduce what has been described above.

I mostly build in Ubuntu, and if pcre1 is not installed and --with-pcre2 is specified, then the build runs to completion and the resulting .so file functions normally. If pcre1 is installed and --with-pcre2 is specified then configure will search for the relevant files and include references to same in the Makefile ... but pcre1 is still not present when checking via ldd.

Nevertheless, to whatever extent the current situation is causing difficulty or annoyance for anyone, I have created PR #2975 that will omit the check for pcre1 entirely if pcre2 is specified. Feel free to apply the PR if you find it helps you.

I'm not sure that this will be merged immediately since this would break builds of the optional alp2 (I'm moderately sure that it is obsolete but ...)

@zhaoshikui
Copy link
Author

Thank you all.

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

No branches or pull requests

4 participants