-
Notifications
You must be signed in to change notification settings - Fork 860
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
[Bug]: Can't trust custom Certificate Authority, only the self signed certificate #3287
Comments
I don't believe there is a way in Electron to set this up, though as I would understand it I think Electron would check your locally configured trusted certificate authorities to see if a certificate is valid, and only throw an error if it doesn't recognize one of those installed authorities. At least this is how I believe it works on Windows, Ubuntu may handle things differently. If possible, can you try install the certificate into your OS so that Electron recognizes it as valid? Not sure if this guide would help: https://superuser.com/questions/437330/how-do-you-add-a-certificate-authority-ca-to-ubuntu |
Thank you for your reply 🙂 I have already added my CA's certificate to Ubuntu's certificate store (by adding the certificate to NODE_EXTRA_CA_CERTS=/usr/local/share/ca-certificates/ca.crt mattermost-desktop But that does not work either. |
I digged into the mattermost-desktop source code a bit, it looks like the logic implemented for handling self signed certificates implements a simple "if certificate in Lines 100 to 120 in 0bbf4ef
desktop/src/main/certificateStore.ts Lines 75 to 80 in 0bbf4ef
Perhaps instead of merely checking if the previous and current certificates are equal we could validate the certificate against a CA's certificate? |
Appreciate the effort to look at the code, I'll have to spend a bit of time and chat with some people internally on this one. Created a ticket: https://mattermost.atlassian.net/browse/MM-62733 |
I dug a bit further and actually found the "proper" way to add a CA's certificate for use by Electron apps. TL:DR, its possible to add the CA's certificate to the NSS shared DB with the following command: certutil -d "sql:${HOME}pki/nssdb" -A -t "C,," -n my_custom_ca -i "${CA_CERTIFICATE_FILE}" Then, you can remove mattermost-desktop's "certificate store": rm ~/.config/Mattermost/certificate.json Once you relaunch mattermost, Electron will consider the certificate valid and mattermost-desktop's custom certificate handling code (linked above) won't be executed. This is a functioning workaround, but mattermost-desktop's certificate handling code could maybe be updated to either prompt the user to manually insert the CA's certificate in the NSS store, or the app could do it itself. |
Checks before filing an issue
Mattermost Desktop Version
5.10.2
Operating System
Ubuntu 24.04.1 LTS
Mattermost Server Version
9.11.8
Steps to reproduce
~/.config/Mattermost/certificate.json
Expected behavior
There should be a way to point the Mattermost desktop client to the custom Authority's certificate instead of simply trusting the TLS certificate (which is bound to expire and be renewed).
Otherwise, the user is prompted to re-trust the certificate every time it expires (which can be frequent in modern environments with automatic renewal) which is not secure.
Observed behavior
A TLS certificate error pops up in the mattermost desktop client every time the TLS certificate of the server is renewed.
Log Output
Additional Information
No response
The text was updated successfully, but these errors were encountered: