If you prefer clean CLI syntax instead of writing raw curl commands, you can use flarectl, a CLI wrapper built by Cloudflare.
If you have Go installed:
go install github.com/cloudflare/cloudflare-go/cmd/flarectl@latestSet your environment variables in your terminal profile (~/.bashrc or ~/.zshrc):
export CF_API_TOKEN="YOUR_API_TOKEN"
export CF_ZONE_NAME="yourdomain.com"flarectl firewall create --zone="yourdomain.com" --mode="whitelist" --value="192.0.2.1" --notes="Whitelisted via CLI"flarectl firewall create --zone="yourdomain.com" --mode="block" --value="198.51.100.4" --notes="Malicious IP"
flarectl firewall list --zone="yourdomain.com"
If you want to automatically allow your current public IP whenever it changes (like a Dynamic DNS script), save this quick bash script to run as a cron job: