CloudFlare Dynamic DNS Updater
A simple command to keep a cloudflare's zone record updated with your local ip
address so you can use it instead of dyndns.org or similar services., (*1)
Installation
Install it globally with composer:, (*2)
$ composer global require flatline/cfddns:dev-master
Or clone the repo and use ./bin/cfddns
., (*3)
Usage
First you'll need to create a config file using the init
command and then use
the update
command to update CloudFlare's record., (*4)
For the update, you can set up a cron so it's done automatically. I have it run
every 15 minutes, I think it's more than enough. But the CloudFlare's API rate
limit is 1200 requests every 5 minutes, so, theoretically, you could run it
faster if you need to., (*5)
The init
command
$ cfddns init
The command will ask you for all the needed data and save the config file to
your home: ~/cfddns.yml
., (*6)
If you want to create it manually, there's a sample config file in the repo
root you can use., (*7)
The update
command
To update your CloudFlare record, run the update command:, (*8)
$ cfddns update
This will automatically grab your public ip and update the CloudFlare's record
with it., (*9)
The command calls the rec_edit
action on the CloudFlare API. The config sets some of the parameters for this command,
so check the docs if you need more details., (*10)
To do
This are some improvements for the future:, (*11)
-
Logging (with monolog)
This way it can be run in quiet mode and still be able to log errors (useful
when runing from a cron), (*12)
-
Automatically add record to a zone if the record does not exist, (*13)