Dynamic dns program written in c. I've tested it with valgrind to avoid memory leaks but it has yet to be tryed out in the real world for long periods of time.
If you'd like to use it on your server to automatically update a cloudflare dns record to your current ip start by cloning the repository.
Clone the repository in the /usr/local/sbin/dyn-dns directory.
Enter the local/sbin directory.
cd /usr/local/sbinClone the repository.
git clone https://github.com/luca-a/dyn-dns.gitInstall libpthread, libcurl and libsystemd on your os. Below you can find some examples.
sudo apt install libcurl4 libpthread-stubs0-dev libsystemd-devAfter having installed the required packages you can run make and build the executable.
makeCreate the /etc/dyn-dns directory and then create the file /etc/dyn-dns/cloudflare.config by using the command:
mkdir /etc/dyn-dns/
cp sample.config /etc/dyn-dns/cloudflare.config➡ Edit the /etc/dyn-dns/cloudflare.config file and set the appropriate values (retrieved from your cloudflare dashboard):
nano /etc/dyn-dns/cloudflare.configAt this point you just have to copy the service file to the system directory, reload the configs, enable and start the service:
cp dyn-dns.service /etc/systemd/system
systemctl daemon-reload
systemctl enable dyn-dns.service
systemctl start dyn-dns.serviceLaunch the following commands as root to create a crontab entry that will check the current ip and update it if needed every minute.
touch /etc/cron.d/dyn-dns
tee -a /etc/cron.d/dyn-dns << END
* * * * * root kill -USR1 \$(systemctl show --property MainPID --value dyn-dns.service)
ENDNow you should have a working dynamic dns for the record id you configured in the cloudflare.config file.
ℹ️ To launch the check and update of the configured dns record you just have to signal the process. Using crontab is one way of doing it but you can signal it however you want.