ModSecurity icon indicating copy to clipboard operation
ModSecurity copied to clipboard

Modsecurity is not compiling (bool modsecurity::Utils::GeoLookup::lookup Error)

Open craftogrammer opened this issue 6 years ago • 5 comments

Describe the bug

Modsecurity is not compiling

Logs and dumps

utils/geo_lookup.cc: In member function ‘bool modsecurity::Utils::GeoLookup::lookup(const string&, modsecurity::Transaction*, std::function<bool(int, const std::__cxx11::basic_string<char>&)>) const’:
utils/geo_lookup.cc:124:32: error: invalid conversion from ‘const MMDB_s*’ to ‘MMDB_s*’ [-fpermissive]
         r = MMDB_lookup_string(&mmdb, target.c_str(), &gai_error, &mmdb_error);
                                ^~~~~
In file included from ../src/utils/geo_lookup.h:22,
                 from utils/geo_lookup.cc:25:
/usr/local/include/maxminddb.h:204:66: note:   initializing argument 1 of ‘MMDB_lookup_result_s MMDB_lookup_string(MMDB_s*, const char*, int*, int*)’
     extern MMDB_lookup_result_s MMDB_lookup_string(MMDB_s *const mmdb,
                                                    ~~~~~~~~~~~~~~^~~~
make[3]: *** [Makefile:3119: utils/libmodsecurity_la-geo_lookup.lo] Error 1
make[3]: Leaving directory '/root/ModSecurity/src'
make[2]: *** [Makefile:3413: all-recursive] Error 1
make[2]: Leaving directory '/root/ModSecurity/src'
make[1]: *** [Makefile:1200: all] Error 2
make[1]: Leaving directory '/root/ModSecurity/src'
make: *** [Makefile:1027: all-recursive] Error 1

To Reproduce

Compile it from source

git clone --depth 1 -b v3/master --single-branch https://github.com/SpiderLabs/ModSecurity
			cd ModSecurity
			git submodule init
			git submodule update
			./build.sh
			./configure
			make
			make install

Used, above command from this script: https://github.com/OptimBro/OptimStack/blob/master/OptimStack.sh

Expected behavior

A clear and concise description of what you expected to happen.

Server (please complete the following information):

  • ModSecurity version (and connector): latest
  • WebServer: [N/A]
  • OS (and distro): [e.g. Debian 10]

Additional context

Guess: MaxMind has stopped providing GEOIP files, now asking for license and key, that could be the problem, if ModSecurity uses it, I guess. I can see in the above logs.

PS: I'm not good at reporting bugs, so pardon me, if I presented in an unprofessional way.

Thanks :)

craftogrammer avatar Feb 01 '20 05:02 craftogrammer

I think (if you definietly want to use the current master) you have to replace this line with

LIBMAXMINDDB_VER=1.4.2

Looks like the ABI had changed in libmaxminddb in version 1.4.2, and there is an affected change which caused this error.

Another solutions: use 3.0.4, or go back to cd9b8a:

git checkout cd9b8a

(The next commit is 4f13fe, which makes const the lookup() method.)

@zimmerle - it would be good to collect and listed the minimal library versions. There isn't any information about this.

airween avatar Feb 01 '20 22:02 airween

Hi @OptimBro,

That is happening because of you may have an outdated version of lbmaxmind. You may want to use the latest version for libmaxmind. If upgrade is not an option, you may want to disable the libMaxMind dependency using --with-maxmind=no.

zimmerle avatar Feb 03 '20 17:02 zimmerle

hello,

just upgraded to the latest nginx 1.17.10 and had to recompile. Same problem

albgen avatar Apr 15 '20 20:04 albgen

Hi @albgen,

Make sure you have the newest version of ModSecurity.

Check the advise that was stated above: upgrade your libmaxmind or try to disable it by using --with-maxmind=no as ./configure option.

zimmerle avatar Apr 16 '20 01:04 zimmerle

Hi zimmerle,

Yes, i compiled removing the libmaxmind library.

Thanks

albgen avatar Apr 16 '20 08:04 albgen