Skip to content

Commit 953ac59

Browse files
committed
chore: 更新nginx和依赖版本至最新
- 将nginx从1.14.2升级到1.28.0版本 - 更新modsecurity-nginx连接器从v1.0.3到v1.0.4 - 升级lua运行时从5.3到5.4版本 - 添加nginx 1.28.0 + modsecurity v3.0.14的Dockerfile配置 - 更新版本配置文件和构建脚本以反映新版本 - 更新latest_version文件中的版本号为1.28.0 此次更新确保使用最新的安全补丁和功能改进,保持依赖项的现代性和安全性。
1 parent d364e2d commit 953ac59

File tree

6 files changed

+127
-17
lines changed

6 files changed

+127
-17
lines changed

Dockerfile.latest

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
FROM nginx:1.14.2-alpine AS builder
1+
FROM nginx:1.28.0-alpine AS builder
22

33
# 设置 ModSecurity 版本
44
ENV MODSECURITY_VERSION=v3.0.14
5-
ENV MODSECURITY_NGINX_VERSION=v1.0.3
5+
ENV MODSECURITY_NGINX_VERSION=v1.0.4
66

77
# 安装构建依赖
88
RUN apk add --no-cache --virtual .build-deps \
@@ -18,7 +18,7 @@ RUN apk add --no-cache --virtual .build-deps \
1818
git \
1919
libtool \
2020
lmdb-dev \
21-
lua5.3-dev \
21+
lua5.4-dev \
2222
make \
2323
curl-dev \
2424
pcre2-dev \
@@ -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.14.2.tar.gz \
38-
&& tar -xzf nginx-1.14.2.tar.gz \
39-
&& rm nginx-1.14.2.tar.gz
37+
RUN wget https://nginx.org/download/nginx-1.28.0.tar.gz \
38+
&& tar -xzf nginx-1.28.0.tar.gz \
39+
&& rm nginx-1.28.0.tar.gz
4040

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

5757
# 编译 Nginx 与 ModSecurity 模块
58-
RUN cd /opt/nginx-1.14.2 \
58+
RUN cd /opt/nginx-1.28.0 \
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.14.2-alpine AS final
66+
FROM nginx:1.28.0-alpine AS final
6767

6868
# 安装运行时依赖
6969
RUN apk add --no-cache --purge --virtual .runtime-deps \
70-
lua5.3 \
70+
lua5.4 \
7171
yajl \
7272
libstdc++ \
7373
pcre2 \
@@ -84,7 +84,7 @@ COPY --from=builder /etc/nginx/modsec/unicode.mapping /etc/nginx/modsec/
8484

8585
# 添加构建信息标签
8686
LABEL maintainer="AptS-1547 <[email protected]>" \
87-
nginx_version="1.14.2" \
87+
nginx_version="1.28.0" \
8888
modsecurity_version="v3.0.14" \
89-
modsecurity_nginx_version="v1.0.3" \
90-
build_date="2025-05-21T13:22:06Z"
89+
modsecurity_nginx_version="v1.0.4" \
90+
build_date="2025-10-04T13:29:44Z"

latest_version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.26.3
1+
1.28.0

nginx-1.28.0/mod-3.0.14/Dockerfile

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
FROM nginx:1.28.0-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.28.0.tar.gz \
38+
&& tar -xzf nginx-1.28.0.tar.gz \
39+
&& rm nginx-1.28.0.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.28.0 \
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.28.0-alpine AS final
67+
68+
# 安装运行时依赖
69+
RUN apk add --no-cache --purge --virtual .runtime-deps \
70+
lua5.4 \
71+
yajl \
72+
libstdc++ \
73+
pcre2 \
74+
lmdb \
75+
geoip \
76+
libxml2 \
77+
curl
78+
79+
# 复制配置文件和模块
80+
RUN sed -i '1i load_module modules/ngx_http_modsecurity_module.so;\n' /etc/nginx/nginx.conf
81+
COPY --from=builder /usr/local/modsecurity/ /usr/local/modsecurity/
82+
COPY --from=builder /etc/nginx/modules/ngx_http_modsecurity_module.so /etc/nginx/modules/
83+
COPY --from=builder /etc/nginx/modsec/unicode.mapping /etc/nginx/modsec/
84+
85+
# 添加构建信息标签
86+
LABEL maintainer="AptS-1547 <[email protected]>" \
87+
nginx_version="1.28.0" \
88+
modsecurity_version="v3.0.14" \
89+
modsecurity_nginx_version="v1.0.4" \
90+
build_date="2025-10-04T13:29:44Z"

nginx-1.28.0/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.28.0
5+
- ModSecurity: v3.0.14
6+
- ModSecurity-nginx: v1.0.4
7+
8+
创建日期: 2025-10-04T13:29:44Z
9+
10+
## 构建镜像
11+
12+
```bash
13+
docker build -t modsecurity:1.28.0-3.0.14 .
14+
```
15+
16+
## 运行容器
17+
18+
```bash
19+
docker run -d -p 80:80 modsecurity:1.28.0-3.0.14
20+
```

update.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# 设置版本
44
NGINX_VERSION=${1:-"1.26.3"}
55
MODSECURITY_VERSION=${2:-"v3.0.14"}
6-
MODSECURITY_NGINX_VERSION=${3:-"v1.0.3"}
6+
MODSECURITY_NGINX_VERSION=${3:-"v1.0.4"}
77
AUTO_PUSH=${4:-"false"} # 新增参数,控制是否自动提交和推送
88

99
# 移除版本号中的 'v' 前缀,便于文件夹命名

versions.env

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
NGINX_VERSION=1.14.2
1+
NGINX_VERSION=1.28.0
22
MODSECURITY_VERSION=v3.0.14
3-
MODSECURITY_NGINX_VERSION=v1.0.3
4-
BUILD_DATE=2025-05-21T13:22:06Z
3+
MODSECURITY_NGINX_VERSION=v1.0.4
4+
BUILD_DATE=2025-10-04T13:29:44Z

0 commit comments

Comments
 (0)