Skip to content

Conversation

@bastimeyer
Copy link
Member

  • Add certifi as a direct dependency (already defined by requests) and don't set a version range
  • Set the ca_certs SSL option in WebsocketClient which defaults to the CA certs file bundled by certifi, similar to HTTPS requests made by requests

Resolves streamlink/streamlink-appimage#1

While requests uses the bundled cacert.pem CA certificates file by the certifi dependency (via certifi.where()) for all HTTPS requests being made by Streamlink (since Streamlink doesn't set any custom paths), websocket-client defaults to the system's CA certs which get loaded by OpenSSL. Depending on the system config, this can cause issues, and it's also inconsistent with HTTPS requests made by requests. Streamlink should therefore load the same cacert.pem when making secure websocket connections via websocket-client, like requests does for all HTTPS requests.

Similar to requests and its REQUESTS_CA_BUNDLE / CURL_CA_BUNDLE env vars, WEBSOCKET_CLIENT_CA_BUNDLE can be set to override the default path.

I have no idea though what changing this does to OpenSSL's SSL_CERT_FILE env var and whether this will still be supported.

- Add `certifi` as a direct dependency (already defined by `requests`)
  and don't set a version range
- Set the `ca_certs` SSL option in `WebsocketClient` which defaults to
  the CA certs file bundled by `certifi`, similar to HTTPS requests
  made by `requests`
@bastimeyer bastimeyer force-pushed the plugin/api/websocket/cacert branch from 9892d3d to 78be83b Compare November 17, 2022 14:08
@bastimeyer bastimeyer requested a review from back-to November 17, 2022 14:09
@gravyboat gravyboat merged commit 3d4ebf3 into streamlink:master Nov 17, 2022
@bastimeyer bastimeyer deleted the plugin/api/websocket/cacert branch November 17, 2022 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[plugin.api.websocket][error] [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)

2 participants