@@ -7,6 +7,8 @@ FROM debian:bookworm-slim AS nginxbuilder
77ARG OPENRESTY_VERSION
88ARG LUA_VERSION
99ARG LUAROCKS_VERSION
10+ ARG LIBMODSECURITY_VERSION
11+ ARG MODSECURITY_NGINX_VERSION
1012
1113RUN apt-get update \
1214 && apt-get install -y \
@@ -16,7 +18,12 @@ RUN apt-get update \
1618 libpcre3-dev \
1719 libreadline-dev \
1820 libssl-dev \
19- openssl unzip \
21+ openssl \
22+ unzip \
23+ autoconf \
24+ automake \
25+ libtool \
26+ libpcre2-dev \
2027 wget \
2128 zlib1g-dev \
2229 git \
@@ -26,6 +33,10 @@ RUN apt-get update \
2633COPY ./scripts/build-lua /tmp/build-lua
2734RUN /tmp/build-lua
2835
36+ # LibModSecurity build
37+ COPY ./scripts/build-modsecurity /tmp/build-modsecurity
38+ RUN /tmp/build-modsecurity
39+
2940# Nginx build
3041COPY ./scripts/build-openresty /tmp/build-openresty
3142RUN /tmp/build-openresty
@@ -40,6 +51,7 @@ LABEL maintainer="Jamie Curnow <jc@jc21.com>"
4051SHELL ["/bin/bash" , "-o" , "pipefail" , "-c" ]
4152
4253ARG TARGETPLATFORM
54+ ARG CRS_VERSION
4355RUN echo "Base: debian:bookworm-slim, ${TARGETPLATFORM:-linux/amd64}" > /built-for-arch
4456
4557# OpenResty uses LuaJIT which has a dependency on GCC
@@ -74,24 +86,29 @@ COPY --from=nginxbuilder /tmp/luarocks /tmp/luarocks
7486COPY ./scripts/install-lua /tmp/install-lua
7587
7688# Copy openresty build from first image
89+ COPY --from=nginxbuilder /tmp/modsecurity /tmp/modsecurity
7790COPY --from=nginxbuilder /tmp/openresty /tmp/openresty
7891COPY ./scripts/install-openresty /tmp/install-openresty
7992
8093# Copy crowdsec openresty bouncer install script
8194COPY ./scripts/install-crowdsec_openresty_bouncer /tmp/install-crowdsec_openresty_bouncer
8295
96+ # Copy OWASP core ruleset install script
97+ COPY ./scripts/install-crs /tmp/install-crs
98+
8399ARG OPENRESTY_VERSION
84100ARG CROWDSEC_OPENRESTY_BOUNCER_VERSION
85101ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
86102 OPENRESTY_VERSION=${OPENRESTY_VERSION} \
87103 CROWDSEC_OPENRESTY_BOUNCER_VERSION=${CROWDSEC_OPENRESTY_BOUNCER_VERSION}
88104
89- # Install openresty, lua, then clean up file system
105+ # Install openresty, lua, csr, then clean up file system
90106RUN apt-get update \
91- && apt-get install -y gcc make socat git \
107+ && apt-get install -y build-essential gcc make socat git autoconf automake libtool libpcre2-dev \
92108 && /tmp/install-lua \
109+ && /tmp/install-crs \
93110 && /tmp/install-openresty \
94- && apt-get remove -y make gcc git wget gettext \
111+ && apt-get remove -y build-essential gcc make git wget gettext autoconf automake libtool libpcre2-dev \
95112 && apt-get autoremove -y \
96113 && apt-get clean \
97114 && rm -rf /var/lib/apt/lists/* \
0 commit comments