mikaela.github.io/blog/_posts/2015-02-24-znc160-ssl.md
Mikaela Suomalainen 9351e09a4a
Quickly point freenode -> LiberaChat where applicable
* ZNC had to have network name removed to avoid rewriting history.
* Keeping the ops opped is linked too widely and I just added a note
  that it also applies to LiberaChat directly
* umode+g I don't feel good about so I just removed it directly, I am
  not who I was in 2015.
  * references to it had to go away too
* LiberaChat runs Charybdis fork which removes the weird cmode +p
  behaviour to my knowledge
* Stagefright also couldn't have history changed so I just removed
  broken link and said it's now at LiberaChat
* ...
* TeleIRC instead of TeleMatrix had to go away, neither project is alive
  and due to freenode/LiberaChat situation living, I will hopefully
  update it to Matterbridge and more recent solutions in the future.
  TODO! Also RELAYMSG exists.
* links2: mostly dead links, but change network name
* r/chanserv: the link was dead
* r/mer-meeting: I don't think anyone uses that link and I have no idea
  if they are staying on freenode
* r/telefreenode.md: I imagine everyone has took anything useful from
  there a long time ago
2021-05-23 14:10:38 +03:00

5.8 KiB
Raw Blame History

TL;DR: if you dont verify SSL certificates, dont use SSL!

ZNC 1.6.0 was released on 2015-02-12 21:05:48Z. It brings multiple improvements such as taking IP addresses from round-robins randomly instead of always resolving them into same IP and most notably it actually verifies SSL certificates.

ZNC 1.6.0 also doesnt have option to blindly accept certificates, which would be stupid, but sadly Quakenet is right about most of people just accepting certificates blindly as people are asking how to disable the SSL certificate verification on #znc a lot.

Some people even wrote a patch and scripts to disable the verification. This isnt a good idea as patching ZNC can cause all kinds of issues as sometimes seen with zncstrap 1 2 3. See also contributing (reporting bugs) guidelines of ZNC.

I believe same policy should apply to patching ZNC as to config files, patch ZNC or edit config file and you will forfeit all support.

And to the subject

If you dont verify SSL certificates, you only have a false sense of security as you let anyone between your ZNC and the IRC network. This is called as Man-in the middle (or shortly MITM) attack. There are also people asking for ZNC to trust the certificate for the first time and then be alerted if the certificate changes. What if the MITM is there during your first connection attempt and then you are alerted when the real IRC server gives you wrong certificate?

So what is the correct way?

  • Check the website of your IRC network in case the fingerprints are listed on their website.
  • Try asking the operators of your IRC network somewhere else if you know them (like another network or email).
  • This might not be so recommended, but also check the fingerprints from multiple locations.

But the IRC network has hundreds of servers with different certificates!

In this case do what was recommened before ZNC 1.6.0, check some of the servers that are geographically close to you and use them.

Checking the fingerprint from multiple locations

I have shell function (which you can find later on this page) which I run from multiple places:

  • my home, Kotka, Finland
  • Kapsi (shell), somewhere in Finland
  • my VPS, DigitalOcean, London, the UK
# Get server SSL certificate fingerprint in MD5, SHA1 and SHA256.
# Note that OpenSSL doesn't support IPv6 at time of writing (2015-01-13).
serversslcertfp () {
    SSSLCFFN=$(openssl s_client -showcerts -connect $1 < /dev/null)
    # To see all validity information
    echo "$SSSLCFFN"
    # For getting the fingerprints
    echo "$SSSLCFFN" | openssl x509 -md5 -fingerprint -noout
    echo "$SSSLCFFN" | openssl x509 -sha1 -fingerprint -noout
    echo "$SSSLCFFN" | openssl x509 -sha256 -fingerprint -noout
    echo "$SSSLCFFN" | openssl x509 -sha512 -fingerprint -noout
    unset SSSLCFFN
}

I hope this article has helped you to understand the issues with blindly accepting SSL certificates or at least to understand that if you dont want to verify SSL certificates, dont use SSL.

  • Updated on 2015-02-26 10:43Z: just use environment variables in the function like suggested by @DarthGandalf on #znc.

I am asked to verify fingerprint for network with valid certificate

Added on 2015-09-03. 4. added on 2016-01-26.

There are usually four causes for this. Lets use liberachat as example network.

  1. You dont have the ca-certificates package installed (ca_root_nss on FreeBSD), so your system trusts no certificate authority. Install it and try again.
  2. You are connecting to wrong address. liberachats certificate is valid for *.libera.chat, but there are CNAMEs pointing there. If you connect to CNAME and the certificate isnt valid for that CNAME, the certificate is invalid.
    • You should always connect to irc.libera.chat.
  3. There is MITM which is unlikely, but unlikely is not impossible. Validating the certificates either by trusted certificates or verifying the fingerprints securely manually protect you from this. If MITM is the case, you shouldnt connect.
  4. You have ca-certificates installed, but the remote certificate is signed by CA that is not included in it. You could try installing system updates in case ca-certificates have been updated or you will have to treat the certificate as invalid until ZNC starts supporting its own CA storage. See (and comment if you encounter this) znc/znc#909.

Section added on 2018-11-10: I have started using the new option to allow invalid SSL certificates in some cases as this post is only written with clearnet in mind.

I am on some networks over Yggdrasil or Cjdns which already have E2EE like Tor hidden services so as long as they are accessed directly, all benefits of TLS are there already and TLS certificates are an additional burden as with LetsEncrypt they will change often and LetsEncrypt doesnt support any network I mentioned.


As I seem to be updating this page more than I originally thought I should probably add this link to changelog here.