n4no.org logo

about :: hosts :: tools

Tools

After you manually create your validation post, you may want to automate updating your host each time your dynamic IP changes so your subdomain always points to the right machine. On Linux, MacOS or *BSD you can use the script below which will:

1. Get a mastodon API access token from your instance

This is for Mastodon. Other Fediverse servers may be different but many can also give you a token and use a compatible API. You'll then get an access token that looks like this:
ziAlDtFAKETOKEN3D1fi4Rb15if2AEAQaaQ94PRo-ABCD

2. Use this bash script
(or make your own)

Install required commands dig and curl (here for debian/ubuntu):
 sudo apt install curl dnsutils 
Download n4no_update_my_ip.sh , make it execuable and run it.
  curl https://n4no.org/shell/n4no_update_my_ip.sh > n4no_update_my_ip.sh
  chmod +x n4no_update_my_ip.sh
  ./n4no_update_my_ip.sh mysubdomain ziAlDtFAKETOKEN3D1fi4Rb15if2AEAQaaQ94PRo-ABCD

First parameter is your subdomain (without .n4no.org) & second is your token. The script will find the external IP of the machine it runs on, fetch the mastodon post for this subdomain, and modify it using curl & the mastodon API. It will also check that dns has been updated (at ns1.n4no.org, propagation may take longer).

Example output:

Finding my external IP... Found: 15.235.49.203                 
Checking DNS records for casinha.n4no.org...MISMATCH
 casinha.n4no.org does NOT point to 15.235.49.203. It points to
  instead.
We will request an update...
Body content is: @dns@m.n4no.org\ncasinha.n4no.org\n15.235.49.2
03\n\n
Fetching post link ... Found: https://masto.lema.org/api/v1/sta
tuses/113836737824853687
Updating post for [ casinha.n4no.org ] ... Post updated success
fully!
Waiting 10 seconds for notifications to be parsed and DNS UPDAT
E..
==================================================
-----------------------------------------
GOOD!
√√√ A record match: 15.235.49.203 equals 15.235.49.203
√√√ AAAA record match: [] equals []