Skip to content

[configtls] Fail fast if configuration does not have a certificate #13130

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

Open
mx-psi opened this issue Jun 2, 2025 · 1 comment · May be fixed by #13134
Open

[configtls] Fail fast if configuration does not have a certificate #13130

mx-psi opened this issue Jun 2, 2025 · 1 comment · May be fixed by #13134
Labels
area:config enhancement New feature or request

Comments

@mx-psi
Copy link
Member

mx-psi commented Jun 2, 2025

Component(s)

No response

Describe the issue you're reporting

When you use configtls.ServerConfig or configtls.ClientConfig, our code eventually calls tls.NewListener. This method, as expected, has the following requirement:

The configuration config must be non-nil and must include at least one certificate or else set GetCertificate.

which means that if you set a TLS configuration without certificates you then get the following runtime error (thanks @jade-guiton-dd for checking this):

2025-06-02T13:16:39.313+0200	error	http/server.go:3487	http: TLS handshake error from 127.0.0.1:59317: tls: no certificates configured	{"resource": {}, "otelcol.component.id": "otlp", "otelcol.component.kind": "receiver", "otelcol.signal": "logs"}

We can make this into a validation error so that users can detect this faster.

This would mean adding a check in the Validate function for configtls.Config.

@mx-psi mx-psi added enhancement New feature or request area:config labels Jun 2, 2025
@areebahmeddd
Copy link

Hi @mx-psi!

should validation also check that certificate files exist and are readable at config validation time?

gupta-nu added a commit to gupta-nu/opentelemetry-collector that referenced this issue Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:config enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants