Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dcerisano/cloudflare-dynamic-dns
Ditch your third-party DDNS service! Cloudflare DDNS curl scripts that call Cloudflare's API (v4) directly.
https://github.com/dcerisano/cloudflare-dynamic-dns
cloudflare curl ddns dynamic-dns service
Last synced: 3 months ago
JSON representation
Ditch your third-party DDNS service! Cloudflare DDNS curl scripts that call Cloudflare's API (v4) directly.
- Host: GitHub
- URL: https://github.com/dcerisano/cloudflare-dynamic-dns
- Owner: dcerisano
- Created: 2019-06-25T14:56:35.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-02-13T01:52:17.000Z (12 months ago)
- Last Synced: 2024-08-01T12:28:52.919Z (6 months ago)
- Topics: cloudflare, curl, ddns, dynamic-dns, service
- Language: Shell
- Homepage:
- Size: 128 KB
- Stars: 56
- Watchers: 3
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![alt text](https://raw.githubusercontent.com/dcerisano/cloudflare-dynamic-dns/master/img/cloudflare-dns.png)
Cloudflare DDNS curl scripts that call CF-API (v4) ***directly***.
My third-party DDNS service stopped working recently with CF.
It seems CF has moved to a new API (v4).The very good news is you can ditch third-party DDNS and simply run a DDNS shell script as a cron job every minute on your webserver. It calls the new CF API ***directly***.
This is a bare bones script that requires:
* Internet connectivity is available.
* CF API v4 service is available
* api.ipify.org service is availableYou need the Zone ID, Authorization key and A-record ID for your domain.
**Fetch** the first two from your CF account.
**Create** the A-record in CF named "dynamic".
**Create** the CNAME alias (example.com --> dynamic.example.com)
![alt text](https://raw.githubusercontent.com/dcerisano/cloudflare-dynamic-dns/master/img/cf.png)
**Fetch** The A-record ID with [cloudflare-dns-id.sh](https://raw.githubusercontent.com/dcerisano/cloudflare-dynamic-dns/master/cloudflare-dns-id.sh)
**Run** [cloudflare-ddns.sh](https://raw.githubusercontent.com/dcerisano/cloudflare-dynamic-dns/master/cloudflare-ddns.sh) as a cron job `* * * * * /.../cloudflare-ddns.sh`
**Test** by changing your A-record to a bogus IP and then deleting `/tmp/ip-record`
The cron job will change the A-record to your webserver IP address on it's next run.**Marvel** at your own dynamic dns service - no more surrendering your CF Authorization key to a third party DDNS service.
**Note** that the CNAME alias masks your real IP address - a fundamental advantage of CF. Naming the A-record directly as your domain (example.com) would allow anyone to see your real IP address just by `ping example.com`. Try it!
**Note** that you will need to update this script:
* if your CF Zone ID, Authorization key, or A-record ID change. Only you can change these.
* if CF API v4 is deprecated. It is currently new, so should be stable for many years.
* if api.ipify.org is deprecated. There are many others. Or use `dig` if you like.**TO DO**
* Convert curl from linux bash script to other platforms.
* DONE: Windows BAT**DO NOT** commit your Authorization key to GitHub - thar be dragons. Purge any such commits and change your key.
![alt text](https://raw.githubusercontent.com/dcerisano/cloudflare-dynamic-dns/master/img/dragon-key.png)