Update nginx.yml

This commit is contained in:
fab 2025-01-07 18:47:00 +01:00 committed by GitHub
parent e2c6b5dd6c
commit 96c634addc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,36 +14,88 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
# Step 1: Checkout repository
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
# Step 2: Install essential tools (bash, sudo, etc.)
- name: Install essential tools
run: |
sudo apt-get update
sudo apt-get install -y bash sudo python3-pip
# Step 3: Set up Python
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: '3.9' python-version: '3.9'
- name: Install dependencies # Step 4: 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 pip install -r patterns/requirements.txt
# Step 5: Validate Python dependencies
- name: Validate Python dependencies
run: |
pip check
echo "Python dependencies validated successfully."
# Step 6: Run OWASP scraper
- name: Run OWASP scraper - name: Run OWASP scraper
run: python owasp.py run: python owasp.py
working-directory: ./patterns # Change to the correct directory working-directory: patterns
continue-on-error: false # Fail the workflow if this step fails
# Step 7: Validate OWASP scraper output
- name: Validate OWASP scraper output
run: |
if [ -f "patterns/waf_patterns/nginx/*.conf" ]; then
echo "OWASP scraper output validated successfully."
else
echo "Error: No Nginx configuration files found."
exit 1
fi
working-directory: patterns
# Step 8: Convert OWASP rules to Nginx config
- name: Convert OWASP rules to Nginx config - name: Convert OWASP rules to Nginx config
run: python owasp2nginx.py run: python owasp2nginx.py
working-directory: ./patterns # Change to the correct directory working-directory: patterns
continue-on-error: false # Fail the workflow if this step fails
# Step 9: Validate Nginx config files
- name: Validate Nginx config files
run: |
if [ -f "patterns/waf_patterns/nginx/*.conf" ]; then
echo "Nginx configuration files validated successfully."
else
echo "Error: No Nginx configuration files found."
exit 1
fi
working-directory: patterns
# Step 10: 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
- name: Validate Nginx installation
run: |
nginx -v
echo "Nginx installed successfully."
# Step 12: Import Nginx config
- name: Import Nginx config - name: Import Nginx config
run: python import2nginx.py run: python import2nginx.py
working-directory: ./patterns # Change to the correct directory working-directory: patterns
continue-on-error: false # Fail the workflow if this step fails
# Step 13: Validate Nginx configuration
- name: Validate Nginx configuration - name: Validate Nginx configuration
run: | run: |
nginx -t -c /etc/nginx/nginx.conf sudo nginx -t -c /etc/nginx/nginx.conf
echo "Nginx configuration validated successfully."