alexkarle.com

Source for alexkarle.com
git clone git://git.alexkarle.com/alexkarle.com.git
Log | Files | Refs | README | LICENSE

010-irc-bouncer.txt (2686B) [raw]


      1 # 010-irc-bouncer
      2 
      3 _Tues Sept 28, 2021_
      4 
      5 After ~anthony and I set up wggen(1), we could properly access IRC
      6 outside of ssh(1) (on our laptops, phones, etc).
      7 
      8 The next missing piece of the IRC puzzle was setting up a bouncer.
      9 For those less familiar with IRC (read: me 6 months ago), a bouncer
     10 is simply a special IRC client that is always on, staying in the
     11 channels for you, listening. When you connect, you then connect to
     12 the bouncer, which feeds you missed messages.
     13 
     14 This is necessary because IRC has no concept of history or buffered
     15 messages built in. So if you're not active on the network, there's
     16 no way to get missed messages.
     17 
     18 Of course bouncers provide all sorts of other nice features--a single
     19 login point for multiple networks (garbash, libera.chat, etc),
     20 auto-away, logging support, etc.
     21 
     22 For our users on this tilde, we wanted to make sure they could have
     23 chat history without having to set up their own bouncer.
     24 
     25 We picked [soju(1)](https://soju.im), since I've set it up before and I'm a general
     26 fan of the software coming from the sourcehut team. It was relatively
     27 painless to set up on OpenBSD:
     28 
     29 	$ pkg_add go sqlite3 scdoc # dependencies
     30 	$ git clone https://git.sr.ht/~emersion/soju/
     31 	$ cd soju
     32 	$ make
     33 	# make install
     34 
     35 Then, I added a new \_soju user using adduser(8) and created the cfg
     36 to listen on our wireguard port in /home/\_soju/soju.cfg:
     37 
     38 	listen irc+insecure://10.6.6.1:6677
     39 	db sqlite3 /home/_soju/soju.db
     40 
     41 Finally, I used sojuctl(1) to add myself as a user:
     42 
     43 	$ sojuctl -config /home/_soju/soju.cfg create-user alex -admin
     44 
     45 Add made a small /etc/rc.d script:
     46 
     47 	#!/bin/ksh
     48 	daemon="/usr/local/bin/soju -config /home/_soju/soju.cfg"
     49 	daemon_user="_soju"
     50 	daemon_logger="daemon.info"
     51 	. /etc/rc.d/rc.subr
     52 	rc_bg=YES
     53 	rc_cmd "$1"
     54 
     55 And enabled and started soju:
     56 
     57 	# rcctl enable soju
     58 	# rcctl start soju
     59 
     60 We're still ironing out the kinks in the user registration process, but
     61 the current process is to connect to the soju instance first and add
     62 the local network like so:
     63 
     64 In irssi:
     65 
     66 	/network add -sasl_username <login> -sasl_password <password> -sasl_mechanism PLAIN garbash
     67 	/server add -auto -net garbash irc.garbash.com 6677
     68 	/connect garbash
     69 
     70 Once connected, start a DM with the BouncerServ (provided by soju)
     71 
     72 	/msg BouncerServ help
     73 	 network create -name garbash -addr irc+insecure://localhost:6667
     74 
     75 Finally, modify our garbash network username to run soju in "single
     76 upstream mode" (aka it should only connect to this one network) by
     77 changing our username to be /garbash (the network we just created):
     78 
     79 	/network modify -sasl_username <login>/garbash garbash
     80 	/connect garbash
     81 	/save
     82 
     83 And 10 commands and 2 connections later, we have a bouncer!