Collection of helper scripts to manage Cloudflare services
Each service contains an example
secrets.txt.example
file that needs to be renamed tosecrets.txt
and filled out
Update the local IP address for the zeroTrust gateway DNS locations based on assigned dynamic public address.
This was developed to accomplish the continued protection of the DNS filtering rules with cloudflare after an ISP forced public address change. This continues the protection provided through cloudflare zeroTrust.
- Linux/Unix (tested on Ubuntu 22.04)
- Cloudflare account, with zeroTrust DNS filtering setup and functional. (DNS filtering out of scope here, see cloudflare docs)
jq
installed on the local systemsudo apt install jq
- API key that allows
Account|Zero Trust|Edit
permissions for the account - Cloudflare account ID (Found in the url while logged in, or under any website overview, "Account ID")
Enter your info in the secrets file, ensure the values are "quoted".
Give the zeroTrust_gateway_ip_update.sh
the old execute permissions massage. From the repo root folder:
chmod +x ./ZeroTrust/zeroTrust_gateway_ip_update.sh
If everything is done, test the script. It should find the gateway DNS location and update it with the current IP address of the device the script is ran on.
Add the script to the crontab folder with the following (edit for your location). This runs every 10 min.
*/10 * * * * /home/$USER/cloudflare_helpers/ZeroTrust/zeroTrust_gateway_ip_update.sh
Note This script updates every thime it runs to pickup any changes here in this repo.
Update the IP address for the a cloudflare sub domain.
This was heavily re-used from this gist, thanks for the great work!
- Linux/Unix (tested on Ubuntu 22.04)
- Cloudflare account, with a domain DNS hosted with cloudflare
- Subdomain entry for record to update
jq
installed on the local systemsudo apt install jq
- API key that allows
ZOND|EDIT|zone_to_edit
permissions for the domain to editAPI_TOKEN
- Cloudflare user email associated to the key
EMAIL
- Domain name for record to edit
DOMAIN.TLD
- FQDN for the record
HOST.DOMAIN.TLD
Enter your info in the secrets file, ensure the values are "quoted".
Give the cloudflare_dns_update.sh
the old execute permissions massage. From the repo root folder:
chmod +x ./DNS/cloudflare_dns_update.sh
If everything is done, test the script. It should find the gateway DNS location and update it with the current IP address of the device the script is ran on.
Add the script to the crontab folder with the following (edit for your location). This runs every 10 min.
*/10 * * * * /home/$USER/cloudflare_helpers/DNS/cloudflare_dns_update.sh