A dynamic DNS agent for the CloudFlare API. Handy for home projects, development environments, or as part of a DNS-based HA/failover solution (more to come soon, think Serf). This allows you to use the benefits of CloudFlare (Hosted DNS, Security, Universal SSL, Apps, etc) without the requirement of a single static endpoint or IP.
I plan on working these dependancies in to the DEB package, but for now you'll need:
- Python (tested on 2.7.9)
- requests (available via pip)
- pyyaml (available via pip)
- netifaces (available via pip - may need python-dev package)
Simply installing the DEB package (found in the deb
directory of this repo) as per below will drop everything in to place and add a cron job to run every hour by default, though this can be tweaked in /etc/cron.d/cloudflare-ddns-agent
.
sudo dpkg -i cloudflare-ddns-agent_<version>.deb
- Drop
/etc/cloudflare-ddns-agent/agent.py
in place, found in thedeb/cloudflare-ddns-agent_<version>/etc/cloudflare-ddns-agent
directory of this repo. - Drop in a crontab. The example below runs every hour:
0 * * * * root /etc/cloudflare-ddns-agent/agent.py --config /etc/cloudflare-ddns-agent/config.yaml
If you installed using the DEB package, the config file can be found at /etc/cloudflare-ddns-agent/config.yaml
, please edit it as commented in the file.
vim /etc/cloudflare-ddns-agent/agent.conf
If you installed manually, you should copy the example config file found at /etc/cloudflare-ddns-agent/config.yaml.example
to /etc/cloudflare-ddns-agent/config.yaml
as shown below and edit it as commented in the file.
cp /etc/cloudflare-ddns-agent/config.yaml.example /etc/cloudflare-ddns-agent/config.yaml
vim /etc/cloudflare-ddns-agent/agent.conf
Should you wish to move the config file, you can tweak the --config
argument in the cron job seen above.
By default, the script will log to syslog
. In Debian/Ubuntu-based distributions for example, you can follow the logs as per below.
tail -f /var/log/syslog
As always, I welcome any contributions. Just open a Pull Request.