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

Do not set FLEET_CA for well known CAs #6673

Closed
pebrc opened this issue Apr 10, 2023 · 0 comments · Fixed by #6733
Closed

Do not set FLEET_CA for well known CAs #6673

pebrc opened this issue Apr 10, 2023 · 0 comments · Fixed by #6733
Assignees
Labels
>bug Something isn't working

Comments

@pebrc
Copy link
Collaborator

pebrc commented Apr 10, 2023

If a customer wants to use custom (i.e. not ECK issued) certificates we have this documentation

https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-tls-certificates.html#k8s-setting-up-your-own-certificate

which says it is not necessary to specify the CA certificate for well-known CAs when setting up custom certificates

ca.crt: CA certificate (optional if tls.crt was issued by a well-known CA).

In the case of Elastic Agent the CA is indicated to Elastic Agent through the FLEET_CA environment variable. Setting it to a non-empty value overrides OS-level CA trust in favour of the specified CA.

If a user sets up custom certificates as indicated by the documentation for Agent they will end up with a non-functional configuration. This is because of

// Ensure that the CA certificate is never empty, otherwise Elasticsearch is not able to reload the certificates.
// Default to our self-signed (useless) CA if none is provided by the user.
// See https://github.com/elastic/cloud-on-k8s/issues/2243
expectedSecretData[CAFileName] = EncodePEMCert(ca.Cert.Raw)

where we fill the ca.crt file with the self-signed CA in the absence of a user provided one. With the behaviour of Elastic Agent I described above that means that only the self-signed CA is trusted and not the CAs trusted by the container's OS.

We should fix this behaviour for Elastic Agent by only setting the FLEET_CA variable if the user provided secret actually contains a ca.crt file or if self-signed certs are in use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant