Last active
May 3, 2022 14:03
-
-
Save anyhotcountry/6f1bf71d0197817228928674d07b030a to your computer and use it in GitHub Desktop.
Dockerfile to compile the ModSecurity-nginx connector. The distribution can then be copied to your local file system.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:hirsute | |
ARG NGINX_VER=1.20.2 | |
RUN apt-get update && \ | |
apt-get install -y apt-utils autoconf automake build-essential git libcurl4-openssl-dev libgeoip-dev liblmdb-dev libpcre++-dev libtool libxml2-dev libyajl-dev pkgconf wget zlib1g-dev | |
WORKDIR /root | |
RUN git clone --depth 1 -b v3/master --single-branch https://github.com/SpiderLabs/ModSecurity | |
WORKDIR /root/ModSecurity | |
RUN git submodule init && \ | |
git submodule update && \ | |
./build.sh && \ | |
./configure && \ | |
make && \ | |
make install | |
WORKDIR /root | |
RUN git clone --depth 1 https://github.com/SpiderLabs/ModSecurity-nginx.git && \ | |
wget http://nginx.org/download/nginx-${NGINX_VER}.tar.gz && \ | |
tar zxvf nginx-${NGINX_VER}.tar.gz | |
WORKDIR /root/nginx-${NGINX_VER} | |
RUN ./configure --with-compat --add-dynamic-module=../ModSecurity-nginx && \ | |
make modules && \ | |
mkdir -p /etc/nginx/modules /etc/nginx/modsec && \ | |
cp objs/ngx_http_modsecurity_module.so /etc/nginx/modules/ && \ | |
cp ../ModSecurity/unicode.mapping /etc/nginx/modsec/ && \ | |
tar zcf ModSecurity-nginx-${NGINX_VER}.tgz /usr/local/modsecurity /etc/nginx/modules /etc/nginx/modsec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
NGINX_VER=1.20.2 | |
docker build --build-arg NGINX_VER=${NGINX_VER} -t anyhotcountry/modsecurity . | |
docker run -it --rm -v ${PWD}:/root/dist anyhotcountry/modsecurity cp ModSecurity-nginx-${NGINX_VER}.tgz /root/dist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment