mattermost / desktop

Mattermost Desktop application for Windows, Mac and Linux
Apache License 2.0
2.03k stars 830 forks source link

Custom certificate is not applied to the WebSocket Connection #2379

Closed marcoesposito1988 closed 1 year ago

marcoesposito1988 commented 2 years ago

I confirm (by marking "x" in the [ ] below: [x]):


Summary Custom certificate is not applied to the WebSocket Connection

Environment

Steps to reproduce

Expected behavior

Observed behavior

Possible fixes Manually copying the https:// section for wss:// as follows seems to fix the problem:

{
  "https://...": {
    "data": "-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----\n",
    "issuerName": "...",
    "dontTrust": false
  },
  "wss://...": {
    "data": "-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----\n",
    "issuerName": "...",
    "dontTrust": false
  }
}
devinbinnie commented 2 years ago

Thanks for the report, created a ticket here: https://mattermost.atlassian.net/browse/MM-48407

tboulis commented 1 year ago

@marcoesposito1988 can you please check if the server uses the same certificate (or any certificate at all) for the wss connection?

NickoOwen commented 1 year ago

Hi, sorry to jump in but in case this helps get it fixed I thought I should leave a comment.

I believe I have encountered this exact same issue. Older Mattermost clients would work as they added both the https://... and the wss://... entry to the certificate.json file when a user selects to trust an unknown certificate in the popup. Newer clients however appear to only add the https://... entry to certificate.json which results in the red banner appearing due to the WebSocket connection being blocked.

The workaround suggested above to manually add the wss://... entry to certificate.json has worked every time in my testing so far. Noting that the client needs to be properly closed and reloaded for the changes to take effect.

Hope this helps.

Petaris commented 1 year ago

I tried the suggested work around but it didn't work for me. It seems to re-write that file every time the client starts. I'm using 5.2.2 on Linux.

tboulis commented 1 year ago

Thank you for your feedback. This issue is addressed in this PR: https://github.com/mattermost/desktop/pull/2526

devinbinnie commented 1 year ago

Closing as the above PR was merged.