No description
Find a file
joe ff4bf7fe29
Align columns in subdomain list output
Pad each column to its widest value (width measured with awk, applied via
printf %-*s) so the Netlify domains, ClouDNS targets, and IPs each line up:

  iw3.nuke.ie         -> iw3.666.cloudns.org         -> 1.2.3.4
  longerlabel.nuke.ie -> longerlabel.666.cloudns.org -> 10.20.30.40

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-14 19:35:57 +01:00
config.example Restructure into a subdomain multi-command tool 2026-06-14 19:31:15 +01:00
Makefile Restructure into a subdomain multi-command tool 2026-06-14 19:31:15 +01:00
README.md Make subdomain list show the full CNAME -> A -> IP chain 2026-06-14 19:34:18 +01:00
subdomain Align columns in subdomain list output 2026-06-14 19:35:57 +01:00

subdomain-helper

subdomain manages nuke.ie subdomains across ClouDNS, Netlify, the dynamic-IP updater on x6-server, and (optionally) Nginx Proxy Manager — from a single command.

subdomain new <label> [--target <host>] [--forward <host:port>] [--dry-run]
subdomain list
subdomain check-auth
subdomain help

What new does

For a label iw3, subdomain new iw3 will:

  1. ClouDNS — create the A record iw3.666.cloudns.org (TTL 30m) and enable its Dynamic URL.
  2. Netlify — create the CNAME iw3.nuke.ieiw3.666.cloudns.org.
  3. x6-server — append update "<dynamic-url>" "iw3" to ~/scripts/cloudns.sh and ping the URL once to seed the current IP.
  4. Nginx Proxy Manager (optional, with --forward) — create a proxy host forwarding iw3.nuke.ie to the host:port you give it.

Without --forward, the only manual step left is adding the NPM proxy host yourself.

Requirements

  • bash, curl, and jq
  • SSH access to the server alias that runs the dynamic-IP updater (x6-server by default)
  • Credentials for ClouDNS and Netlify (and NPM if you use --forward)

Install

make install                     # installs to ~/.local/bin
make install PREFIX=/usr/local   # or somewhere else

install also scaffolds ~/.config/subdomain-helper/config from config.example (without overwriting an existing one). Edit it and fill in your credentials:

$EDITOR ~/.config/subdomain-helper/config

The config holds secrets, so the script keeps it locked at mode 0000 at rest and only unlocks it for the instant it sources it. To edit it later, unlock it first — the next run re-locks it automatically:

chmod 600 ~/.config/subdomain-helper/config && $EDITOR ~/.config/subdomain-helper/config

Point SUBDOMAIN_HELPER_CONFIG at a different path to override the default location.

Commands

Command Description
new <label> Create a subdomain end-to-end (see What new does)
list List existing subdomains as chains: iw3.nuke.ie -> iw3.666.cloudns.org -> 1.2.3.4
check-auth Verify ClouDNS + Netlify (and NPM, if configured) credentials and exit
help Show usage

new options

Option Description
<label> Subdomain label, e.g. iw3 (becomes iw3.nuke.ie)
--target <host> ClouDNS host label if different from <label> (default: <label>)
--forward <h:p> Create an NPM proxy host forwarding to host:port, e.g. 192.168.1.50:3000 or https://192.168.1.50:3000
--dry-run Show what would happen, make no changes

Examples

# Verify credentials before doing anything
subdomain check-auth

# See what subdomains already exist
subdomain list

# See what would happen, no changes
subdomain new iw3 --dry-run

# Create iw3.nuke.ie
subdomain new iw3

# Create it and forward to an internal service via NPM
subdomain new iw3 --forward 192.168.1.50:3000

When you use --forward, the proxy host is created HTTP-only — open NPM once DNS resolves and request a Let's Encrypt cert to enable SSL.

Uninstall

make uninstall

This removes the installed script and leaves ~/.config/subdomain-helper in place (it holds your credentials). Remove it manually if you want.

Development

make check     # run shellcheck