1- FROM jwilder/nginx-proxy:0.8.0 as nginx-proxy
2- FROM owasp/modsecurity:3.0.4 as modsecurity
1+ # ModSecurity NGINX Proxy
2+ # eben0/modsecurity-nginx-proxy
3+
4+ FROM jwilder/nginx-proxy:0.9.3 as nginx-proxy
5+ FROM owasp/modsecurity:3.0.6 as modsecurity
36LABEL maintainer=
"Eyal Benatav <[email protected] >" 47
58# copy stuff from nginx-proxy
@@ -10,19 +13,21 @@ COPY --from=nginx-proxy /app/ /app/
1013
1114# env vars
1215ENV DOCKER_HOST unix:///tmp/docker.sock
13- ENV RULES_PATH /etc/modsecurity.d/rules
16+ ENV RULES_PATH /etc/modsecurity.d/proxy- rules
1417ENV RULES_FILE ${RULES_PATH}/rules.conf
1518
1619RUN rm -rf /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/logging.conf \
17- # replace bash env and exec command
18- && sed -i -e 's:#!/bin/bash -e::g' -e 's:etc/:/etc/:g' /docker-entrypoint.sh \
20+ # remove the first line (#!/bin/sh) from modsecurity entrypoint
21+ && sed -i '1d' /docker-entrypoint.sh \
22+ # replace the exec command from nginx-proxy entrypoint
1923 && sed -i 's:exec "$@":\n :g' /app/docker-entrypoint.sh \
20- # concatinate both entry pointers
24+ # add modsecurity entrypoint into nginx-proxy entrypoint
2125 && cat /docker-entrypoint.sh >> /app/docker-entrypoint.sh \
2226 # create rules dir and file
2327 && mkdir -p ${RULES_PATH} && touch ${RULES_FILE} \
2428 # add rules file to setup.conf
2529 && echo "Include ${RULES_FILE}" >> /etc/modsecurity.d/setup.conf \
30+ # && echo "SecRuleEngine On" >> /etc/modsecurity.d/modsecurity.conf \
2631 # add nginx modsecurity module
2732 && sed -i '1s;^;load_module modules/ngx_http_modsecurity_module.so\;\n ;' /etc/nginx/nginx.conf \
2833 # do some cleanup
0 commit comments