A shell script and (optionally) systemd service to use Regfish DynDNS to register the current IP as a domain name.
The systemd service can be used to register the current IP when the system boots. This is useful for example for cloud servers that get assigned a new IP address on each start.
The script uses a Regfish DynDNS token to modify your DNS. Anybody with access to this token can modify your DNS records.
If you use the --token command line parameter to pass the Regfish
token, all users can see it, for example with the ps command.
Don't do this on a system with untrusted users.
The safer option is to let the script read the token form a config
file with the --config option, but make sure this config file is only readable by trusted users.
Install the regfish-dyndns.sh script:
sudo cp regfish-dyndns.sh /usr/local/bin/
You can use the command line parameters --fqdn (the domain for which
you want to set the IP) and --token (the Regfish DynDNS token as
obtained from the Regfish web interface) to register the current hosts
IP for the specified domain name.
You can also set these values in a config file:
sudo cp regfish-dyndns.conf /etc/
sudo vi /etc/regfish-dyndns.conf # set TOKEN=... and FQDN=...
# probably you should also restrict its read permissions:
sudo chmod o-r /etc/regfish-dyndns.conf
This config file is sourced by regish-dyndns.sh.
With such a config file you can use the provided systemd service file to automatically register the current IP when the system boots:
sudo cp regfish-dyndns.service /etc/systemd/system/
sudo systemctl enable regfish-dyndns # execute at system boot
sudo systemctl start regfish-dyndns # execute now
Use the specified config file. The default is /etc/regfish-dyndns.conf
(if that exists).
The fully qualified domain name you want to change to a new IP.
The Regfish DynDNS token. You get this when enabling DynDNS in Regfish's web interface for your domain.
Warning: This token can be used to modify your DNS, so take care that untrusted users don't get access to it.
Set domain name to this IPv4 address. If not specified, use the IP address
the current host uses to connect to the regfish server (thisipv4=1 in the
Regfish API).
Don't print output unless an error occurs.