Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tls handshake failure #972

Closed
ralphee opened this issue Apr 28, 2017 · 21 comments
Closed

tls handshake failure #972

ralphee opened this issue Apr 28, 2017 · 21 comments
Assignees
Labels
feature New feature request
Milestone

Comments

@ralphee
Copy link

ralphee commented Apr 28, 2017

22:58 =!= gnutls: peer's certificate is NOT trusted
22:58 =!= gnutls: peer's certificate issuer is unknown
22:58 =!= irc: TLS handshake failed
22:58 =!= irc: error: Error in the certificate.

@weechatter
Copy link
Contributor

Check your certificate. You can try: /set irc.server..ssl_verify off

Better /join #weechat channel

@flashcode flashcode added bug Unexpected problem or unintended behavior question General question and removed bug Unexpected problem or unintended behavior labels Apr 29, 2017
@flashcode
Copy link
Member

Hi,

This is not a bug, but the expected behavior.

When the certificate is not trusted (in your case the issuer is unknown), WeeChat refuses to connect.
Either check why the issuer is unknown, or if you really trust the certificate anyway, you can set the option irc.server.xxx.ssl_fingerprint (or even irc.server.xxx.ssl_verify off but this disables all checks).

@ralphee
Copy link
Author

ralphee commented Apr 29, 2017

@flashcode
Copy link
Member

flashcode commented Apr 29, 2017

Then please check that the option weechat.network.gnutls_ca_file points to the file with all certificates on your distribution.

@flashcode flashcode added the waiting info Waiting for info from author of issue label Apr 29, 2017
@ralphee
Copy link
Author

ralphee commented Apr 29, 2017

@flashcode https://i.imgur.com/APN7shK.png

changed path to /etc/ca-certificates/extracted/ca-bundle.trust.crt

and still get the handshake error

@flashcode
Copy link
Member

Are you sure this is the good file to use with this option?
Anyway as I said it's not a WeeChat issue, but a problem with the certificates installed on your machine.

@flashcode
Copy link
Member

So I can close this issue?

@ralphee
Copy link
Author

ralphee commented May 2, 2017

@flashcode Yeah pls close... Thxs everyone for the feedback!!

@flashcode flashcode removed the waiting info Waiting for info from author of issue label May 3, 2017
@dust321
Copy link

dust321 commented Nov 10, 2018

I have the same issue in Arch and FreeBSD 11.4, guess this hasn't been fixed?

@weechatter
Copy link
Contributor

As already said, its not a weechat issue but a problem with the certificates installed on your machine.

@HomingHamster
Copy link

I'm seeing this despite setting ssl_verify off

@flashcode
Copy link
Member

@HomingHamster : with ssl_verify set to off, you shouldn't see any certificate error.
Are you sure you disabled it on the appropriate IRC server?

@ghost
Copy link

ghost commented Sep 9, 2020

So, for Linux distros, there is a ca-certificates package that is usually installed by default. It installs certs (for Debian at least) to /etc/ssl/certs. You can do a sudo find / -name ca-certificates.conf and look at the top level comments to see where the cacerts are precisely installed on your machine.

If you take a look in the directory where the certs are installed (e.g., /etc/ssl/certs), there is a file called ca-certificates.crt. You want to add that file so Weechat knows about it.

You can do this by setting an environment variable as @flashcode mentioned earlier:

/set  weechat.network.gnutls_ca_file "/etc/ssl/certs/ca-certificates.crt"

Turn SSL verification back on if you disabled it.

NOTE: A little more work is required for FreeBSD users. See https://freenode.net/kb/answer/chat.

@eklitzke
Copy link

FYI I ran into this bug when I copied my weechat configs from a Centos host to a Debian host, and wanted to share what I found in case anyone else runs into this issue from Googling (as I did). On Centos my weechat.conf had:

gnutls_ca_file = "/etc/pki/tls/certs/ca-bundle.crt"

This is correct on Centos/Fedora, but not right on Debian. In fact, the default value for gnutls_ca_file in the weechat source code is the correct value on Debian: /etc/ssl/certs/ca-certificates.crt. Just unsetting the value will restore it to the correct default value, or you can manually set it as explained in the comment above.

@weechatter
Copy link
Contributor

Its not a bug, its a warning ;-)
and its highly recommended to not edit conf files manually and not needed.

This is lot easier:
/set weechat.network.gnutls_ca_file "/etc/ssl/certs/ca-certificates.crt"
or
/set weechat.network.gnutls_ca_file "/etc/pki/tls/certs/ca-bundle.crt"

@acorello
Copy link

acorello commented May 8, 2021

I had the same problem on openSUSE. The documentation of the distribution advises NOT to use paths in the application. Such paths can change from distribution to distribution. In fact my configuration was working on Void Linux and failed on openSUSE.

This is what I found in one of the files.

# Use of this file is deprecated and should only be used as last
# resort by applications that do not support p11-kit or reading /etc/ssl/certs.
# You should avoid hardcoding any paths in applications anyways though. Use
# functions that know the operating system defaults instead:
#
# - openssl: SSL_CTX_set_default_verify_paths()
# - gnutls: gnutls_certificate_set_x509_system_trust(cred)

So it seems weechat configuration could be made to work on any distribution by calling to the gnutls helper function?

@weechatter do you know if this has been considered?

@flashcode
Copy link
Member

@protoboolean: interesting, I'll make tests with this GnuTLS function and use it if it works fine.

So we could have this behavior:

  • Remove the CMake/configure option CA_FILE.
  • Always load system certificates on startup.
  • Use the existing option weechat.network.gnutls_ca_file to add extra user certificates if needed. Change the default value of option to empty string (no extra certificate loaded).

@flashcode flashcode reopened this May 8, 2021
@flashcode flashcode self-assigned this May 8, 2021
@flashcode flashcode added feature New feature request and removed question General question labels May 8, 2021
@flashcode flashcode added this to the 3.2 milestone May 8, 2021
@flashcode
Copy link
Member

Changes actually made:

  • New boolean option weechat.network.gnutls_ca_system.
  • Option weechat.network.gnutls_ca_file renamed to weechat.network.gnutls_ca_user, multiple files allowed (separated by colons).
  • Build option CA_FILE removed.
  • Certificates are purged and reloaded when options are changed.

@guodong000
Copy link

On macOS:
If openssl install by homebrew
Just /set weechat.network.gnutls_ca_user "/usr/local/etc/openssl/cert.pem"

@comradekingu
Copy link

@flashcode
Copy link
Member

@comradekingu: yes, this is for WeeChat ≤ 3.1, as mentioned in the sentence above.
And with WeeChat ≥ 3.2, nothing needed, it's automatic.

This must be removed eventually, perhaps it's time to do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request
Projects
None yet
Development

No branches or pull requests

9 participants