Skip to content

Commit 486a57b

Browse files
Add files via upload
1 parent 1f7efa9 commit 486a57b

1 file changed

Lines changed: 177 additions & 0 deletions

File tree

.github/workflows/ci_v2_master.yml

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
name: Quality Assurance
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build-linux:
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
matrix:
12+
os: [ubuntu-24.04]
13+
platform: [x32, x64]
14+
compiler: [gcc, clang]
15+
configure:
16+
- {label: "with pcre2, no study, no jit", opt: "--enable-pcre-study=no" }
17+
- {label: "with pcre2, with study, no jit", opt: "--enable-pcre-study=yes" }
18+
- {label: "with pcre2, no study, with jit", opt: "--enable-pcre-study=no --enable-pcre-jit" }
19+
- {label: "with pcre2, with study, with jit", opt: "--enable-pcre-study=yes --enable-pcre-jit" }
20+
- {label: "with pcre", opt: "--with-pcre --enable-pcre-study=no" }
21+
- {label: "with pcre, with study, no jit", opt: "--with-pcre --enable-pcre-study=yes" }
22+
- {label: "with pcre, no study, with jit", opt: "--with-pcre --enable-pcre-study=no --enable-pcre-jit" }
23+
- {label: "with pcre, with study, with jit", opt: "--with-pcre --enable-pcre-study=yes --enable-pcre-jit" }
24+
- {label: "with lua", opt: "--with-lua" }
25+
- {label: "wo lua", opt: "--without-lua" }
26+
steps:
27+
- name: Setup Dependencies
28+
run: |
29+
sudo apt-get update -y -qq
30+
sudo apt-get install -y apache2-dev libxml2-dev liblua5.1-0-dev libcurl4-gnutls-dev libpcre2-dev libpcre3-dev libpcre3 pkg-config libyajl-dev apache2 apache2-bin apache2-data
31+
- uses: actions/checkout@v2
32+
- name: autogen.sh
33+
run: ./autogen.sh
34+
- name: configure ${{ matrix.configure.label }}
35+
run: ./configure --enable-assertions ${{ matrix.configure.opt }} 'CFLAGS=-Werror=format-security'
36+
- uses: ammaraskar/gcc-problem-matcher@master
37+
- name: make
38+
run: make -j `nproc`
39+
- name: install module
40+
run: sudo make install
41+
- name: prepare config
42+
run: |
43+
sudo cp .github/security2.conf /etc/apache2/mods-enabled/
44+
sudo cp modsecurity.conf-recommended /etc/apache2/modsecurity.conf
45+
sudo cp unicode.mapping /etc/apache2/
46+
sudo mkdir -p /var/cache/modsecurity
47+
sudo chown -R www-data:www-data /var/cache/modsecurity
48+
- name: first check config (to get syntax errors)
49+
run: sudo apachectl configtest
50+
- name: start apache with module
51+
run: sudo systemctl restart apache2.service
52+
- name: Search for errors/warnings in error log
53+
run: |
54+
# '|| :' handles the case grep doesn't match, otherwise the script exits with 1 (error)
55+
errors=$(grep -E ':(?error|warn)[]]' /var/log/apache2/error.log) || :
56+
if [[ -z "${errors}" ]]; then exit 0; fi
57+
echo "::error:: Found errors/warnings in error.log"
58+
echo "${errors}"
59+
exit 1
60+
- name: Check error.log
61+
run: |
62+
# Send requests & check log format
63+
# Valid request
64+
curl -s http://127.0.01/ > /dev/null || echo $?
65+
# Invalid request
66+
curl -s http://127.0.01/%2e%2f > /dev/null || echo $?
67+
# Check log format
68+
grep -F ModSecurity < /var/log/apache2/error.log | grep -vP "^\[[^\]]+\] \[security2:[a-z]+\] \[pid [0-9]+:tid [0-9]+\] (?:\[client [0-9.:]+\] )?ModSecurity" || exit 0
69+
# grep -v succeeded => found some lines with invalid format
70+
exit 1
71+
- name: Show httpd error log
72+
if: always()
73+
run: sudo cat /var/log/apache2/error.log
74+
- name: Show mod_security2 audit log
75+
if: always()
76+
run: sudo cat /var/log/apache2/modsec_audit.log
77+
78+
test-linux:
79+
runs-on: ${{ matrix.os }}
80+
strategy:
81+
matrix:
82+
os: [ubuntu-24.04]
83+
platform: [x32, x64]
84+
compiler: [gcc, clang]
85+
configure:
86+
- {label: "with pcre2, no study, no jit", opt: "--enable-pcre-study=no" }
87+
- {label: "with pcre2, with study, no jit", opt: "--enable-pcre-study=yes" }
88+
- {label: "with pcre2, no study, with jit", opt: "--enable-pcre-study=no --enable-pcre-jit" }
89+
- {label: "with pcre2, with study, with jit", opt: "--enable-pcre-study=yes --enable-pcre-jit" }
90+
- {label: "with pcre", opt: "--with-pcre --enable-pcre-study=no" }
91+
- {label: "with pcre, with study, no jit", opt: "--with-pcre --enable-pcre-study=yes" }
92+
- {label: "with pcre, no study, with jit", opt: "--with-pcre --enable-pcre-study=no --enable-pcre-jit" }
93+
- {label: "with pcre, with study, with jit", opt: "--with-pcre --enable-pcre-study=yes --enable-pcre-jit" }
94+
- {label: "with lua", opt: "--with-lua" }
95+
- {label: "wo lua", opt: "--without-lua" }
96+
steps:
97+
- name: Setup Dependencies
98+
run: |
99+
sudo apt-get update -y -qq
100+
sudo apt-get install -y --no-install-recommends apache2-dev libxml2-dev liblua5.1-0-dev libcurl4-gnutls-dev libpcre2-dev libpcre3-dev libpcre3 pkg-config libyajl-dev apache2 apache2-bin apache2-data
101+
- uses: actions/checkout@v2
102+
- name: autogen.sh
103+
run: ./autogen.sh
104+
- name: configure ${{ matrix.configure.label }}
105+
run: ./configure ${{ matrix.configure.opt }} 'CFLAGS=-Werror=format-security'
106+
- uses: ammaraskar/gcc-problem-matcher@master
107+
- name: make
108+
run: make -j `nproc`
109+
- name: install module
110+
run: sudo make install
111+
- name: run tests
112+
run: make test
113+
114+
test-regression-linux:
115+
runs-on: ${{ matrix.os }}
116+
strategy:
117+
matrix:
118+
os: [ubuntu-24.04]
119+
platform: [x64]
120+
compiler: [gcc]
121+
configure:
122+
- {label: "with pcre2, with study, with jit", opt: "--enable-pcre-study=yes --enable-pcre-jit" }
123+
steps:
124+
- name: Setup Dependencies
125+
run: |
126+
sudo apt-get update -y -qq
127+
sudo apt-get install -y --no-install-recommends apache2-dev libxml2-dev liblua5.1-0-dev libcurl4-gnutls-dev libpcre2-dev libpcre3-dev libpcre3 pkg-config libyajl-dev apache2 apache2-bin apache2-data perl libwww-perl ssdeep libfuzzy-dev libfuzzy2
128+
- uses: actions/checkout@v2
129+
- name: autogen.sh
130+
run: ./autogen.sh
131+
- name: configure ${{ matrix.configure.label }}
132+
run: ./configure ${{ matrix.configure.opt }} 'CFLAGS=-Werror=format-security'
133+
- uses: ammaraskar/gcc-problem-matcher@0f9c86f9e693db67dacf53986e1674de5f2e5f28 #v0.3.0
134+
- name: make
135+
run: make -j `nproc`
136+
- name: install module
137+
run: sudo make install
138+
- name: run regression tests
139+
run: make test-regression
140+
141+
cppcheck:
142+
runs-on: [ubuntu-24.04]
143+
container:
144+
image: debian:sid
145+
steps:
146+
- name: Setup Dependencies
147+
run: |
148+
apt-get update -y -qq
149+
apt-get install -y --no-install-recommends build-essential \
150+
autoconf \
151+
automake \
152+
libtool \
153+
pkg-config \
154+
cppcheck \
155+
apache2-dev \
156+
libpcre2-dev \
157+
libapr1-dev \
158+
libaprutil1-dev \
159+
libxml2-dev \
160+
liblua5.3-dev \
161+
libyajl-dev \
162+
libfuzzy-dev \
163+
ssdeep \
164+
curl \
165+
ca-certificates
166+
- uses: actions/checkout@v4
167+
with:
168+
submodules: false
169+
fetch-depth: 0
170+
- name: configure
171+
run: |
172+
./autogen.sh
173+
./configure --with-apxs=/usr/bin/apxs
174+
- name: cppcheck
175+
run: |
176+
make check-static
177+

0 commit comments

Comments
 (0)