Commit 8439fda
authored
[SVLS-7945] feat: Support TLS certificate for logs/proxy flusher (#979)
## Problem
A customer reported that their Lambda is behind a proxy, and the
Rust-based extension encounters an error when sending logs and metrics
to Datadog via the proxy.
A previous PR
#961 fixed this
for traces and stats, but not for other things because the customer and
I didn't see any error with them at that time.
## This PR
Applies the env var `DD_TLS_CERT_FILE` to logs flusher and proxy flusher
as well.
Example: `DD_TLS_CERT_FILE=/opt/ca-cert.pem`, so the when the extension
flushes logs or proxied data to Datadog, the HTTP client created can
load and use this cert, and connect the proxy properly.
## Testing
1. Create a Lambda in a VPC with a proxy EC2 instance.
2. Connect to the proxy instance. With the help of ChatGPT, set up a
custom-build nginx with `ngx_http_proxy_connect_module`
3. Save the CA certificate from the proxy server to local machine
4. In the CDK stack, add a layer to the Lambda, which includes the CA
certificate `ca-cert.pem`
5. Set env vars:
- `DD_TLS_CERT_FILE=/opt/ca-cert.pem`
- `DD_PROXY_HTTPS=http://10.0.0.30:3128`, where `10.0.0.30` is the
private IP of the proxy EC2 instance
- `DD_LOG_LEVEL=debug`
6. Invoke the Lambda
## Result
**Before:**
Log flushing failed:
> DD_EXTENSION | ERROR | LOGS | Failed to send request after 97 ms and 3
attempts: reqwest::Error { kind: Request, url:
"https://http-intake.logs.datadoghq.com/api/v2/logs", source:
hyper_util::client::legacy::Error(Connect, ConnectFailed(Custom { kind:
Other, error: Custom { kind: InvalidData, error:
InvalidCertificate(UnknownIssuer) } })) }
**After:**
No such error
## Next steps
Do the same thing for dogstatsd metric flusher. Metric flusher is in a
separate repo https://github.com/DataDog/serverless-components, so let's
create separate PRs for that change.
## Notes
Customer report issue:
#9191 parent 73e6a6e commit 8439fda
1 file changed
Lines changed: 42 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
| 11 | + | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
50 | 72 | | |
51 | 73 | | |
52 | 74 | | |
| |||
56 | 78 | | |
57 | 79 | | |
58 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
59 | 99 | | |
60 | 100 | | |
61 | 101 | | |
| |||
0 commit comments