Update test_docker.yml

This commit is contained in:
fab 2025-01-17 12:04:59 +01:00 committed by GitHub
parent 961d42a11f
commit 0d92cd36c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -155,91 +155,6 @@ jobs:
# echo "Checking HAProxy container logs..." # echo "Checking HAProxy container logs..."
# sudo docker logs haproxy-waf # sudo docker logs haproxy-waf
- name: Validate Traefik configuration
run: |
echo "Validating Traefik configuration..."
for file in waf_patterns/traefik/*.toml; do
echo "Validating $file..."
sudo docker run --rm -v $(pwd)/waf_patterns/traefik:/etc/traefik:ro traefik traefik validate --configFile=/etc/traefik/$(basename "$file")
if [ $? -ne 0 ]; then
echo "Error: Validation failed for $file"
exit 1
fi
done
- name: Start Traefik container with WAF rules
run: |
echo "Starting Traefik container..."
sudo docker run -d \
--name traefik-waf \
-p ${{ env.TRAEFIK_PORT }}:80 \
-v $(pwd)/waf_patterns/traefik:/etc/traefik \
traefik:latest
echo "Traefik is running on port ${{ env.TRAEFIK_PORT }}."
- name: Check Traefik container logs
run: |
echo "Checking Traefik container logs..."
sudo docker logs traefik-waf
- name: Validate services are running
run: |
echo "Validating services are running..."
# Check if Nginx is running
if ! curl -s http://localhost:${{ env.NGINX_PORT }} > /dev/null; then
echo "Error: Nginx is not running!"
sudo docker logs nginx-waf
exit 1
fi
echo "Nginx is running successfully."
# Check if Apache is running
if ! curl -s http://localhost:${{ env.APACHE_PORT }} > /dev/null; then
echo "Error: Apache is not running!"
sudo docker logs apache-waf
exit 1
fi
echo "Apache is running successfully."
# Check if HAProxy is running
if ! curl -s http://localhost:${{ env.HAPROXY_PORT }} > /dev/null; then
echo "Error: HAProxy is not running!"
sudo docker logs haproxy-waf
exit 1
fi
echo "HAProxy is running successfully."
# Check if Traefik is running
if ! curl -s http://localhost:${{ env.TRAEFIK_PORT }} > /dev/null; then
echo "Error: Traefik is not running!"
sudo docker logs traefik-waf
exit 1
fi
echo "Traefik is running successfully."
- name: Test WAF rules
run: |
echo "Testing WAF rules..."
# Test Nginx WAF rules
echo "Testing Nginx rules..."
curl -s http://localhost:${{ env.NGINX_PORT }}/attack
curl -s http://localhost:${{ env.NGINX_PORT }}/bots
# Test Apache WAF rules
echo "Testing Apache rules..."
curl -s http://localhost:${{ env.APACHE_PORT }}/attack
curl -s http://localhost:${{ env.APACHE_PORT }}/bots
# Test HAProxy WAF rules
echo "Testing HAProxy rules..."
curl -s http://localhost:${{ env.HAPROXY_PORT }}/attack
curl -s http://localhost:${{ env.HAPROXY_PORT }}/bots
# Test Traefik WAF rules
echo "Testing Traefik rules..."
curl -s http://localhost:${{ env.TRAEFIK_PORT }}/attack
curl -s http://localhost:${{ env.TRAEFIK_PORT }}/bots
- name: Clean up containers - name: Clean up containers
if: always() if: always()
run: | run: |