An automatic cloudflare DNS record updater for dynamic IP addresses.
Once you execute the JAR, you will need to set up your configuration.
Find the config.json from following location:
- Linux: /home/<user>/.config/CloudflareDNSUpdater/config.json
- Windows: C:\Users\<user>\AppData\Roaming\CloudflareDNSUpdater\config.json
Or, you can specify the location of the config.json file by adding following option: -DworkDir=<absolute path>
You should get an API token with the following permissions:
- Zone:Read
- Zone:Edit
- DNS:Edit
- DNS:Read
{
"zoneId": "", // zone id can be found on your domain's overview page
"email": "", // your cloudflare account email
"key": "", // an API token with the permissions mentioned above
"domainName": "" // the domain name you want to update/create
}
There are several ways to add CloudflareDNSUpdater as a service.
Window service system is sucks, I suggest you to use a WinSW.
- Download both JAR and WinSW.
- Create a folder named CloudflareDNSUpdater and put the JAR and WinSW in it.
- Rename WinSW.exe to cfdnsupdater.exe
- Copy the cfdnsupdater.xml to the folder, and change things as you need.
- Open CMD, run
.\cfdnsupdater.exe install
(this may require administrator privilege)
To uninstall service, simply run: .\cfdnsupdater.exe uninstall
Put the following contents in /etc/systemd/system/cfdnsupdater.service
, with replacing the needed things. (you may need sudo to perform this action)
[Unit]
Description=Cloudflare DNS Updater
After=network.target
[Service]
User=root
Environment=
WorkingDirectory=<path to the folder>
ExecStart=java -Xms512M -Xmx1G -Dworkdir=<path to the folder> -jar <path to the jar>
Restart=on-failure
[Install]
WantedBy=multi-user.target
Then execute the following commands:
sudo systemctl daemon-reload
sudo systemctl enable --now cfdnsupdater.service