Actions

IRC: ZNC with Irssi and tmux Configuration

From falz.net

Work in progress

Description

This is for folks generally proficient at a unix terminal. It is so that you can connect to a terminal via ssh and reconnect to your IRC session without actually 'leaving' any IRC networks.

You will always appear online to those on the IRC network, and can choose to look at / log into your terminal when you desire.

This example connects to the libera IRC network. Replace this part and repeat various steps to connect to other networks.

Applications

  • irssi - An IRC client that runs in a terminal. It will connect to ZNC in this use case.
  • ZNC - IRC "bouncer". This actually connects to IRC networks and will run as a service on your server.
  • Tmux - Terminal Multiplexer. This lets you run many applications in one terminal. In this use case we'll run many irssi IRC clients, each of which connects to a ZNC session and hence a single IRC network
  • Mosh - Mobile Shell. Auto 'roams' and reconnects to your shell session across various networks. If your laptop goes to sleep and wakes up, it will reconnect.


Configuration

Ubuntu / Debian example. Install some packages:


apt-get install mosh irssi znc tmux



ZNC

We are NOT using SSL here as we are binding to localhost only and connecting from localhost only. This is the communication from the IRC client to the IRC bounce.

Getting ZNC and irssi working with ssl and a local cert is a large pain in the butt.

When you connect to an irc network you should use SSL.


  • Generate an initial config. Run this as your own user (not root) This will place it in ~/.znc/configs/znc.conf. We will be copying this file to the service user's account after.


znc --makeconf


  • Listen on port: 6667
  • SSL: No
  • Username: myzncuser
  • Password: <redacted>
  • many other questions: <chose defaults>
  • Set up a network? No
  • Launch ZNC now? No


  • Edit the newly created znc.conf and tell it to bind to localhost by adding Host = 127.0.0.1 to the <Listener l> section


<Listener l>
 ...
 Host = 127.0.0.1
 ....
</Lisner>


  • Copy your newly created config (and a crt required for startup) to the ZNC service directory and fix its permissions. The directory /var/lib/znc/ should already exist, "_znc" is the default user for the service which should already exist.


sudo mkdir /var/lib/znc/configs/
sudo cp ~/.znc/configs/znc.conf /var/lib/znc/configs/
sudo cp ~/.znc/znc.pem /var/lib/znc/
sudo chown -R _znc:_znc /var/lib/znc/


  • Enable and start the service (as root user / sudo)


systemctl enable znc
systemctl start znc
systemctl status znc


irssi


launch irssi and issue some commands

  • Add network called 'libera-znc'.


/network add libera-znc -nick myircuser -alternate_nick myircuser_ -user -autosendcmd '^MSG NickServ identify <ircpass>' myzncuser-libera


  • Add a server to this newly created network


/server add -network libera-znc -auto -4 localhost 6667 myzncuser-libera/libera:<zncpass>