/gddnsu

Script to batch update Google Domains configured for dynamic DNS

Primary LanguageShellBSD 2-Clause "Simplified" LicenseBSD-2-Clause

gddnsu

A small script to update google domains configured for dynamic DNS

what is it?

gddnsu is a simple script to update your google domains configured for dynamic dns to your external ip address. It reads a list of domains and credentials (username and password pairs, generated by google domains) from a file, determines your external IP address, and updates those domains to your external IP with Google Domains It aims to support batch updates of domains while minimizing calls to services like ipinfo.io.

is this really needed?

For 99% of cases, where you need to update just a single domain, no...this is overkill. For those cases the following two line shell script would suffice:

ip=`curl -s ipinfo.io/ip`
curl -s "https://YourUsername:YourPassword@domains.google.com/nic/update?hostname=YourDomain&myip=${ip}"

where YourDomain is registered with google domains and you've configured it for dynamic dns updates, following this guide. After following that guide, google domains will generate YourUsername and YourPassword pairs for you (and can regenerate them if you ever feel they are compromised).

so then why this?

If you have an environment where others can route (sub)domains and have them configured using various dynamic DNS services and want to support google domains, then this might be a good fit.

usage

For basic usage, just run (probably via cron or similar) the command gddnsu /path/to/gddnsu.conf. See sample.conf for what gddnsu.conf looks like. It's a simple file where each line is of the form

   domain   username    password

where domain is registered with google domains and username and password are the credentials provided there for dynamic DNS updates. See this guide for details. Blank lines and comment lines (starting with #) are ignored.