Commit 48b683b
authored
Add
### What does this PR do?
<!-- A brief description of the change being made with this pull request. -->
Adds a fallback to `certifi` when the no CA certificates have been found during SSL context creation.
The fallback is tested only on Linux as on Windows the [system certificate stores](https://learn.microsoft.com/en-us/windows/win32/seccrypto/system-store-locations?redirectedfrom=MSDN) are loaded by default. ([source](https://docs.python.org/3/library/ssl.html#ssl.SSLContext.load_default_certs))
### Motivation
<!-- What inspired you to submit this pull request? -->
On MacOS, some hosts were experiencing the following SSL Error:
```
SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1010)'))
```
This could have multiple root causes, originating at OpenSSL build time or from environment variables.
`certifi.where()` is [used by the `requests` library](https://github.com/psf/requests/blob/420d16bc7ef326f7b65f90e4644adc0f6a0e1d44/src/requests/utils.py#L64) and fixes this issue, therefore we can use it as a fallback.
### Review checklist (to be filled by reviewers)
- [ ] Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
- [ ] Add the `qa/skip-qa` label if the PR doesn't need to be tested during QA.
- [ ] If you need to backport this PR to another branch, you can add the `backport/<branch-name>` label to the PR and it will automatically open a backport PR once this one is mergedcertifi fallback for missing default CA certificates (DataDog#21609)1 parent 0f96340 commit 48b683b
3 files changed
Lines changed: 38 additions & 0 deletions
File tree
- datadog_checks_base
- changelog.d
- datadog_checks/base/utils
- tests/base/utils/http
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
72 | 84 | | |
73 | 85 | | |
74 | 86 | | |
| |||
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
70 | 95 | | |
71 | 96 | | |
72 | 97 | | |
| |||
0 commit comments