feat: added Github CI workflow #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Quality Assurance | |
on: | |
push: | |
pull_request: | |
jobs: | |
build-linux: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04] | |
platform: [x32, x64] | |
compiler: [gcc, clang] | |
steps: | |
- name: Setup Dependencies | |
run: | | |
sudo apt-get update -y -qq | |
sudo apt-get install -y gcc g++ make autoconf automake make libyajl-dev libxml2-dev libmaxminddb-dev libpcre2-dev libpcre2-8-0 libpcre2-16-0 libpcre2-32-0 libcurl4-gnutls-dev jq wget | |
- name: Install ModSecurity library | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
modsecver=`gh release view -R owasp-modsecurity/ModSecurity -q .tagName --json tagName` | |
gh release download -p "*.tar.gz" -R owasp-modsecurity/ModSecurity $modsecver -O - | tar -xzf - | |
tar -xzf modsecurity.tar.gz | |
cd modsecurity-$modsecver | |
./configure --disable-lmdb --prefix=/usr | |
make -j `nproc` | |
sudo make install | |
cd | |
- uses: actions/checkout@v2 | |
with: | |
path: ModSecurity-nginx | |
- name: Get Nginx source | |
uses: actions/checkout@v3 | |
with: | |
repository: nginx/nginx | |
path: nginx | |
- name: Build nginx | |
working-directory: nginx | |
run: | | |
./auto/configure --with-ld-opt="-Wl,-rpath,/usr/local/lib" --without-pcre2 --add-module=/home/runner/work/ModSecurity-nginx/ModSecurity-nginx/ModSecurity-nginx | |
make | |
make modules | |
sudo make install | |
- name: Start Nginx | |
run: | | |
sudo /usr/local/nginx/sbin/nginx -c /home/runner/work/ModSecurity-nginx/ModSecurity-nginx/ModSecurity-nginx/.github/nginx/nginx.conf | |
- name: Run attack test vhost 1 | |
run: | | |
resp=`curl -I -X GET -H "Host: modsectest1" http://localhost/?q=attack | head -1 | cut -d$' ' -f2` | |
if [ $resp == "403" ]; then echo "OK"; else echo "FAIL"; exit 1; fi | |
- name: Run non-attack test vhost 1 | |
run: | | |
resp=`curl -I -X GET -H "Host: modsectest1" http://localhost/?q=1 | head -1 | cut -d$' ' -f2` | |
if [ $resp == "200" ]; then echo "OK"; else echo "FAIL"; exit 1; fi | |
- name: Run attack test vhost 2 | |
run: | | |
resp=`curl -I -X GET -H "Host: modsectest2" http://localhost/?q=attack | head -1 | cut -d$' ' -f2` | |
if [ $resp == "403" ]; then echo "OK"; else echo "FAIL"; exit 1; fi | |
- name: Run non-attack test vhost 2 | |
run: | | |
resp=`curl -I -X GET -H "Host: modsectest2" http://localhost/?q=1 | head -1 | cut -d$' ' -f2` | |
if [ $resp == "200" ]; then echo "OK"; else echo "FAIL"; exit 1; fi | |