Skip to content

totaldebug/CfDnsSync

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

A script for dynamically updating Cloudflare DNS records.

GitHub last commit GitHub issues GitHub pull requests

AboutConfigurationFeaturesContributingAuthorSupportDonateCreditsLicense


About

cloudflare-ddns is a high-quality app that is capable of updating DNS Records

It comes in extremely useful if you have a dynamic IP Address and you are hosting servers behind it, its an easy way to make it pseydo-static.

This is an updated version of adrienbrignon's cloudflare-ddns.

Configuration

Dependencies

Install Python Packages

poetry install --no-dev

Usage

First, a few assumptions:

  • You are using CloudFlare to host the DNS for a domain you own.
  • You have one or more A/AAAA records in Cloudflare you intend to dynamically update.
  1. To use this utility, create a copy of the example.com.yml file inside the zones folder.
  2. Rename the file to your domain zone name.
  3. To do a one-off update of your DNS record, simply run:
python cloudflare-ddns.py -z example.com

The script will determine your public IP address and automatically update the records along with it and the settings you provided.

If the program encounters an issue while attempting to update Cloudflare's records, you can check the the logs folder for more informations.

Because dynamic IPs can change regularly, it's recommended that you run this utility periodically in the background to keep your records up-to-date.

Just add a line to your crontab and let cron run it for you at a regular interval.

# Every 30 minutes, update my Cloudflare records.
*/30 * * * * python /path/to/cloudflare-ddns.py -z example.com

This example will update your records every 30 minutes. You'll want to be sure that you insert the correct paths to reflect where the codebase is located.

If you want to learn more about the Cloudflare API, you can read on here.

YAML Configuration

If you want to restrict the token access to only be allowed to update a specific zone then set the cf_zone: option.

This option being set means a list of the zones is not required.

Features

🔰
Smart update (records only updated if needed) ✔️
Lightweight ✔️
Built-in Logging ✔️
Proxy Mode ✔️
IPv4 Suport (A Records) ✔️
IPv6 Support (AAAA Records) ✔️
HTTP or Dig to gain IP Address ✔️
One config file ✔️

Contributing

Got something interesting you'd like to share? Learn about contributing.

Author

TotalDebug
marksie1988 (Steven Marks)

Support

Reach out to me at one of the following places:

  • via Discord
  • Raise an issue in GitHub

Donate

Credits

  • Cloudflare for having an API and otherwise generally being cool.
  • icanhazip.com for making grabbing your public IP from a script super easy.
  • thatjpk for the initial releases of this project.

License

License: CC BY-NC-SA 4.0