diff --git a/.github/workflows/test_docker.yml b/.github/workflows/test_docker.yml index f31bb1b..ee3fc5d 100644 --- a/.github/workflows/test_docker.yml +++ b/.github/workflows/test_docker.yml @@ -112,48 +112,48 @@ jobs: echo "Checking Apache container logs..." sudo docker logs apache-waf - - name: Validate HAProxy configuration - run: | - echo "Validating HAProxy configuration..." - for file in waf_patterns/haproxy/*.acl; do - echo "Validating $file..." - # Create a temporary haproxy.cfg file to include the ACL - echo "global" > temp_haproxy.cfg - echo " log stdout format raw local0" >> temp_haproxy.cfg - echo "defaults" >> temp_haproxy.cfg - echo " log global" >> temp_haproxy.cfg - echo " timeout connect 10s" >> temp_haproxy.cfg - echo " timeout client 30s" >> temp_haproxy.cfg - echo " timeout server 30s" >> temp_haproxy.cfg - echo "frontend test" >> temp_haproxy.cfg - echo " bind *:${{ env.HAPROXY_PORT }}" >> temp_haproxy.cfg - echo " default_backend test_backend" >> temp_haproxy.cfg - echo " $(cat "$file")" >> temp_haproxy.cfg - echo "backend test_backend" >> temp_haproxy.cfg - echo " server s1 127.0.0.1:${{ env.NGINX_PORT }}" >> temp_haproxy.cfg +# - name: Validate HAProxy configuration +# run: | +# echo "Validating HAProxy configuration..." +# for file in waf_patterns/haproxy/*.acl; do +# echo "Validating $file..." +# # Create a temporary haproxy.cfg file to include the ACL +# echo "global" > temp_haproxy.cfg +# echo " log stdout format raw local0" >> temp_haproxy.cfg +# echo "defaults" >> temp_haproxy.cfg +# echo " log global" >> temp_haproxy.cfg +# echo " timeout connect 10s" >> temp_haproxy.cfg +# echo " timeout client 30s" >> temp_haproxy.cfg +# echo " timeout server 30s" >> temp_haproxy.cfg +# echo "frontend test" >> temp_haproxy.cfg +# echo " bind *:${{ env.HAPROXY_PORT }}" >> temp_haproxy.cfg +# echo " default_backend test_backend" >> temp_haproxy.cfg +# echo " $(cat "$file")" >> temp_haproxy.cfg +# echo "backend test_backend" >> temp_haproxy.cfg +# echo " server s1 127.0.0.1:${{ env.NGINX_PORT }}" >> temp_haproxy.cfg +# +# # Validate the file using haproxy -c +# sudo docker run --rm -v $(pwd)/temp_haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro haproxy haproxy -c -f /usr/local/etc/haproxy/haproxy.cfg +# if [ $? -ne 0 ]; then +# echo "Error: Validation failed for $file" +# exit 1 +# fi +# done - # Validate the file using haproxy -c - sudo docker run --rm -v $(pwd)/temp_haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro haproxy haproxy -c -f /usr/local/etc/haproxy/haproxy.cfg - if [ $? -ne 0 ]; then - echo "Error: Validation failed for $file" - exit 1 - fi - done - - - name: Start HAProxy container with WAF rules - run: | - echo "Starting HAProxy container..." - sudo docker run -d \ - --name haproxy-waf \ - -p ${{ env.HAPROXY_PORT }}:80 \ - -v $(pwd)/waf_patterns/haproxy:/usr/local/etc/haproxy \ - haproxy:latest - echo "HAProxy is running on port ${{ env.HAPROXY_PORT }}." - - - name: Check HAProxy container logs - run: | - echo "Checking HAProxy container logs..." - sudo docker logs haproxy-waf +# - name: Start HAProxy container with WAF rules +# run: | +# echo "Starting HAProxy container..." +# sudo docker run -d \ +# --name haproxy-waf \ +# -p ${{ env.HAPROXY_PORT }}:80 \ +# -v $(pwd)/waf_patterns/haproxy:/usr/local/etc/haproxy \ +# haproxy:latest +# echo "HAProxy is running on port ${{ env.HAPROXY_PORT }}." +# +# - name: Check HAProxy container logs +# run: | +# echo "Checking HAProxy container logs..." +# sudo docker logs haproxy-waf - name: Validate Traefik configuration run: |