owasp-modsecurity / ModSecurity-apache

ModSecurity v3 Apache Connector
Apache License 2.0
87 stars 51 forks source link

Type(s) not resolved during make #66

Closed jferch closed 4 years ago

jferch commented 4 years ago

Hi everyone,

I'm trying to build the connector on an arch linux machine and get the following error during compilation. The headers are found during configure ("checking for modsecurity/modsecurity.h... yes")?? Can you give me a hint on what I'm doing wrong here or might have missed? Thanks in advance!

` ~/aur/modsecurity_apache % >> ./autogen.sh configure.ac:10: installing './compile' configure.ac:8: installing './install-sh' configure.ac:8: installing './missing' ~/aur/modsecurity_apache % >> ./configure --with-libmodsecurity=/usr/local/modsecurity/ checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /usr/bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes configure: looking for Apache module support via DSO through APXS configure: found APXS at /usr/sbin/apxs checking whether make supports the include directive... yes (GNU style) checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking whether gcc understands -c and -o together... yes checking dependency style of gcc... none checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes configure: looking for libmodsecurity checking for msc_init in -lmodsecurity... yes checking modsecurity/modsecurity.h usability... yes checking modsecurity/modsecurity.h presence... yes checking for modsecurity/modsecurity.h... yes checking if apache is wanted... yes checking for httpd... /usr/bin/httpd checking apache modules... in /etc/httpd/modules checking for perl... /usr/bin/perl Found Apache with MPM prefork, . ./configure: line 4549: [: ==: unary operator expected ./configure: line 4552: [: ==: unary operator expected checking for gcc... (cached) gcc checking whether we are using the GNU C compiler... (cached) yes checking whether gcc accepts -g... (cached) yes checking for gcc option to accept ISO C89... (cached) none needed checking whether gcc understands -c and -o together... (cached) yes checking dependency style of gcc... (cached) none checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating build/apxs-wrapper config.status: creating tests/regression/server_root/conf/httpd.conf config.status: creating tests/regression/misc/40-secRemoteRules.t config.status: creating tests/regression/misc/60-pmfromfile-external.t config.status: creating tests/regression/misc/50-ipmatchfromfile-external.t config.status: creating tests/run-regression-tests.pl config.status: executing depfiles commands ~/aur/modsecurity_apache % >> make chmod +x build/apxs-wrapper build/apxs-wrapper /usr/share/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd -I/usr/include/apr-1 -I/usr/include/apr-1 -I/usr/include -fPIC -O0 -I/usr/local/modsecurity//include/ -c -o src/mod_security3.lo src/mod_security3.c && touch src/mod_security3.slo In file included from src/msc_filters.h:17, from src/mod_security3.h:27, from src/mod_security3.c:4: src/mod_security3.h:49:5: error: unknown type name ‘Rules’ 49 | Rules rules_set; | ^~~~~ src/mod_security3.c: In function ‘create_tx_context’: src/mod_security3.c:151:14: error: ‘Rules’ undeclared (first use in this function); did you mean ‘Rules_t’? 151 | (Rules )z->rules_set, unique_id, (void )r); | ^~~~~ | Rules_t src/mod_security3.c:151:14: note: each undeclared identifier is reported only once for each function it appears in src/mod_security3.c:151:21: error: expected expression before ‘)’ token 151 | (Rules )z->rules_set, unique_id, (void )r); | ^ src/mod_security3.c:150:18: error: too few arguments to function ‘msc_new_transaction_with_id’ 150 | msr->t = msc_new_transaction_with_id(msc_apache->modsec, | ^~~~~~~ In file included from /usr/local/modsecurity//include/modsecurity/modsecurity.h:175, from src/mod_security3.h:5, from src/mod_security3.c:4: /usr/local/modsecurity//include/modsecurity/transaction.h:610:14: note: declared here 610 | Transaction msc_new_transaction_with_id(ModSecurity ms, | ^~~~~~~ src/mod_security3.c:154:21: error: expected expression before ‘)’ token 154 | (Rules )z->rules_set, (void )r); | ^ src/mod_security3.c:153:18: error: too few arguments to function ‘msc_new_transaction’ 153 | msr->t = msc_new_transaction(msc_apache->modsec, | ^~~~~~~ In file included from /usr/local/modsecurity//include/modsecurity/modsecurity.h:175, from src/mod_security3.h:5, from src/mod_security3.c:4: /usr/local/modsecurity//include/modsecurity/transaction.h:606:14: note: declared here 606 | Transaction msc_new_transaction(ModSecurity *ms, | ^~~~~~~ apxs:Error: Command failed with rc=65536 . make: *** [Makefile:638: all] Error 1

`

zimmerle commented 4 years ago

Hi @jferch,

Did you have the chance to install libModSecurity on your box?

dotiq commented 4 years ago

@zimmerle, I'm experiencing the same issue on a clean CentOS 7.7 build. I did initially have the libmodsecurity package installed via EPEL, but removed it before compiling everything.

libmodsecurity did compile without any errors, just can't get the Apache connector to compile.

gthuo commented 4 years ago

Same issue here. libmodsecurity compiled well. But the Apache connector throws errors src/mod_security3.h:49:5: error: unknown type name 'Rules' Rules *rules_set; ^ I have tried this on 3 CentOS boxes, and no success yet. Someone please help.

jferch commented 4 years ago

@zimmerle, thanks for the reply. Yes, libmodsecurity could be built without trouble on my machine.

zimmerle commented 4 years ago

The Apache connector is not in sync with v3/master for libModSecurity. Try to use a release tag instead. - https://github.com/SpiderLabs/ModSecurity/releases/tag/v3.0.4

dotiq commented 4 years ago

Time to show off my newbie hat. I looked at that link, but I don't see any Apache connector related source code. What am I missing?

zimmerle commented 4 years ago

Time to show off my newbie hat. I looked at that link, but I don't see any Apache connector related source code. What am I missing?

Apache connector depends on libModSecurity to work. libModSecurity needs to be fully installed on your system. The code from v3/master is on a stage that it is not compatible with the current version of the Apache connector. You need to install the version 3.0.4 in order to get it working.