[Babel-users] ddns with linode
Dave Taht
dave at taht.net
Thu Oct 25 21:19:11 BST 2018
I currently get my ddns from linode. It's a huge pita, because you have
to mentally parse the javascript to find the unique identifiers for each
dns entry. I may try to switch to bind9 and stick it on a subdomain, but
even then a good parse of ip -6 addr is needed.
#!/bin/sh
login=noneofyourbusiness
pass=keepout
key=the_key_you_have_to_get_when_creating a login
domain=759244 # teklibre.com
resourceid=11054923 # ceres is this machine
device=enp7s0 # not strictly needed unless you have firewall issues
# useful regex for finding your first valid public address
address=$(ip -6 addr list scope global $device | grep -v " fd" | sed -n 's/.*inet6 \([0-9a-f:]\+\).*/\1/p' | head -n 1)
# You have to create one resource id PER host via their web interface first....
# nosql strikes again
# first find the domain id, mentally parsing the javascript
# curl "https://api.linode.com/?api_key=$key&api_action=domain.list"
# Then, based on that, find the resource id
# curl "https://api.linode.com/?api_key=$key&api_action=domain.resource.list&domainid=$domain"
# And then, after you've gone through all that hell to find out these ids, you have global ddns for
# one ipv6 address on that one machine
curl "https://api.linode.com/?api_key=$key&api_action=domain.resource.update&domainid=$domain&resourceid=$resourceid&target=$address" > /dev/null
# Put something like this in cron - it would be better, IMHO, to just
# listen for new addresses via ip mon? or...
# 3 */30 * * * * /bin/echo `/bin/date`: `curl
# "https://api.linode.com/?api_key=$key&api_action=domain.resource.update&domainid=$domain&resourceid=$resourceid&target=$address"
# > /dev/null`
# and dont' forget to also keep your certs updated
More information about the Babel-users
mailing list