garbash-www

archive of ~alex garbash.com page
git clone git://git.alexkarle.com.com/garbash-www
Log | Files | Refs | README | LICENSE

010-irc-bouncer.md (2726B) [raw]


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