This is a feature-request for implementing efficient DDNS server scripts on a webmin server with DNS server running:
Most routers have, in addition of DynDNS support, a “custom” HTTP/HTTPS call to update their changing public IP address in a DNS record.
Ideally, it would be nice to have a DynDNS-like server implementation in Webmin with a GUI (maybe simpler than the GUI of the community-made B9DDNS module referred to at bottom).
But at least, it would be cool to have a cli command:
virtualmin modify-dns–modify-record-with-ttl "name type TTL value"
in addition of the --add-record-with-ttl and the --remove-record commands.
This allows to implement this DDNS-updates server with a single virtualmin-command instead of two, and would avoid two updates of slave DNS servers, with a moment without any DNS records at all between remove-record and add-record:
I also found this old project for a DDNS-server module, but seems unmaintained and non-official, so I’m not installing it:
For whoever might need it, I am sharing here a small quick and half-dirty DDNS implementation for Virutalmin in PHP, that I developed based on the one referred to above, the gist forked on github:
It allows updating or deleting IPv4 and/or IPv6 addresses
It is protected by a codephrase
All arguments are security-cleaned
It mails IP addresses changes and lack of updates
It logs changes only
It is here for Virtualmin’s community’s free usage:
The first file goes into the public_html directory, while the second one goes outside of it and should be called by a cron.
In second file ddns-cron.php the const def for LOG_FILE is missing and one should know that the 3 defined files need to exist already with right owners/rights.
After that its working like a charm and suits perfectly my needs.
You are welcome and thank you, @Appovis, for the feedback. Indeed when I adapted the constants for publishing that const LOG_FILE disappeared by mistake.
Scripts create the files if they have the write permissions to those folders, but if not then they need to be setup.
I have updated my gist above with your feedbacks. Hope that the Virtualmin @team will be implementing something nice and user-friendly one day, and also add a line command to update a DNS entry instead of having to remove and add the entry, which with multiple slave servers takes a few seconds to reload all Bind DNS servers.
DDNS_DOMAIN is not in sync as backend attaches DOMAIN_POSTFIX prefix while front end doesn’t. for my needs I just got rid of DOMAIN_POSTFIX from backend and all cool.
also it seams like there is an issue with delete requests - they got thrown from the data files but not deleted from DNS Zone - didn’t had time to look into yet but guess will be a quick fix too… feedback follows once I had time to look into it.