0

I have created a docker multi-stage build to be able to end up with a small, lean container with the most recent nginx version and some modules compiled from source.

At the end I copy over the binary and a few other files to the final container - this works fine.

Additionally I'm trying to set up modsecurity as instructed here: https://www.nginx.com/blog/compiling-and-installing-modsecurity-for-open-source-nginx/

This also works fine in the original build container. Bu when I copy over ngx_http_modsecurity_module.so to the final target container and launch nginx, it fails with:

[emerg] 1#1: dlopen() "/usr/local/nginx/modules/ngx_http_modsecurity_module.so" failed (libmodsecurity.so.3: cannot open shared object file: No such file or directory) in /etc/nginx/nginx.conf:10

The file definitely exists so the error message is neither very precise nor very helpful.

Since it works in the build container I suspect something else is missing but the error message does not give any helpful clues? What could be missing? Where could I look for further clues? Thanks.

PS: I start from debian:stretch-slim image

0

By coincidence I found it out now. I had to:

Also copy over:

/usr/local/modsecurity

and install:

libgeoip1 libxml2 liblmdb0 libyajl2

Probably because this is a dynamic module.

0

Try https://hub.docker.com/r/krish512/modsecurity/, it is already built with latest ModSecurity CRS rules

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.