Setting up a znc service

Here is an installation guide of znc on Fedora 31 :

Install the znc package

sudo dnf install znc

The current version of znc in Fedora 31 is znc-1.7.5-1.fc31.x86_64.

Configure znc

The next was to configure znc.

sudo -u znc znc --makeconf

Remember to keep the desired port open in your firewall.

Install cerbot

Cerbot is a open source tool developed by Electronic Frontier Foundation (EFF). It enables HTTPS using Let’s Encrypt certificates on manually-administrated websites. To install cerbot you have to run the following command :

certbot certonly --standalone  --noninteractive --agree-tos --email [email] -d znc.dgplug.org

This will generate the TLS certificate for you.

We have to make sure that the certificate private key file is not encrypted and does not have password protection on it, ZNC is unable to properly handle encrypted private key files.

Now we have to configure znc in such a way so it can read different parts of the certificate from different files.

cat {privkey,cert,chain}.pem > znc.pem

The privkey.pem , cert.pem and chain.pem is there in the /etc/letsencrypt/live/yourdomain/ directory. The above command adds the 3 files together and puts them inside the znc.pem file.

Copy the file znc.pem to /var/lib/znc/.znc/znc.pem.

cp znc.pem /var/lib/znc/.znc/znc.pem

Automation

The certbot certificate gets renewed in every 3 months. There is process of automating the process of creating a znc.pem file every time your certificate is renewed. We can do it by adding a deploy hook to /etc/letsencrypt/renewal-hooks/deploy. Following this :

cd /etc/letsencrypt/renewal-hooks/deploy
touch update-znc.pem
chmod +x update-znc.pem
vim update-znc.pem

Add the following shell script in the update-znc.pem, remember to update the value of your domain in the following script.

#!/bin/bash
YOURDOMAIN="example.com"
 
[[ $RENEWED_LINEAGE != "/etc/letsencrypt/live/$YOURDOMAIN" ]] && exit 0
echo "Updating certs"
cat /etc/letsencrypt/live/$YOURDOMAIN/{privkey,fullchain}.pem > /var/lib/znc/.znc/znc.pem

Start the znc service

sudo systemctl start znc

The znc is up and running to keep to connected to your friends :). If you have some issues during the installation go and ping the amazing super helpful znc community in the #znc irc channel on the freenode server.

Show Comments