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

Add in memory PEM support for TLSSetting #2

Merged
merged 7 commits into from
Apr 12, 2023

Conversation

erikbaranowski
Copy link

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

@CLAassistant
Copy link

CLAassistant commented Apr 11, 2023

CLA assistant check
All committers have signed the CLA.

Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com>
@erikbaranowski erikbaranowski changed the base branch from main to 0.63-grafana April 11, 2023 20:19
Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com>
config/configtls/configtls.go Outdated Show resolved Hide resolved
config/configtls/configtls.go Outdated Show resolved Hide resolved
config/configtls/configtls.go Outdated Show resolved Hide resolved
config/configtls/configtls.go Show resolved Hide resolved
config/configtls/configtls.go Outdated Show resolved Hide resolved
config/configtls/configtls.go Outdated Show resolved Hide resolved
@@ -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)
Copy link
Member

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>
config/configtls/configtls.go Outdated Show resolved Hide resolved
config/configtls/configtls.go Outdated Show resolved Hide resolved
config/configtls/configtls.go Outdated Show resolved Hide resolved
@erikbaranowski erikbaranowski marked this pull request as ready for review April 12, 2023 18:50
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() {
Copy link
Author

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

@erikbaranowski erikbaranowski merged commit 62ec427 into 0.63-grafana Apr 12, 2023
@erikbaranowski erikbaranowski deleted the tls-content-support branch April 12, 2023 19:07
wildum pushed a commit that referenced this pull request Sep 25, 2023
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
wildum pushed a commit that referenced this pull request Oct 30, 2024
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants