turt2live / matrix-dimension

An open source integration manager for matrix clients, like Element.
https://dimension.t2bot.io
GNU General Public License v3.0
433 stars 110 forks source link

self signed certificate in certificate chain #378

Closed ScottRochford closed 4 years ago

ScottRochford commented 4 years ago

I'm getting this error when I try to start matrix-dimension in our internal company Matrix setup:

Oct-23-2020 05:28:29.960 +00:00 info [Webserver] API and UI listening on 127.0.0.1:8184
Oct-23-2020 05:28:29.960 +00:00 info [BotSdk-MatrixLiteClient (REQ-1)] GET https://matrix.example.com/_matrix/client/r0/account/whoami
Oct-23-2020 05:28:29.984 +00:00 error [BotSdk-MatrixLiteClient (REQ-1)] self signed certificate in certificate chain
Error: self signed certificate in certificate chain
    at TLSSocket.onConnectSecure (_tls_wrap.js:1055:34)
    at TLSSocket.emit (events.js:198:13)
    at TLSSocket._finishInit (_tls_wrap.js:633:8)
{ Error: self signed certificate in certificate chain
    at TLSSocket.onConnectSecure (_tls_wrap.js:1055:34)
    at TLSSocket.emit (events.js:198:13)
    at TLSSocket._finishInit (_tls_wrap.js:633:8) code: 'SELF_SIGNED_CERT_IN_CHAIN' }

I presume it's because the Synapse server's certificate is signed by our internal CA. Do I need to configure that CA somewhere so that matrix-dimension knows about it? Or am I guessing wrongly about the cause?

ScottRochford commented 4 years ago

Found a generic NodeJS solution (setting NODE_EXTRA_CA_CERTS variable with path to CA certificate) for this:

https://stackoverflow.com/questions/29283040/how-to-add-custom-certificate-authority-ca-to-nodejs