https://github.com/parthpower/cloudflare-ddns-client
Dynamic DNS Client Implemented for CloudFlare using their API v4
https://github.com/parthpower/cloudflare-ddns-client
bash cloudflare ddns ddns-client ddns-script ddns-updater
Last synced: 11 months ago
JSON representation
Dynamic DNS Client Implemented for CloudFlare using their API v4
- Host: GitHub
- URL: https://github.com/parthpower/cloudflare-ddns-client
- Owner: parthpower
- License: mit
- Created: 2018-06-23T19:13:01.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-08T01:32:00.000Z (almost 7 years ago)
- Last Synced: 2025-02-14T22:19:02.655Z (about 1 year ago)
- Topics: bash, cloudflare, ddns, ddns-client, ddns-script, ddns-updater
- Language: Shell
- Size: 10.7 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CloudFlare Dynamic DNS Client
Bare minimum bash script to use CloudFlare DNS API for Dynamic DNS. To get your domain on CloudFlare DNS for just go to https://cloudflare.com and they will walk you through the process.
## Installation
It uses [jq](https://stedolan.github.io/jq/) for JSON parsing. So you may download it from https://stedolan.github.io/jq/download/ or just copy paste the script in terminal.
### Windows
It works on Git Bash!
````bash
git clone https://github.com/parthpower/CloudFlare-DDNS-Client.git
cd CloudFlare-DDNS-Client
chmod +x cf_ddns.sh
# Install jq for 64 bit Windows
curl https://github.com/stedolan/jq/releases/download/jq-1.5/jq-win64.exe > jq.exe
````
### Linux
```shell
git clone https://github.com/parthpower/CloudFlare-DDNS-Client.git
cd CloudFlare-DDNS-Client
chmod +x cf_ddns.sh
# Install jq for 64 bit Linux
curl https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 > jq
# sudo apt-get install jq
chmod +x jq
```
### macOS
I have no idea but it should work.
## How do I run it?
1. Get `zone id` and `API Key` from CloudFlare Dashboard.
2. First Run:
`./cf_ddns.sh --key --zone --email --interval 60 --config config.ini --save test.example.com test2.example.com | tee log.txt`
3. Once you have the config file, just `./cf_ddns.sh`
4. Done! You can find all the DNS records on the CloudFlare dashboard.
`./cf_ddns.sh -h` for help.
## Credits
- [ipify.org](https://ipify.org) for the simplest API to get IP.
- [httpbin.org](https://httpbin.org) for the debugging help.
- [Tutorial for Arg Parse](http://www.bahmanm.com/blogs/command-line-options-how-to-parse-in-bash-using-getopt)
- Ton of [StackOverflow](https://stackoverflow.com) and https://unix.stackexchange.com help.
- [CloudFlare](https://CloudFlare.com) for the awesome API.
- [GitHub](https://github.com) and [NameCheap](https://nc.me) for the free domain in education pack.
## Notes
- To save number of API calls this script updates the `A` record only when the host IP changes. It does not periodically check if the record is modified by other means. You can use `--always-update-dns` to update the record entry at the interval.
- What is DNS record? https://www.cloudflare.com/learning/dns/dns-records/ (Psst: We are just messing with `A` record here)
- Works on CloudFlare API `v4`
- Maybe use `sed` instead of `jq` in future. Pull-Requests are welcomed.