Skip to content

Apply Cloudflare Security Settings #35

Apply Cloudflare Security Settings

Apply Cloudflare Security Settings #35

name: Apply Cloudflare Security Settings
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Runs every day at midnight UTC
jobs:
apply-security-settings:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python environment
run: |
sudo apt-get update
sudo apt-get install -y python3 python3-pip
pip3 install cloudflare==2.19.*
- name: Run Cloudflare Security Settings Script
run: |
python3 scripts/apply_cloudflare_security.py
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_ZONE_ID: ${{ vars.CLOUDFLARE_ZONE_ID }}
DOMAIN: ${{ vars.DOMAIN }}
DNS_RECORD_TYPE: ${{ vars.DNS_RECORD_TYPE }}
DNS_RECORD_VALUE: ${{ vars.DNS_RECORD_VALUE }}
ENABLE_HTTP3: ${{ vars.ENABLE_HTTP3 }}
ENABLE_HSTS: ${{ vars.ENABLE_HSTS }}
HSTS_MAX_AGE: ${{ vars.HSTS_MAX_AGE }}
TLS_MIN_VERSION: ${{ vars.TLS_MIN_VERSION }}
SECURE_CIPHERS: ${{ vars.SECURE_CIPHERS }} # Make optional
ENABLE_DDOS_PROTECTION: ${{ vars.ENABLE_DDOS_PROTECTION }}
ENABLE_WAF: ${{ vars.ENABLE_WAF }}
ENABLE_DNSSEC: ${{ vars.ENABLE_DNSSEC }}
ENABLE_HTTPS_REWRITES: ${{ vars.ENABLE_HTTPS_REWRITES }}
GEO_BLOCKING_ENABLED: ${{ vars.GEO_BLOCKING_ENABLED }}
GEO_BLOCKING_COUNTRIES: ${{ vars.GEO_BLOCKING_COUNTRIES }}
FIREWALL_RULES: ${{ vars.FIREWALL_RULES }} # Make optional
CUSTOM_HEADER_ENABLED: ${{ vars.CUSTOM_HEADER_ENABLED }}
CUSTOM_HEADER_KEY: ${{ vars.CUSTOM_HEADER_KEY }}
CUSTOM_HEADER_VALUE: ${{ vars.CUSTOM_HEADER_VALUE }}