Skip to content

Commit a569ef9

Browse files
committed
更新 Nginx 至 1.29.3, ModSecurity 至 v3.0.14
1 parent 377f8bb commit a569ef9

File tree

5 files changed

+129
-13
lines changed

5 files changed

+129
-13
lines changed

Dockerfile.latest

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM nginx:1.29.2-alpine AS builder
1+
FROM nginx:1.29.3-alpine AS builder
22

33
# 设置 ModSecurity 版本
44
ENV MODSECURITY_VERSION=v3.0.14
@@ -34,9 +34,9 @@ RUN apk add --no-cache --virtual .build-deps \
3434
WORKDIR /opt
3535

3636
# 下载 Nginx 源码
37-
RUN wget https://nginx.org/download/nginx-1.29.2.tar.gz \
38-
&& tar -xzf nginx-1.29.2.tar.gz \
39-
&& rm nginx-1.29.2.tar.gz
37+
RUN wget https://nginx.org/download/nginx-1.29.3.tar.gz \
38+
&& tar -xzf nginx-1.29.3.tar.gz \
39+
&& rm nginx-1.29.3.tar.gz
4040

4141
# 下载 ModSecurity
4242
RUN git clone --depth 1 -b ${MODSECURITY_VERSION} https://github.com/owasp-modsecurity/ModSecurity.git
@@ -55,18 +55,18 @@ RUN cd /opt/ModSecurity \
5555
&& make clean
5656

5757
# 编译 Nginx 与 ModSecurity 模块
58-
RUN cd /opt/nginx-1.29.2 \
58+
RUN cd /opt/nginx-1.29.3 \
5959
&& ./configure --with-compat --add-dynamic-module=/opt/ModSecurity-nginx \
6060
&& make modules \
6161
&& cp objs/ngx_http_modsecurity_module.so /etc/nginx/modules \
6262
&& mkdir -p /etc/nginx/modsec \
6363
&& cp /opt/ModSecurity/unicode.mapping /etc/nginx/modsec/
6464

6565
# 最终镜像
66-
FROM nginx:1.29.2-alpine AS final
66+
FROM nginx:1.29.3-alpine AS final
6767

6868
# 安装运行时依赖
69-
RUN apk add --no-cache --purge --virtual .runtime-deps \
69+
RUN apk add --no-cache --virtual .runtime-deps \
7070
lua5.4 \
7171
yajl \
7272
libstdc++ \
@@ -77,14 +77,17 @@ RUN apk add --no-cache --purge --virtual .runtime-deps \
7777
curl
7878

7979
# 复制配置文件和模块
80-
RUN sed -i '1i load_module modules/ngx_http_modsecurity_module.so;\n' /etc/nginx/nginx.conf
80+
RUN mkdir -p /etc/nginx/modules-available \
81+
&& echo "load_module modules/ngx_http_modsecurity_module.so;" > /etc/nginx/modules-available/50-modsecurity.conf \
82+
&& mkdir -p /etc/nginx/modules-enabled \
83+
&& ln -s /etc/nginx/modules-available/50-modsecurity.conf /etc/nginx/modules-enabled/
8184
COPY --from=builder /usr/local/modsecurity/ /usr/local/modsecurity/
8285
COPY --from=builder /etc/nginx/modules/ngx_http_modsecurity_module.so /etc/nginx/modules/
8386
COPY --from=builder /etc/nginx/modsec/unicode.mapping /etc/nginx/modsec/
8487

8588
# 添加构建信息标签
8689
LABEL maintainer="AptS-1547 <[email protected]>" \
87-
nginx_version="1.29.2" \
90+
nginx_version="1.29.3" \
8891
modsecurity_version="v3.0.14" \
8992
modsecurity_nginx_version="v1.0.4" \
90-
build_date="2025-10-15T17:42:47Z"
93+
build_date="2025-10-29T18:25:20Z"

mainline_version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.29.2
1+
1.29.3

