Dynamic DNS record update utility for CloudFlare DNS service. Python implement
- Linux/macOS (tested with macOS 10.15.1 & Ubuntu 18.04)
- Python 3 ( version >= 3.6 is recommended )
Download code from Release page.
Link here: https://github.com/nhymxu/cf-dns-update-python/releases/latest
Or
clone repo using git:
git clone git@github.com:nhymxu/cf-dns-update-python.git- Go to CloudFlare dash
- Click open any domain you have
- Scroll to bottom, you can see API section from right column.
- Click
Get your API token - Click
Create Token - Enter Token name
- On
Permissionssection. ChooseZone-DNS-Edit - On
Zone resourcesection. ChooseInclude-All zoneor specific zone you want. - Click
Continue to Summary - Copy token display on page
Copy file config.ini.sample to current folder with name config.ini
Add CloudFlare token to first section like this
[common]
CF_API_TOKEN = token_key_here- Look at step 3 on section
Create CloudFlare Token - Copy
Zone ID - Edit like sample
Notes:
@will be same asbase_domain- To proxy a record, include it in both
recordsandproxied_records
I want my script auto running every x minutes. So I need set up cronjob for it.
From server shell, typing:
crontab -eAnd add this line to end of file
*/15 * * * * /opt/cf-dns-update-python/run.sh
This script will run each 15 minutes.
If you want custom what service to get public IP, you can config in config.ini file
Sample
[common]
CHECK_IP_SERVICE = xxxwhere xxx is service name listed below
| Name | Endpoint |
|---|---|
| amazonaws | https://checkip.amazonaws.com |
| ifconfig.me | https://ifconfig.me/ip |
| icanhazip | https://icanhazip.com/ |
| ipecho | https://ipecho.net/plain |