Update nginx.yml

This commit is contained in:
fab 2025-01-07 18:58:41 +01:00 committed by GitHub
parent 6e5ff5b02c
commit 565b0c59a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -34,7 +34,7 @@ jobs:
- name: Install Python dependencies - name: Install Python dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r requirements.txt # <-- Correct path to requirements.txt pip install -r requirements.txt
# Step 5: Validate Python dependencies # Step 5: Validate Python dependencies
- name: Validate Python dependencies - name: Validate Python dependencies
@ -42,29 +42,60 @@ jobs:
pip check pip check
echo "Python dependencies validated successfully." echo "Python dependencies validated successfully."
# Step 10: Install Nginx # Step 6: Run OWASP scraper
- name: Run OWASP scraper
run: python owasp.py
# Step 7: Validate OWASP scraper output
- name: Validate OWASP scraper output
run: |
if [ -f "waf_patterns/nginx/*.conf" ]; then
echo "OWASP scraper output validated successfully."
else
echo "Error: No Nginx configuration files found."
exit 1
fi
# Step 8: Convert OWASP rules to Nginx config
- name: Convert OWASP rules to Nginx config
run: python owasp2nginx.py
# Step 9: Copy WAF files to /tmp
- name: Copy WAF files to /tmp
run: |
mkdir -p /tmp/waf_patterns/nginx
cp -r waf_patterns/nginx/*.conf /tmp/waf_patterns/nginx/
echo "WAF files copied to /tmp."
# Step 10: Validate Nginx config files
- name: Validate Nginx config files
run: |
if [ -f "/tmp/waf_patterns/nginx/*.conf" ]; then
echo "Nginx configuration files validated successfully."
else
echo "Error: No Nginx configuration files found in /tmp."
exit 1
fi
# Step 11: Install Nginx
- name: Install Nginx - name: Install Nginx
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y nginx sudo apt-get install -y nginx
# Step 11: Validate Nginx installation # Step 12: Validate Nginx installation
- name: Validate Nginx installation - name: Validate Nginx installation
run: | run: |
nginx -v nginx -v
echo "Nginx installed successfully." echo "Nginx installed successfully."
# Create WAF dir # Step 13: Import Nginx config
- name: Create waf directory
run: |
mkdir -p /etc/nginx/waf
chmod nginx:nginx /etc/nginx/waf
# Step 12: Import Nginx config
- name: Import Nginx config - name: Import Nginx config
run: python import_nginx_waf.py # <-- Correct script name run: |
export WAF_DIR="/tmp/waf_patterns/nginx"
python import_nginx_waf.py
# Step 13: Validate Nginx configuration # Step 14: Validate Nginx configuration
- name: Validate Nginx configuration - name: Validate Nginx configuration
run: | run: |
sudo nginx -t -c /etc/nginx/nginx.conf sudo nginx -t -c /etc/nginx/nginx.conf