
Proxy Manager
Overview
In the event of an issue with proxy services on Cloudflare a useful script to have (as long as the Cloudflare API is still responsive and DNS is still resolving) is one that can disable the proxy for hostnames that are currently orange clouded (proxy enabled).
There are security risks that this poses such as:
- WAF inspection is not longer enabled
- HTTP DDoS protection is no longer enabled
- SSL certificates hosted at the Edge are no longer available which means the underlying origins must be configured with public CA certs
- Origin obfuscation is no longer occurring so origin IPs can be discovered through a simple dig command
If these risks are acceptable and understood it can be extremely useful to quickly disable the proxy so that services remain online (albeit exposed more than normal).
What It Does
The Python script allows you to: <-----Github Repo Link
- Scan all zones and disable proxies for all hostnames
- Save the original proxy state
- Restore proxies to their original state
- Support multiple Cloudflare accounts
- Generate detailed logs and reports
- Perform dry runs before making changes
Prerequisites
- Python 3.7+
- Cloudflare API tokens with appropriate permissions
- Required Python packages (install via
pip install -r requirements.txt)
Running in Python Virtual Environment
Code: # 1. Navigate to the project directory
cd cloudflare-proxy-manager
# 2. Create a virtual environment
python3 -m venv venv
# 3. Activate the virtual environment
source venv/bin/activate
# 4. Install dependencies
pip install -r requirements.txt
# 5. Create your .env file with Cloudflare credentials
cp .env.example .env
# Edit .env with your actual API tokens and account IDs
# 6. Verify your configuration
python cloudflare_proxy_manager.py verify
# 7. Run commands (examples)
# Preview changes
python cloudflare_proxy_manager.py disable --dry-run
# Disable proxies
python cloudflare_proxy_manager.py disable
# Restore proxies
python cloudflare_proxy_manager.py restore
# Check status
python cloudflare_proxy_manager.py status
# 8. Deactivate when done
deactivateExamples
Disable Proxy Dry-Run showing what would get disabled:

Disable Proxy (for real this time)


Restore Proxy

Status Option

Disable with Comments (Dashboard View)

Leave a Comment
Your comment will be reviewed before appearing on the site.
Comments
Be the first to comment on this post!