Maintain a persistent IRC connection with ZNC (Debian), LimeChat (macOS), and Palaver (iOS)

Overview

Prior to Slack, Teams, iMessage, Discord, WeChat, Signal, and the plethora of communication platforms, we had IRC. Unlike todays crop of chat networks, IRC is built on top of an open communication protocol. These open standards facilitate innovation by allowing developers to design clients to meet the needs of their users, move data between providers, and gain a deeper understanding of data management, without being encumbered by proprietary platforms.

IRC is a real time communication platform, it struggles with persistent chat history or seemless support of stateful simultaneous clients (ie. mobile and desktop). I would be amiss to ignore over this glaring gap in functionality many of the more predominate clients of today offer. IRC is still under active development. Enhancements under the IRCv3 working group are adding features like chat history and server time to facilitate more robust persistence and history features.

Until these additional features become widely adopted, we can work around the gaps with an IRC bouncer like ZNC. A bouncer runs on a system with a constant connection to the IRC server. Instead of the IRC server maintaining a client’s chat history, the bouncer acts as a proxy, keeping track of when the client is away and replaying all messages when they return.

Image of

Details

In this post I detail configuring and using ZNC to maintain a persistent IRC connection to FreeNode. The “always on” server is a $5 per/month Debian virtual private server running at Digital Ocean.

ZNC on Debian

Install znc on Debian:

apt install znc

Generate the initial configuration:

znc --makeconf

Output from znc --makeconf:

jemurray@shell:~$ znc --makeconf
[ .. ] Checking for list of available modules...
[ ** ]
[ ** ] -- Global settings --
[ ** ]
[ ?? ] Listen on port (1025 to 65534): 64697
[ ?? ] Listen using SSL (yes/no) [no]: yes
[ ?? ] Listen using both IPv4 and IPv6 (yes/no) [yes]: yes
[ .. ] Verifying the listener...
[ ** ] Unable to locate pem file: [/home/jemurray/.znc/znc.pem], creating it
[ .. ] Writing Pem file [/home/jemurray/.znc/znc.pem]...
[ ** ] Enabled global modules [webadmin]
[ ** ]
[ ** ] -- Admin user settings --
[ ** ]
[ ?? ] Username (alphanumeric): jemurray
[ ?? ] Enter password:
[ ?? ] Confirm password:
[ ?? ] Nick [jemurray]:
[ ?? ] Alternate nick [jemurray_]:
[ ?? ] Ident [jemurray]:
[ ?? ] Real name (optional): Jason Murray
[ ?? ] Bind host (optional):
[ ** ] Enabled user modules [chansaver, controlpanel]
[ ** ]
[ ?? ] Set up a network? (yes/no) [yes]:
[ ** ]
[ ** ] -- Network settings --
[ ** ]
[ ?? ] Name [freenode]:
[ ?? ] Server host [chat.freenode.net]:
[ ?? ] Server uses SSL? (yes/no) [yes]:
[ ?? ] Server port (1 to 65535) [6697]:
[ ?? ] Server password (probably empty):
[ ?? ] Initial channels: 0x29
[ ** ] Enabled network modules [simple_away]
[ ** ]
[ .. ] Writing config [/home/jemurray/.znc/configs/znc.conf]...
[ ** ]
[ ** ] To connect to this ZNC you need to connect to it as your IRC server
[ ** ] using the port that you supplied.  You have to supply your login info
[ ** ] as the IRC server password like this: user/network:pass.
[ ** ]
[ ** ] Try something like this in your IRC client...
[ ** ] /server <znc_server_ip> +64697 jemurray:<pass>
[ ** ]
[ ** ] To manage settings, users and networks, point your web browser to
[ ** ] https://<znc_server_ip>:64697/
[ ** ]
[ ?? ] Launch ZNC now? (yes/no) [yes]: yes
[ .. ] Opening config [/home/jemurray/.znc/configs/znc.conf]...
[ .. ] Loading global module [webadmin]...
[ .. ] Binding to port [+64697]...
[ ** ] Loading user [jemurray]
[ ** ] Loading network [freenode]
[ .. ] Loading network module [simple_away]...
[ >> ] [/usr/lib/znc/simple_away.so]
[ .. ] Adding server [chat.freenode.net +6697 ]...
[ .. ] Loading user module [chansaver]...
[ .. ] Loading user module [controlpanel]...
[ .. ] Forking into the background...
[ >> ] [pid: 21576]
[ ** ] ZNC 1.7.2+deb3 - https://znc.in

To configure znc through a web browser, connect to https://shell.jasonmurray.org:64697/:

Image of

Under Your Settings -> Networks (freenode) -> Edit

Enable the nickserv module to save your Nick:

Image of

Enable the route_replies modules to deal with multiple clients:

Image of

Enable the logging module:

Image of

LimeChat Configuration

On the macOS desktop, I use LimeChat as my IRC client.

Add a new server in LimeChat:

Image of

Configure LimeChat to use the ZNC proxy:

  • Network Name: Use a unique name
  • Server: DNS name of the server ZNC is running on
  • Port: The port ZNC is configured to listen on
  • SSL: Enable
  • Server Password: Password configured for ZNC user
  • Nickname: Name visable to IRC users
  • Login name: ZNC-user-name/znc-network-name-configured-above
  • Real Name: Real Name
  • Nickserv Password: Not needed, configure NicServ module in the ZNC server

Image of

LimeChat IRC sessions are proxied through the ZNC server:

Image of

Palaver

On the iPhone, I use Palaver as my IRC client.

Add the ZNC network configuration:

  • Name: Use a unique name
  • Address: DNS name of the server ZNC is running on
  • Port: The port ZNC is configured to listen on
  • SSL: True
  • Authentication: ZNC

Image of

Configure ZNC authentication:

  • Username: ZNC user name
  • Network: Network name configured in initial ZNC setup
  • Password: your password

Image of

Accept the certificate from the ZNC server:

Image of

Successful connection:

Image of