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

Support SSL_CERT_FILE for the default ca_certs location #3158

Closed
DragoonAethis opened this issue Jun 12, 2024 · 1 comment · Fixed by #3160
Closed

Support SSL_CERT_FILE for the default ca_certs location #3158

DragoonAethis opened this issue Jun 12, 2024 · 1 comment · Fixed by #3160
Labels
Enhancement New feature or request

Comments

@DragoonAethis
Copy link
Contributor

Problem Statement

The SDK currently exposes a ca_certs variable that allows setting the certificate bundle file for HTTPS cert verification within the SDK itself (for certs presented by the Sentry server) - this is useful for corporate proxies doing HTTPS hijacking or self-hosted instances with certs issued under internal CAs. Unfortunately, this requires modifying the Sentry SDK integration to point to the required CA bundle file.

Requests uses the REQUESTS_CA_BUNDLE environment variable to point at a certificate bundle with no code modification. Lots of software, including python-httpx, supports the SSL_CERT_FILE env var to do the same thing.

Solution Brainstorm

If ca_certs is not set, the SDK could evaluate SSL_CERT_FILE and/or REQUESTS_CA_BUNDLE variables for a CA bundle path, before falling back to Certifi (which ships an embedded Mozilla CA bundle file).

I'd like to send a PR to add this, but wanted to ask if this is something you'd accept first.

@sl0thentr0py
Copy link
Member

@DragoonAethis yep that makes sense, please feel free to PR!

DragoonAethis added a commit to DragoonAethis/sentry-python that referenced this issue Jun 12, 2024
Many libraries use the SSL_CERT_FILE environment variable to point at a
CA bundle to use for HTTPS certificate verification. This is often used
in corporate environments with internal CAs or HTTPS hijacking proxies,
where the Sentry server presents a certificate not signed by one of the
CAs bundled with Certifi. Additionally, Requests, Python's most popular
HTTP client library, uses the REQUESTS_CA_BUNDLE variable instead.

Use the SSL_CERT_FILE or REQUESTS_CA_BUNDLE vars if present to set the
default CA bundle.

Fixes getsentryGH-3158
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants