Skip to content

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

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
craftogrammer opened this issue Feb 1, 2020 · 5 comments
Assignees
Labels
3.x Related to ModSecurity version 3.x

Comments

@craftogrammer
Copy link

craftogrammer commented Feb 1, 2020

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 :)

@airween
Copy link
Member

airween commented Feb 1, 2020

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.

@zimmerle
Copy link
Contributor

zimmerle commented Feb 3, 2020

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 zimmerle closed this as completed Feb 3, 2020
@zimmerle zimmerle self-assigned this Feb 3, 2020
@zimmerle zimmerle added the 3.x Related to ModSecurity version 3.x label Feb 3, 2020
@albgen
Copy link

albgen commented Apr 15, 2020

hello,

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

@zimmerle
Copy link
Contributor

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.

@albgen
Copy link

albgen commented Apr 16, 2020

Hi zimmerle,

Yes, i compiled removing the libmaxmind library.

Thanks

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

No branches or pull requests

4 participants