@@ -6,7 +6,7 @@ ARG LUAJIT_INC=/usr/include/luajit-2.1
66ARG LUAJIT_LIB=/usr/lib
77
88ARG NGINX_VER=release-1.29.3
9- ARG MODSEC_VER=v3.0.14
9+ # ARG MODSEC_VER=v3.0.14
1010
1111ARG DTR_VER=1.29.2
1212ARG RCP_VER=1.29.2
@@ -19,17 +19,17 @@ ARG HMNM_VER=v0.39
1919ARG NDK_VER=v0.3.4
2020ARG LNM_VER=v0.10.29
2121
22- ARG NJS_VER=0.9.4
22+ # ARG NJS_VER=0.9.4
2323ARG NAL_VER=master
2424ARG VTS_VER=v0.2.4
2525ARG NNTLM_VER=master
26- ARG MODSECNGX_VER=v1.0.4
26+ # ARG MODSECNGX_VER=v1.0.4
2727ARG NHG2M_VER=3.4
2828
2929ARG LRC_VER=v0.1.32
3030ARG LRL_VER=v0.15
3131
32- ARG OT_VER=v1.24.0
32+ # ARG OT_VER=v1.24.0
3333
3434# -fPIE -pie / -fPIC -shared
3535ARG FLAGS
@@ -40,24 +40,24 @@ ARG CXXFLAGS="$FLAGS -m64 -O2 -pipe -flto=thin -funroll-loops -ffunction-section
4040ARG LDFLAGS="-fuse-ld=lld -m64 -Wl,-s -Wl,-O1 -Wl,--gc-sections -Wl,-z,nodlopen -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -Wl,--no-copy-dt-needed-entries -Wl,--sort-common -Wl,-z,pack-relative-relocs"
4141
4242WORKDIR /src
43- COPY ModSecurity.patch /src/ModSecurity.patch
43+ # COPY ModSecurity.patch /src/ModSecurity.patch
4444COPY ngx_brotli.patch /src/ngx_brotli.patch
4545COPY ngx_unbrotli.patch /src/ngx_unbrotli.patch
4646COPY attachment.patch /src/attachment.patch
4747RUN apk upgrade --no-cache -a && \
48- apk add --no-cache ca-certificates build-base clang lld cmake ninja git libtool autoconf automake bash \
49- libatomic_ops-dev zlib-dev brotli-dev luajit-dev pcre2-dev linux-headers yajl-dev libxml2-dev libxslt-dev curl-dev lmdb -dev libfuzzy2 -dev lua5.1 -dev lmdb -dev geoip -dev libmaxminddb -dev gtest -dev benchmark -dev protobuf -dev openldap-dev
50-
51- # ModSecurity
52- RUN git clone --depth 1 --shallow-submodules --recurse-submodules https://github.com/owasp-modsecurity/ModSecurity --branch "$MODSEC_VER" /src/ModSecurity && \
53- cd /src/ModSecurity && \
54- git apply /src/ModSecurity.patch && \
55- sed -i "s|SecRuleEngine .*|SecRuleEngine On|g" /src/ModSecurity/modsecurity.conf-recommended && \
56- sed -i "s|^SecAudit|#SecAudit|g" /src/ModSecurity/modsecurity.conf-recommended && \
57- sed -i "s|unicode.mapping|/usr/local/nginx/conf/conf.d/include/unicode.mapping|g" /src/ModSecurity/modsecurity.conf-recommended && \
58- /src/ModSecurity/build.sh && \
59- /src/ModSecurity/configure --with-pcre2 --with-lmdb && \
60- make -j "$(nproc)" install
48+ apk add --no-cache ca-certificates build-base clang lld cmake ninja git \
49+ linux-headers libatomic_ops -dev luajit -dev pcre2 -dev zlib -dev brotli -dev zstd -dev openssl -dev geoip -dev libmaxminddb -dev openldap-dev
50+
51+ # # ModSecurity
52+ # RUN git clone --depth 1 --shallow-submodules --recurse-submodules https://github.com/owasp-modsecurity/ModSecurity --branch "$MODSEC_VER" /src/ModSecurity && \
53+ # cd /src/ModSecurity && \
54+ # git apply /src/ModSecurity.patch && \
55+ # sed -i "s|SecRuleEngine .*|SecRuleEngine On|g" /src/ModSecurity/modsecurity.conf-recommended && \
56+ # sed -i "s|^SecAudit|#SecAudit|g" /src/ModSecurity/modsecurity.conf-recommended && \
57+ # sed -i "s|unicode.mapping|/usr/local/nginx/conf/conf.d/include/unicode.mapping|g" /src/ModSecurity/modsecurity.conf-recommended && \
58+ # /src/ModSecurity/build.sh && \
59+ # /src/ModSecurity/configure --with-pcre2 --with-lmdb && \
60+ # make -j "$(nproc)" install
6161
6262# Download nginx
6363RUN git clone --depth 1 https://github.com/nginx/nginx --branch "$NGINX_VER" /src/nginx && \
@@ -83,11 +83,11 @@ RUN git clone --depth 1 https://github.com/nginx/nginx --branch "$NGINX_VER" /sr
8383 git clone --depth 1 https://github.com/openresty/headers-more-nginx-module --branch "$HMNM_VER" /src/headers-more-nginx-module && \
8484 git clone --depth 1 https://github.com/vision5/ngx_devel_kit --branch "$NDK_VER" /src/ngx_devel_kit && \
8585 git clone --depth 1 https://github.com/openresty/lua-nginx-module --branch "$LNM_VER" /src/lua-nginx-module && \
86- git clone --depth 1 https://github.com/nginx/njs --branch "$NJS_VER" /src/njs && \
86+ # git clone --depth 1 https://github.com/nginx/njs --branch "$NJS_VER" /src/njs && \
8787 git clone --depth 1 https://github.com/kvspb/nginx-auth-ldap --branch "$NAL_VER" /src/nginx-auth-ldap && \
8888 git clone --depth 1 https://github.com/vozlt/nginx-module-vts --branch "$VTS_VER" /src/nginx-module-vts && \
8989 git clone --depth 1 https://github.com/gabihodoroaga/nginx-ntlm-module --branch "$NNTLM_VER" /src/nginx-ntlm-module && \
90- git clone --depth 1 https://github.com/SpiderLabs/ModSecurity-nginx --branch "$MODSECNGX_VER" /src/ModSecurity-nginx && \
90+ # git clone --depth 1 https://github.com/SpiderLabs/ModSecurity-nginx --branch "$MODSECNGX_VER" /src/ModSecurity-nginx && \
9191 git clone --depth 1 https://github.com/leev/ngx_http_geoip2_module --branch "$NHG2M_VER" /src/ngx_http_geoip2_module
9292
9393# Configure nginx
@@ -126,11 +126,11 @@ RUN cd /src/nginx && \
126126 --add-module=/src/lua-nginx-module \
127127 --with-http_geoip_module=dynamic \
128128 --with-stream_geoip_module=dynamic \
129- --add-dynamic-module=/src/njs/nginx \
129+ # --add-dynamic-module=/src/njs/nginx \
130130 --add-dynamic-module=/src/nginx-auth-ldap \
131131 --add-dynamic-module=/src/nginx-module-vts \
132132 --add-dynamic-module=/src/nginx-ntlm-module \
133- --add-dynamic-module=/src/ModSecurity-nginx \
133+ # --add-dynamic-module=/src/ModSecurity-nginx \
134134 --add-dynamic-module=/src/ngx_http_geoip2_module \
135135 --with-cc-opt="-Wno-sign-compare" \
136136 --with-ld-opt="-fuse-ld=lld -m64 -Wl,-s -Wl,-O1 -Wl,--gc-sections -Wl,-z,nodlopen -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -Wl,--no-copy-dt-needed-entries -Wl,--sort-common -Wl,-z,pack-relative-relocs" && \
@@ -152,36 +152,36 @@ RUN git clone --depth 1 https://github.com/openappsec/attachment /src/attachment
152152 ninja && \
153153 mv -v /src/attachment/attachments/nginx/ngx_module/libngx_module.so /usr/local/nginx/modules/libngx_module.so
154154
155- # OpenTelemetry lib
156- ARG CC=gcc
157- # -flto -fzero-init-padding-bits=all
158- ARG CFLAGS="$FLAGS -Wtrampolines -Wbidi-chars=any -O2 -pipe -funroll-loops -ffunction-sections -fdata-sections -fstrict-flex-arrays=3 -fstack-clash-protection -fstack-protector-strong -ftrivial-auto-var-init=zero -fno-delete-null-pointer-checks -fno-strict-overflow -fno-strict-aliasing -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST -Wformat=2 -Werror=format-security"
159- ARG CXX=g++
160- # -flto -fzero-init-padding-bits=all
161- ARG CXXFLAGS="$FLAGS -Wtrampolines -Wbidi-chars=any -O2 -pipe -funroll-loops -ffunction-sections -fdata-sections -fstrict-flex-arrays=3 -fstack-clash-protection -fstack-protector-strong -ftrivial-auto-var-init=zero -fno-delete-null-pointer-checks -fno-strict-overflow -fno-strict-aliasing -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST -Wformat=2 -Werror=format-security"
162- ARG LDFLAGS="-Wl,-s -Wl,-O1 -Wl,--gc-sections -Wl,-z,nodlopen -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -Wl,--no-copy-dt-needed-entries -Wl,--sort-common -Wl,-z,pack-relative-relocs"
163- RUN git clone --depth 1 https://github.com/open-telemetry/opentelemetry-cpp --branch "$OT_VER" /src/opentelemetry-cpp && \
164- cd /src/opentelemetry-cpp && \
165- cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DWITH_OTLP_HTTP=ON -G Ninja && \
166- ninja install
167-
168- # OpenTelemetry module
169- ARG CC=clang
170- ARG CFLAGS="$FLAGS -m64 -O2 -pipe -flto=thin -funroll-loops -ffunction-sections -fdata-sections -fstrict-flex-arrays=3 -fstack-clash-protection -fstack-protector-strong -ftrivial-auto-var-init=zero -fno-delete-null-pointer-checks -fno-strict-overflow -fno-strict-aliasing -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST -Wformat=2 -Werror=format-security"
171- ARG CXX=clang++
172- ARG CXXFLAGS="$FLAGS -m64 -O2 -pipe -flto=thin -funroll-loops -ffunction-sections -fdata-sections -fstrict-flex-arrays=3 -fstack-clash-protection -fstack-protector-strong -ftrivial-auto-var-init=zero -fno-delete-null-pointer-checks -fno-strict-overflow -fno-strict-aliasing -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST -Wformat=2 -Werror=format-security"
173- ARG LDFLAGS="-fuse-ld=lld -m64 -Wl,-s -Wl,-O1 -Wl,--gc-sections -Wl,-z,nodlopen -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -Wl,--no-copy-dt-needed-entries -Wl,--sort-common -Wl,-z,pack-relative-relocs"
174- RUN git clone --depth 1 https://github.com/open-telemetry/opentelemetry-cpp-contrib /src/opentelemetry-cpp-contrib && \
175- cd /src/opentelemetry-cpp-contrib/instrumentation/nginx && \
176- cmake -G Ninja && \
177- ninja && \
178- mv -v /src/opentelemetry-cpp-contrib/instrumentation/nginx/otel_ngx_module.so /usr/local/nginx/modules/otel_ngx_module.so
155+ # # OpenTelemetry lib
156+ # ARG CC=gcc
157+ # # -flto -fzero-init-padding-bits=all
158+ # ARG CFLAGS="$FLAGS -Wtrampolines -Wbidi-chars=any -O2 -pipe -funroll-loops -ffunction-sections -fdata-sections -fstrict-flex-arrays=3 -fstack-clash-protection -fstack-protector-strong -ftrivial-auto-var-init=zero -fno-delete-null-pointer-checks -fno-strict-overflow -fno-strict-aliasing -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST -Wformat=2 -Werror=format-security"
159+ # ARG CXX=g++
160+ # # -flto -fzero-init-padding-bits=all
161+ # ARG CXXFLAGS="$FLAGS -Wtrampolines -Wbidi-chars=any -O2 -pipe -funroll-loops -ffunction-sections -fdata-sections -fstrict-flex-arrays=3 -fstack-clash-protection -fstack-protector-strong -ftrivial-auto-var-init=zero -fno-delete-null-pointer-checks -fno-strict-overflow -fno-strict-aliasing -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST -Wformat=2 -Werror=format-security"
162+ # ARG LDFLAGS="-Wl,-s -Wl,-O1 -Wl,--gc-sections -Wl,-z,nodlopen -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -Wl,--no-copy-dt-needed-entries -Wl,--sort-common -Wl,-z,pack-relative-relocs"
163+ # RUN git clone --depth 1 https://github.com/open-telemetry/opentelemetry-cpp --branch "$OT_VER" /src/opentelemetry-cpp && \
164+ # cd /src/opentelemetry-cpp && \
165+ # cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DWITH_OTLP_HTTP=ON -G Ninja && \
166+ # ninja install
167+
168+ # # OpenTelemetry module
169+ # ARG CC=clang
170+ # ARG CFLAGS="$FLAGS -m64 -O2 -pipe -flto=thin -funroll-loops -ffunction-sections -fdata-sections -fstrict-flex-arrays=3 -fstack-clash-protection -fstack-protector-strong -ftrivial-auto-var-init=zero -fno-delete-null-pointer-checks -fno-strict-overflow -fno-strict-aliasing -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST -Wformat=2 -Werror=format-security"
171+ # ARG CXX=clang++
172+ # ARG CXXFLAGS="$FLAGS -m64 -O2 -pipe -flto=thin -funroll-loops -ffunction-sections -fdata-sections -fstrict-flex-arrays=3 -fstack-clash-protection -fstack-protector-strong -ftrivial-auto-var-init=zero -fno-delete-null-pointer-checks -fno-strict-overflow -fno-strict-aliasing -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST -Wformat=2 -Werror=format-security"
173+ # ARG LDFLAGS="-fuse-ld=lld -m64 -Wl,-s -Wl,-O1 -Wl,--gc-sections -Wl,-z,nodlopen -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -Wl,--no-copy-dt-needed-entries -Wl,--sort-common -Wl,-z,pack-relative-relocs"
174+ # RUN git clone --depth 1 https://github.com/open-telemetry/opentelemetry-cpp-contrib /src/opentelemetry-cpp-contrib && \
175+ # cd /src/opentelemetry-cpp-contrib/instrumentation/nginx && \
176+ # cmake -G Ninja && \
177+ # ninja && \
178+ # mv -v /src/opentelemetry-cpp-contrib/instrumentation/nginx/otel_ngx_module.so /usr/local/nginx/modules/otel_ngx_module.so
179179
180180# strip files
181181RUN strip -s /usr/local/nginx/sbin/nginx && \
182182 find /usr/local/nginx/modules -name "*.so" -exec strip -s {} \; && \
183- strip -s /src/ModSecurity/src/.libs/libmodsecurity.so.3 && \
184- strip -s /src/opentelemetry-cpp/libopentelemetry_proto.so && \
183+ # strip -s /src/ModSecurity/src/.libs/libmodsecurity.so.3 && \
184+ # strip -s /src/opentelemetry-cpp/libopentelemetry_proto.so && \
185185 strip -s /src/attachment/core/shmem_ipc/libosrc_shmem_ipc.so && \
186186 strip -s /src/attachment/core/compression/libosrc_compression_utils.so && \
187187 strip -s /src/attachment/attachments/nginx/nginx_attachment_util/libosrc_nginx_attachment_util.so
@@ -190,15 +190,13 @@ FROM alpine:3.23.0
190190SHELL ["/bin/ash" , "-eo" , "pipefail" , "-c" ]
191191COPY --from=build /usr/local/nginx /usr/local/nginx
192192COPY --from=build /usr/local/share/lua/5.1 /usr/local/share/lua/5.1
193- COPY --from=build /src/ModSecurity/src/.libs/libmodsecurity.so.3 /usr/local/lib/libmodsecurity.so.3
194- COPY --from=build /src/ModSecurity/unicode.mapping /usr/local/nginx/conf/conf.d/include/unicode.mapping
195- COPY --from=build /src/ModSecurity/modsecurity.conf-recommended /usr/local/nginx/conf/conf.d/include/modsecurity.conf.example
196- COPY --from=build /src/opentelemetry-cpp/libopentelemetry_proto.so /usr/local/lib/libopentelemetry_proto.so
193+ # COPY --from=build /src/ModSecurity/src/.libs/libmodsecurity.so.3 /usr/local/lib/libmodsecurity.so.3
194+ # COPY --from=build /src/opentelemetry-cpp/libopentelemetry_proto.so /usr/local/lib/libopentelemetry_proto.so
197195COPY --from=build /src/attachment/core/shmem_ipc/libosrc_shmem_ipc.so /usr/local/lib/libosrc_shmem_ipc.so
198196COPY --from=build /src/attachment/core/compression/libosrc_compression_utils.so /usr/local/lib/libosrc_compression_utils.so
199197COPY --from=build /src/attachment/attachments/nginx/nginx_attachment_util/libosrc_nginx_attachment_util.so /usr/local/lib/libosrc_nginx_attachment_util.so
200198RUN apk upgrade --no-cache -a && \
201- apk add --no-cache ca-certificates tzdata tini zlib luajit pcre2 libstdc++ yajl libxml2 libxslt libcurl lmdb libfuzzy2 lua5.1-libs geoip libmaxminddb-libs libprotobuf openldap openssl && \
199+ apk add --no-cache tzdata tini luajit pcre2 zlib brotli zstd libssl3 libcrypto3 geoip libmaxminddb-libs libldap && \
202200 ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/nginx
203201
204202ENTRYPOINT ["tini" , "--" , "nginx" ]
0 commit comments