@@ -26,12 +26,17 @@ jobs:
2626 sudo dpkg --add-architecture i386
2727 sudo apt-get update -y -qq
2828 sudo apt-get install -y make autoconf automake make libyajl-dev libxml2-dev libmaxminddb-dev libcurl4-gnutls-dev $COMPDEPS
29- - name : Install ModSecurity library
30- env :
31- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
29+ - name : Get libModSecurity source
30+ uses : actions/checkout@v4
31+ with :
32+ repository : owasp-modsecurity/ModSecurity
33+ path : ModSecurity
34+ submodules : true
35+ fetch-depth : 1
36+ - name : Build libModSecurity
37+ working-directory : ModSecurity
3238 run : |
33- gh release download -p "*.tar.gz" -R owasp-modsecurity/ModSecurity -O - | tar -xzf -
34- cd modsecurity-*
39+ ./build.sh
3540 ./configure --without-lmdb --prefix=/usr
3641 make -j $(nproc)
3742 sudo make install
@@ -45,13 +50,26 @@ jobs:
4550 repository : nginx/nginx
4651 path : nginx
4752 fetch-depth : 1
53+ - name : Get Nginx tests
54+ uses : actions/checkout@v4
55+ with :
56+ repository : nginx/nginx-tests
57+ path : nginx/test
58+ fetch-depth : 1
59+ - name : Copy ModSecurity-nginx tests to nginx/test
60+ run : |
61+ cp ModSecurity-nginx/tests/* nginx/test
4862 - name : Build nginx with ModSecurity-nginx module
4963 working-directory : nginx
5064 run : |
51- ./auto/configure --with-ld-opt="-Wl,-rpath,/usr/local/lib" --without-pcre2 --add-module=../ModSecurity-nginx
65+ ./auto/configure --with-ld-opt="-Wl,-rpath,/usr/local/lib" --without-pcre2 --with-http_v2_module --with-http_auth_request_module -- add-module=../ModSecurity-nginx
5266 make
5367 make modules
5468 sudo make install
69+ - name : Run ModSecurity-nginx tests
70+ working-directory : nginx/test
71+ run : |
72+ TEST_NGINX_BINARY=../objs/nginx prove modsecurity*.t
5573 - name : Start Nginx
5674 run : |
5775 sudo /usr/local/nginx/sbin/nginx -c /home/runner/work/ModSecurity-nginx/ModSecurity-nginx/ModSecurity-nginx/.github/nginx/nginx.conf
@@ -91,3 +109,111 @@ jobs:
91109 echo "FAIL"
92110 exit 1
93111 fi
112+
113+ build-windows :
114+ runs-on : windows-2022
115+ defaults :
116+ run :
117+ shell : msys2 {0}
118+ steps :
119+ - name : Set up MSVC
120+ uses : ilammy/msvc-dev-cmd@v1
121+ - name : Set up msys
122+ uses : msys2/setup-msys2@v2
123+ with :
124+ msystem : UCRT64
125+ path-type : inherit
126+ - name : Get Nginx source
127+ uses : actions/checkout@v4
128+ with :
129+ repository : nginx/nginx
130+ path : nginx
131+ fetch-depth : 1
132+ - name : Get Nginx tests
133+ uses : actions/checkout@v4
134+ with :
135+ repository : nginx/nginx-tests
136+ path : nginx/test
137+ fetch-depth : 1
138+ - name : Set up third-party libraries
139+ working-directory : nginx
140+ run : |
141+ mkdir objs
142+ mkdir objs/lib
143+ cd objs/lib
144+ wget -q -O - https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.39/pcre2-10.39.tar.gz | tar -xzf -
145+ wget -q -O - https://www.zlib.net/fossils/zlib-1.3.tar.gz | tar -xzf -
146+ wget -q -O - https://www.openssl.org/source/openssl-3.0.13.tar.gz | tar -xzf -
147+ - name : Get libModSecurity source
148+ uses : actions/checkout@v4
149+ with :
150+ repository : owasp-modsecurity/ModSecurity
151+ submodules : true
152+ path : nginx/objs/lib/ModSecurity
153+ fetch-depth : 1
154+ - name : Setup Conan
155+ shell : cmd
156+ run : |
157+ pip3 install conan --upgrade
158+ conan profile detect
159+ - name : Build libModSecurity
160+ working-directory : nginx/objs/lib/ModSecurity
161+ shell : cmd
162+ run : |
163+ vcbuild.bat
164+ - name : Get ModSecurity-nginx source code
165+ uses : actions/checkout@v4
166+ with :
167+ path : nginx/objs/lib/ModSecurity-nginx
168+ - name : Copy ModSecurity-nginx tests to nginx/test
169+ working-directory : nginx/test
170+ run : |
171+ cp ../objs/lib/ModSecurity-nginx/tests/* .
172+ - name : Remove /usr/bin/link conflicting with MSVC link.exe
173+ run : |
174+ set -ex
175+ which link
176+ rm /usr/bin/link
177+ - name : Build nginx w/ModSecurity-nginx module
178+ working-directory : nginx
179+ run : |
180+ : # Windows native version of Perl is required by nginx build
181+ export PATH=/c/Strawberry/perl/bin:$PATH
182+ : # Set env variables to point to libModSecurity v3 include & lib directories
183+ export MODSECURITY_INC=objs/lib/ModSecurity/headers
184+ export MODSECURITY_LIB=objs/lib/ModSecurity/build/win32/build/Release
185+ : # Copy libModSecurity.dll to objs dir (to be able to run nginx later)
186+ cp $MODSECURITY_LIB/libModSecurity.dll objs
187+ : # Configure nginx build w/ModSecurity-nginx module
188+ auto/configure \
189+ --with-cc=cl \
190+ --with-debug \
191+ --prefix= \
192+ --conf-path=conf/nginx.conf \
193+ --pid-path=logs/nginx.pid \
194+ --http-log-path=logs/access.log \
195+ --error-log-path=logs/error.log \
196+ --sbin-path=nginx.exe \
197+ --http-client-body-temp-path=temp/client_body_temp \
198+ --http-proxy-temp-path=temp/proxy_temp \
199+ --http-fastcgi-temp-path=temp/fastcgi_temp \
200+ --http-scgi-temp-path=temp/scgi_temp \
201+ --http-uwsgi-temp-path=temp/uwsgi_temp \
202+ --with-cc-opt=-DFD_SETSIZE=1024 \
203+ --with-pcre=objs/lib/pcre2-10.39 \
204+ --with-zlib=objs/lib/zlib-1.3 \
205+ --with-openssl=objs/lib/openssl-3.0.13 \
206+ --with-openssl-opt=no-asm \
207+ --with-http_ssl_module \
208+ --with-http_v2_module \
209+ --with-http_auth_request_module \
210+ --add-module=objs/lib/ModSecurity-nginx
211+ nmake
212+ - name : Run ModSecurity-nginx tests
213+ working-directory : nginx/test
214+ shell : cmd # tests need to run on a "windows" shell
215+ run : |
216+ md temp
217+ set TEMP=temp
218+ set TEST_NGINX_BINARY=..\objs\nginx.exe
219+ prove modsecurity*.t
0 commit comments