┏┓╋╋┏┓╋╋┏┳━┓╋╋┏┳┓┏┓
┃┗┳┳┫┗┳━┫┃━┫┏┓┣┫┗┫┗┳┓┏━┓┏━┳━┳┳┳━┳┳━┳┳┓ Home
┃╋┃┃┃┏┫┻╋╋━┃┃┗┫┃┏┫┏┫┗┫┻┫┃━┫╋┃┏┫┃┃┃┻┫┏┛ Status
┗━╋┓┣━┻━┛┗━┛┗━┻┻━┻━┻━┻━┛┗━┻━┻┛┗┻━┻━┻┛ Blog
╋╋┗━┛
What's this about
Let's say you got a new bsd box (freebsd15 in this case), and have too much free time on your hands. So why not make it run reticulum daemon and remote shell, amirite?
python setup
First, we need python to run reticulum and other things. Ugh, annoying, i know.
Nothing too complicated about it, just a typical setup in venv:
# install
$ doas pkg install lang/python314
# make venv and source it
$ python3 -m venv ./venv && cd venv && . ./bin/activate
# install reticulum and utils
(venv)$ pip install rns
This will give use ./bin/rnsd daemon and ./bin/rnsh remote shell
rnsd
Now we can make a service for rnsd, so it's launched every time the system starts, or restarts in case if it crashes somehow.
This file goes into /usr/local/etc/rc.d/rnsd:
#!/bin/sh
# PROVIDE: rnsd
# REQUIRE: LOGIN
. /etc/rc.subr
name=rnsd
rcvar=rnsd_enable
pidfile=/var/run/${name}.pid
procname=/home/byte/venv/bin/python3.14
command=/usr/sbin/daemon
command_args="-p ${pidfile} -u byte /home/byte/venv/bin/rnsd"
load_rc_config $name
: ${rnsd_enable:=NO}
run_rc_command "$1"
Obviously replace "byte" with your username.
To test it out:
$ doas chmod +x /usr/local/etc/rc.d/rnsd
$ doas service rnsd onestart
$ doas cat /var/run/rnsd.pid # this should give some number
$ doas service rnsd onestop
rnsh
As we're already knees deep in reticulum, why not use rnsh instead of boring old ssh? It's more fun, and it doesn't require all that dance with pub keys. Well it kinda does but it's done in background, so we only deal with identities.
For this on a remote machine run rnsh to print out the address:
$ rnsh -l -p
Identity : <5a7c1c71382b542fdc69d9349b69b97a>
Listening on : <cf4b58e1b1a4882ee7d3bbe4e8fc0bd5>
"Listening on" is what we need. On your client machine:
$ rnsh -p
Identity : <b1d1323e3f3d317cc9dabeaf3b9d8004>
Copy that client identity and put it into a file on a remote maching:
$ cat .rnsh/allowed_identities
b1d1323e3f3d317cc9dabeaf3b9d8004
Run a listener on it to test:
$ rnsh -l
Then connect with a client, using that "listening on" address:
$ rnsh cf4b58e1b1a4882ee7d3bbe4e8fc0bd5
If all goes well yous should get connected and be ready for the next stage
rnsh service
This file goes into /usr/local/etc/rc.d/rnsh:
#!/bin/sh
# PROVIDE: rnsh
# REQUIRE: rnsd
. /etc/rc.subr
name=rnsh
rcvar=rnsh_enable
pidfile=/var/run/${name}.pid
procname=/home/byte/venv/bin/python3.14
command=/usr/sbin/daemon
command_args="-p ${pidfile} -u byte /home/byte/venv/bin/rnsh -l"
load_rc_config $name
: ${rnsh_enable:=NO}
run_rc_command "$1"
Then if everything works after onestart, it can be made permanent:
$ doas cat /etc/rc.conf
# for rns
rnsd_enable="YES"
rnsh_enable="YES"
$ doas service rnsd start
$ doas service rnsh start
That's it, happy remote shelling :)