Repository navigation
[-] use HTTPS for etcd endpoints when TLS params are set - #1611
Open
pashagolub wants to merge 1 commit into
Open
pashagolub wants to merge 1 commit into
pashagolub wants to merge 1 commit into
Conversation
The resolver built every etcd endpoint as http://, and the etcd client drops the TLS config for http endpoints. So ca_file, cert_file and key_file were parsed but never used, and TLS-only etcd clusters could not be monitored. Endpoints now use https:// when any TLS param is set. getTransport loads client certs without ca_file, and returns errors for a CA file with no certificates or a cert_file/key_file set without the other.
Coverage Report for CI Build 39576519490Coverage increased (+0.3%) to 88.104%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
馃挍 - Coveralls |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reported in discussion #1610: pgwatch cannot monitor a Patroni cluster whose etcd only listens on TLS.
NewHostConfigbuilt every etcd endpoint ashttp://host. etcd client v3 maps thehttpscheme toCredsDrop(client.gocredentialsForEndpoint), so the client discarded our TLS config. pgwatch parsedca_file,cert_fileandkey_file, then never used them.The Patroni how-to now states when pgwatch uses HTTPS and that
cert_fileandkey_filego together.Evidence
NewHostConfig("etcd://host1:2379/...?ca_file=/ca.crt")returnedDcsEndpoints == ["http://host1:2379"].getTransportwith onlycert_fileandkey_filereturned a TLS config without client certificates.After: the same URI returns
["https://host1:2379"]. The newTestGetTransportcovers: no params gives nil; CA only; client cert without CA (uses the system pool); a CA file with no certificates and a bad key both return errors.TestNewHostConfig_BasicParsingadds cases for thehttpsscheme and for a half-set cert/key pair.go test -p 1 ./internal/sourcesandgolangci-lint run ./internal/sources/...pass.Merge Danger
Door: two-way
Reverting is a code-only change. Nothing about schemas or stored data changes.
Blast Radius: etcd sources
Two etcd setups that worked by accident now fail:
cert_fileandkey_file. It now fails to parse instead of silently connecting without a client cert.ZooKeeper and Consul sources are unchanged.
AI & Automation Policy
AI/automation tools used (leave blank if none):
Checklist