flexibeast.space - gemlog - 2023-05-15

Setting up the soju IRC bouncer on OpenBSD, and using it with Emacs' ERC

Setting up the soju[a] IRC bouncer[b] on my OpenBSD server was fairly straightforward. It's not currently in ports, so i downloaded a release from sourcehut:

soju on sourcehut

soju is written in Go, but soju releases contain a Makefile that allows one to do `make && make install`. After doing that, i created a `_soju` group and user via groupadd(8) and useradd(8).

/etc/group:

_soju:*:1010:

/etc/passwd:

_soju:*:1010:1010:Soju Account:/nonexistent:/sbin/nologin

i then created an rc script for soju.

/etc/rc.d/soju:

#!/bin/ksh

daemon="/usr/local/bin/soju"
daemon_user="_soju"
daemon_logger="daemon.info"

. /etc/rc.d/rc.subr

rc_reload=NO

rc_cmd $1

i then created a `/run/soju` directory, chown(8)'d it to `_soju:_soju`, and after editing `/etc/soju/config` appropriately, ran the following commands:

 # sojudb create-user admin -admin
 # chown -R _soju:_soju /var/lib/soju
 # sojuctl user create -username [username] -password [password]
 # rcctl start soju
 # sojuctl user run [username] network create -addr ircs://irc.oftc.net -name oftc -nick [nick] -connect-command "PRIVMSG NickServ :IDENTIFY [password]"

Et voilá: this was enough to get soju working with the IRC app on my phone (Revolution IRC[c]).

However, getting Emacs' ERC to work with it was not so straightforward. The main problem is that ERC, as provided by Emacs 28.3:

The latter is a problem when ERC tries to automatically reconnect after a disconnect: it will fail, due to trying to use the nick associated with a given network, rather than the soju username.

Working around these issues involved:

GitHub: erc-sasl.el