mirror of
https://github.com/fabriziosalmi/patterns.git
synced 2025-12-18 02:05:42 +00:00
Update nginx.yml
This commit is contained in:
parent
55789b7c5e
commit
a9dd3e7a8d
35
.github/workflows/nginx.yml
vendored
35
.github/workflows/nginx.yml
vendored
@ -48,23 +48,32 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- name: Merge WAF rules into a single file
|
||||||
|
run: |
|
||||||
|
# Merge all WAF rules into a single file
|
||||||
|
cat waf_rules/waf_patterns/nginx/*.conf > merged_waf_rules.conf
|
||||||
|
echo "Merged WAF rules into merged_waf_rules.conf"
|
||||||
|
echo "Contents of merged_waf_rules.conf:"
|
||||||
|
cat merged_waf_rules.conf
|
||||||
|
|
||||||
- name: Combine Nginx configuration
|
- name: Combine Nginx configuration
|
||||||
run: |
|
run: |
|
||||||
# Create a temporary file to hold the WAF rules
|
# Create a temporary nginx.conf file that includes the merged WAF rules
|
||||||
echo "http {" > temp_http_block.conf
|
echo "events {" > temp_nginx.conf
|
||||||
echo " include /etc/nginx/waf_rules/*.conf;" >> temp_http_block.conf
|
echo " worker_connections 1024;" >> temp_nginx.conf
|
||||||
echo "}" >> temp_http_block.conf
|
echo "}" >> temp_nginx.conf
|
||||||
|
echo "http {" >> temp_nginx.conf
|
||||||
|
echo " include /etc/nginx/merged_waf_rules.conf;" >> temp_nginx.conf
|
||||||
|
echo " include /etc/nginx/tests/nginx.conf;" >> temp_nginx.conf
|
||||||
|
echo "}" >> temp_nginx.conf
|
||||||
|
|
||||||
# Combine nginx.conf with the WAF rules
|
|
||||||
cat tests/nginx.conf waf_rules/waf_patterns/nginx/*.conf > combined_nginx.conf
|
|
||||||
echo "Combined Nginx configuration:"
|
echo "Combined Nginx configuration:"
|
||||||
cat combined_nginx.conf
|
cat temp_nginx.conf
|
||||||
|
|
||||||
- name: Debug combined_nginx.conf
|
|
||||||
run: |
|
|
||||||
echo "Contents of combined_nginx.conf:"
|
|
||||||
cat combined_nginx.conf
|
|
||||||
|
|
||||||
- name: Validate Nginx configuration using Docker
|
- name: Validate Nginx configuration using Docker
|
||||||
run: |
|
run: |
|
||||||
docker run --rm -v $(pwd)/combined_nginx.conf:/etc/nginx/nginx.conf:ro nginx nginx -t
|
# Copy the merged WAF rules and nginx.conf to a Docker volume
|
||||||
|
docker run --rm -v $(pwd)/merged_waf_rules.conf:/etc/nginx/merged_waf_rules.conf:ro \
|
||||||
|
-v $(pwd)/tests/nginx.conf:/etc/nginx/tests/nginx.conf:ro \
|
||||||
|
-v $(pwd)/temp_nginx.conf:/etc/nginx/nginx.conf:ro \
|
||||||
|
nginx nginx -t
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user