[8.19] (backport #15427) Override fleet.ssl.certificate_authorities from env vars in container mode#15468
[8.19] (backport #15427) Override fleet.ssl.certificate_authorities from env vars in container mode#15468mergify[bot] wants to merge 1 commit into
Conversation
💔 Build Failed
Failed CI StepsHistorycc @lorienhu |
TL;DRThe FIPS-only unit-test job fails deterministically in the new TestContainerEnvOverridesFleetCA test, not in the container CA override implementation. The test creates and writes an encrypted fleet.enc; vault encryption uses an arbitrary GCM IV, which Go rejects under GODEBUG=fips140=only. Remediation
Investigation detailsRoot Causeinternal/pkg/agent/cmd/container_test.go:1390 calls secret.CreateAgentSecret, and :1392-1393 creates an encrypted disk store used by the test cases. The first case then calls store.Save, which reaches vault encryption. The failing test is TestContainerEnvOverridesFleetCA at container_test.go:1315 in the Buildkite checkout. The production changes in internal/pkg/agent/cmd/container.go are not on the failing stack; the failure occurs during test setup. The repository’s internal/pkg/testutils/fipsutils.SkipIfFIPSOnly explicitly skips tests that require legacy NewGCM behavior, and the existing crypto compatibility test uses this guard. Evidence
Verification
What is this? | From workflow: PR Buildkite Detective Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not. |
What does this PR do?
When in container mode, override
fleet.ssl.certificate_authoritiesfrom env varsFLEET_CA,KIBANA_CA, andELASTICSEARCH_CAinstead of using savedfleet.encvalues.Follows the same first-set-wins fallback chain used in setup_config.go.
Why is it important?
Without this override, an agent running in container mode will crash during startup if
fleet.encstill contains afleet.ssl.certificate_authoritiespath that no longer exists on disk.Checklist
[ ] I have made corresponding changes to the documentation[ ] I have made corresponding change to the default configuration files./changelog/fragmentsusing the changelog toolDisruptive User Impact
N/A
How to test this PR locally
Unit test: TestContainerEnvOverridesFleetTLSPaths
Integration test: TestContainerCMDTLSCertOverride
Manually: Using kind, deploy ECK cluster. Enroll an agent with FLEET_SERVER_CLIENT_AUTH=required and FLEET_CA pointing to a mounted CA bundle. Unmount the CA bundle, unset env vars, and verify that agent restarts healthy.
Related issues
Closes #15408
Relates #14408
This is an automatic backport of pull request #15427 done by Mergify.