nginx-1.29.3/mod-3.0.14/Dockerfile

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
FROM nginx:1.29.3-alpine AS builder
2+
3+
# 设置 ModSecurity 版本
4+
ENV MODSECURITY_VERSION=v3.0.14
5+
ENV MODSECURITY_NGINX_VERSION=v1.0.4
6+
7+
# 安装构建依赖
8+
RUN apk add --no-cache --virtual .build-deps \
9+
alpine-sdk \
10+
autoconf \
11+
automake \
12+
bison \
13+
curl \
14+
doxygen \
15+
flex \
16+
g++ \
17+
gcc \
18+
git \
19+
libtool \
20+
lmdb-dev \
21+
lua5.4-dev \
22+
make \
23+
curl-dev \
24+
pcre2-dev \
25+
yajl-dev \
26+
zlib-dev \
27+
libxml2-dev \
28+
geoip-dev \
29+
pcre-dev \
30+
linux-headers \
31+
wget
32+
33+
# 创建工作目录
34+
WORKDIR /opt
35+
36+
# 下载 Nginx 源码
37+
RUN wget https://nginx.org/download/nginx-1.29.3.tar.gz \
38+
&& tar -xzf nginx-1.29.3.tar.gz \
39+
&& rm nginx-1.29.3.tar.gz
40+
41+
# 下载 ModSecurity
42+
RUN git clone --depth 1 -b ${MODSECURITY_VERSION} https://github.com/owasp-modsecurity/ModSecurity.git
43+
44+
# 下载 ModSecurity-nginx 连接器
45+
RUN git clone --depth 1 -b ${MODSECURITY_NGINX_VERSION} https://github.com/owasp-modsecurity/ModSecurity-nginx.git
46+
47+
# 编译 ModSecurity
48+
RUN cd /opt/ModSecurity \
49+
&& git submodule init \
50+
&& git submodule update \
51+
&& ./build.sh \
52+
&& ./configure --prefix=/usr/local/modsecurity --with-lmdb --with-pcre2 \
53+
&& make \
54+
&& make install \
55+
&& make clean
56+
57+
# 编译 Nginx 与 ModSecurity 模块
58+
RUN cd /opt/nginx-1.29.3 \
59+
&& ./configure --with-compat --add-dynamic-module=/opt/ModSecurity-nginx \
60+
&& make modules \
61+
&& cp objs/ngx_http_modsecurity_module.so /etc/nginx/modules \
62+
&& mkdir -p /etc/nginx/modsec \
63+
&& cp /opt/ModSecurity/unicode.mapping /etc/nginx/modsec/
64+
65+
# 最终镜像
66+
FROM nginx:1.29.3-alpine AS final
67+
68+
# 安装运行时依赖
69+
RUN apk add --no-cache --virtual .runtime-deps \
70+
lua5.4 \
71+
yajl \
72+
libstdc++ \
73+
pcre2 \
74+
lmdb \
75+
geoip \
76+
libxml2 \
77+
curl
78+
79+
# 复制配置文件和模块
80+
RUN mkdir -p /etc/nginx/modules-available \
81+
&& echo "load_module modules/ngx_http_modsecurity_module.so;" > /etc/nginx/modules-available/50-modsecurity.conf \
82+
&& mkdir -p /etc/nginx/modules-enabled \
83+
&& ln -s /etc/nginx/modules-available/50-modsecurity.conf /etc/nginx/modules-enabled/
84+
COPY --from=builder /usr/local/modsecurity/ /usr/local/modsecurity/
85+
COPY --from=builder /etc/nginx/modules/ngx_http_modsecurity_module.so /etc/nginx/modules/
86+
COPY --from=builder /etc/nginx/modsec/unicode.mapping /etc/nginx/modsec/
87+
88+
# 添加构建信息标签
89+
LABEL maintainer="AptS-1547 <[email protected]>" \
90+
nginx_version="1.29.3" \
91+
modsecurity_version="v3.0.14" \
92+
modsecurity_nginx_version="v1.0.4" \
93+
build_date="2025-10-29T18:25:20Z"

nginx-1.29.3/mod-3.0.14/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# ModSecurity with Nginx
2+
3+
版本信息:
4+
- Nginx: 1.29.3
5+
- ModSecurity: v3.0.14
6+
- ModSecurity-nginx: v1.0.4
7+
8+
创建日期: 2025-10-29T18:25:20Z
9+
10+
## 构建镜像
11+
12+
```bash
13+
docker build -t modsecurity:1.29.3-3.0.14 .
14+
```
15+
16+
## 运行容器
17+
18+
```bash
19+
docker run -d -p 80:80 modsecurity:1.29.3-3.0.14
20+
```

versions.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
NGINX_VERSION=1.29.2
1+
NGINX_VERSION=1.29.3
22
MODSECURITY_VERSION=v3.0.14
33
MODSECURITY_NGINX_VERSION=v1.0.4
4-
BUILD_DATE=2025-10-15T17:42:47Z
4+
BUILD_DATE=2025-10-29T18:25:20Z

0 commit comments

Comments
 (0)