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

Support configuring custom CA to validate TLS connection with Kafka #623

Open
inge4pres opened this issue Jan 24, 2025 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@inge4pres
Copy link
Contributor

Describe current state

AFAICT there is not a way to set the RootCAs field for the TLS field of CommonConfig

TLS *tls.Config

When the CA used to sign the TLS certificate of the Kafka connection is not part of the system pool, it should be possible to add other CAs as part of it.

Describe the desired state

The handling of TLS configurations seems to be happening in

apm-queue/kafka/common.go

Lines 212 to 218 in 1822363

case cfg.TLS == nil && cfg.Dialer == nil && os.Getenv("KAFKA_PLAINTEXT") != "true":
// Auto-configure TLS from environment variables.
cfg.TLS = &tls.Config{}
if os.Getenv("KAFKA_TLS_INSECURE") == "true" {
cfg.TLS.InsecureSkipVerify = true
}
}

We should allow configuring (parts of) the TLS field, most notably the CA, since it will be used to validate TLS certificate authenticity when KAFKA_TLS_INSECURE is set to false.

@inge4pres inge4pres added the enhancement New feature or request label Jan 24, 2025
@marclop
Copy link
Contributor

marclop commented Jan 28, 2025

Not that we need to use this library, but https://github.com/twmb/tlscfg/blob/main/tlscfg.go has some samples on how to add certificate key pairs to the tls.Config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants