cloudflaredyn
A simple program to dynamically update Cloudflare DNS records
This program will find your external IP, and then synchronize a specified Cloudflare A record to match up with it.
This is essentially DynDNS for Cloudflare. It is similar to CloudFlare-DDNS-Updater, but will work on other systems besides Windows.
Installation
To get a pre-compiled binary for your architecture, just head over to the releases page.
If you would like to compile it yourself:
go get gitlab.com/hackandsla.sh/cloudflaredyn
Usage
-
Create a Cloudflare API token by going to My Profile > API Tokens > Create Token
-
Create a new API token with the following fields:
- Token Name:
cloudflaredyn token
- Permissions:
Zone, DNS, Edit
- Zone Resources:
Include, specific zone, < The zone you want to use >
-
Get the Zone ID by going to the home page for the zone you wish to edit, and copying the Zone ID field
-
Create a configuration file called cloudflaredyn-config.yaml
with the following:
token: < your API key from step 2 >
zone: < your zone from step 3 >
record: < the record you wish to keep updated >
-
Put this configuration file in one of the following places:
/etc/cloudflaredyn
- For system-wide config
~/.config/cloudflaredyn
- For user-level config
-
Run the cloudflaredyn tool
cloudflaredyn
Automated usage
To run the tool on a regular schedule, you can use a cron job like the following to run the tool every 10 minutes:
*/10 * * * * cloudflaredyn
Docker usage
To run the tool with Docker, just run the latest version of the terrabitz/cloudflaredyn
image:
docker run \
-e TOKEN=<API token> \
-e ZONE=<Zone ID> \
-e RECORD=<record to update>\
terrabitz/cloudflaredyn
Help docs
> cloudflaredyn -h
cloudflaredyn is an app to help dynamically update Cloudflare DNS records
Usage:
cloudflaredyn [flags]
Flags:
--config string config file
-d, --dry-run if specified, will not actually update records
-h, --help help for cloudflaredyn
-l, --log-file string if specified, will run verbosely (default "/var/log/cloudflaredyn.log")
-r, --record string The DNS record to update
-t, --token string The Cloudflare token to use to access the API
-v, --verbose if specified, will run verbosely
--version version for cloudflaredyn
-z, --zone string The Cloudflare zone ID that contains the DNS record to update
Trevor Taubitz – @terrabitz
Distributed under the MIT license. See LICENSE
for more information.
https://gitlab.com/terrabitz/