Generating a Cloudflare API token
- Log in to Cloudflare
- API Tokens section:
Profile/Username picture (top right) --> My Profile --> API Tokens tab - Create a new token
Create Token --> Edit zone DNS -->
Permissions (default): Zone / DNS / edit
Include / Specific zone / select zone
Optional: Client IP Address Filtering (recommended if possible)
TTL: Now --> When you want it to end (2 years perhaps) - Capture the secret DNS API token
cloudflare-dns-update
https://github.com/socketry/cloudflare-dns-update
Use rbenv to install a ruby environment then follow steps like this:
git clone git@github.com:socketry/cloudflare-dns-update.git
cd cloudflare-dns-update
bundle
bin/cloudflare-dns-update
# walk through initial setup wizard
Once done you
- run
cloudflare-dns-update
to trigger initial setup wizard that gets a token and has you select target DNS entry to update. - run
cloudflare-dns-update
again to verify it runs without wizard prompts or errors. - Add
cloudflare-dns-update
to youronboot.sh
script.#!/usr/bin/bash source .bashrc # need to have rbenv and ruby available cloudflare-dns-update # may need to provide full path
- Add
onboot.sh
script to your crontab (crontab -e
):@reboot $HOME/onboot.sh