It works!

This project is designed to allow a GNU/Linux host with ION-open-source-4.1.1 compiled and installed to send a special query to this server, which will autogenerate a working runcontrol file for ION and publish that file to this website for retrieval by the client script.

At present, this process will only result in a correct configuration if the client host has a public IPv4 address. Hosts behind a NAT, and IPv6 only hosts running the provided script will not produce working configuration files. Your IPv4 address need not be static, but if your DHCP assigned address changes, it will render the ION runcontrol file invalid, and will require running the script again.

Instructions

Use of the Automatic Configuration Generator is simple. First, download the tarball containing the bash script which will contact this host, and the binary payload the script sends to us:

wget http://ph7ix.net/files/ionagc.tar.gz

Next, extract the tarball:

tar zxvf ionagc.tar.gz

Make the script executable:

chmod 755 ionagc

Execute the script:

./ionagc

You will find, in your current working directory, a file named based on your IP address. This file contains your working ION runcontrol file, which will set up a contact, range, span, and plan with this host, ph7ix.net, via ION using BPv7.

To start ION with this configuration, execute:

ionstart -I $nameoffile

where $nameoffile is the IP address based name of the file the script downloaded.

You can send us a message with:

bpsource ipn:2323.2 "message contents"

Note that your "message contents" presently needs to be < 80 characters.

Troubleshooting
For the ionagc script to work correctly, the "nc" command must be installed. For Debian and derivatives,

sudo apt install netcat

will fulfill this dependency.

Getting this error when running the client script?

--2022-02-11 17:19:45--  http://ph7ix.net/ionconfig/100281 [ph7ix.net]
Resolving ph7ix.net [ph7ix.net] (ph7ix.net [ph7ix.net])... 23.130.80.23
Connecting to ph7ix.net [ph7ix.net] (ph7ix.net
[ph7ix.net])|23.130.80.23|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2022-02-11 17:19:46 ERROR 404: Not Found.

The host you are connecting from is behind a NAT, using RFC 1918 private address space. This server logs the public IP address the client script connects from, and makes the relevant runcontrol file available at http://ph7ix.net/ionconfig/$ADDRESS where $ADDRESS is the four concatenated, undelimited quatrains of the connecting public IPv4 address. For example, for a host with address 222.111.222.111, $ADDRESS would contain 222111222111

The client script, which returned the error above, collects the IP address from the host on which it runs, however. Since the client script is running on a host behind a NAT, this address will be the private address of the host, and not the public address of the upstream NAT 'router'. This mismatch is causing the automated download of your runcontrol file to fail, per the above error message.

Wait, all is not lost if you have no publicly addressed host! If you know the public address of your upstream NAT, you can manually download your configuration file using the syntax above, at http://ph7ix.net/ionconfig/$ADDRESS. You will further have to configure your upstream NAT to forward incoming packets to UDP port 1113 on the publicly addressed interface to the same port on the privately addressed host running the ionagc client script in order to perfect the NAT traversal.
How does it work?
Apart from the client side script and binary payload in the tarball above, there are server side components running on this host as well. The following iptables rule is placed in /etc/rc.local , which will cause it to run at boot time, enabling kernel logging of IP addresses making connections with ION at UDP port 4556.

iptables -A INPUT -p udp --dport 4556 -j LOG --log-level 4

As well, the following line is added to /etc/rsyslog.conf to create a custom logging location for our log-level 4 entries:

kern.warning -/home/scott/udp.log

When this server receives the binary payload from the client using the ionagc script, a script is run on the server that parses the IP address of the client from the logs, generates a runcontrol file for the client, and publishes that runcontrol file to a local webserver. The client script then automatically downloads the runcontrol file to the client filesystem. The server side script can be found here.

The local ION node providing this service required small configuation changes as well, specifically in the bpadmin section. An endpoint is defined for the service, and it's error handling function is then used to trigger our server side script:

a endpoint ipn:23.0 q '/home/scott/triggerscript'

As well, we must define the UDP convergance layer, inducts, and outducts:

a protocol udp 1400 100
a induct udp 23.130.80.23:4556 udpcli
a outduct udp 23.130.80.23:4556 udpclo


Finally, we need a plan, in the ipnadmin section of the runcontrol file:

a plan 23 udp/23

The binary encoded agcdat file included in the client package was created by hand writing a CBOR encoded text file containing a well-formed Bundle Protocol bundle. That text file was then encoded into binary with the follwing:

xxd -r -p textfilename binaryfilename

Thanks to Scott Burleigh for the pointer on the binary encoding!