-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add in memory PEM support for TLSSetting #2
Conversation
d1d0620
to
2be4b34
Compare
Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com>
Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com>
@@ -236,7 +312,7 @@ func (c TLSServerSetting) LoadTLSConfig() (*tls.Config, error) { | |||
return nil, fmt.Errorf("failed to load TLS config: %w", err) | |||
} | |||
if c.ClientCAFile != "" { | |||
certPool, err := c.loadCert(c.ClientCAFile) | |||
certPool, err := c.loadCertFile(c.ClientCAFile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Just for a comment) I think in the future we'd probably want to support inline client certificate chains for authentication, but it's not something we need right now so I think it's OK to descope it.
Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com>
…n up Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com>
Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com>
Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com>
Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com>
} | ||
|
||
var getCertificate func(*tls.ClientHelloInfo) (*tls.Certificate, error) | ||
var getClientCertificate func(*tls.CertificateRequestInfo) (*tls.Certificate, error) | ||
if c.CertFile != "" && c.KeyFile != "" { | ||
|
||
if c.hasCert() || c.hasKey() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changing this to an OR is intentional as the validation will happen inside c.newCertReloader
To resolve the govulncheck reports: ``` Vulnerability #1: GO-2023-1987 Large RSA keys can cause high CPU usage in crypto/tls More info: https://pkg.go.dev/vuln/GO-2023-1987 Standard library Found in: crypto/tls@go1.19.11 Fixed in: crypto/tls@go1.21rc4 Example traces found: Error: #1: service/internal/proctelemetry/config.go:299:27: proctelemetry.initOTLPgRPCExporter calls otlpmetricgrpc.New, which eventually calls tls.Conn.Handshake Error: #2: service/internal/proctelemetry/config.go:156:39: proctelemetry.InitPrometheusServer calls http.Server.ListenAndServe, which eventually calls tls.Conn.HandshakeContext Error: #3: service/service.go:251:36: service.buildResource calls uuid.NewRandom, which eventually calls tls.Conn.Read Error: #4: service/config.go:35:13: service.Config.Validate calls fmt.Printf, which eventually calls tls.Conn.Write Error: #5: service/telemetry/telemetry.go:32:28: telemetry.Telemetry.Shutdown calls trace.TracerProvider.Shutdown, which eventually calls tls.Dialer.DialContext ``` https://github.com/open-telemetry/opentelemetry-collector/actions/runs/5753675727/job/15597394973?pr=8144
…guration - #2 (open-telemetry#11240) This PR follows open-telemetry#11041. The previous PR changed the initialization of `batchSender` and `queueSender` to AFTER configuration, because that enables us to access `queueConfig` and `batcherConfig` in the same place. I noticed since then that there is another API for queue configuration, and this PR takes care of that other API #### Link to tracking issue open-telemetry#10368 #### Testing Ran `opentelemetry-collector$ make` to make sure all tests still pass.
Description: In memory PEM support added for TLSSetting so that sources other than a file can be used for certificates.
Link to tracking Issue:
Testing: Added tests for all new scenarios with in memory PEM
Documentation: none