Repository navigation
feat(pgsql): add pg_cert_extra_san for extra server cert SANs - #802
Closed
tpmckenzie wants to merge 1 commit into
Closed
tpmckenzie wants to merge 1 commit into
tpmckenzie wants to merge 1 commit into
Conversation
Clients that connect with sslmode=verify-full through a name other than <cluster><pg_dns_suffix> (for example a DNS record that follows the primary on failover) need that name in every member's certificate. pg_cert reissues certificates whenever their content differs, so a hand-issued certificate does not survive the next run. The new list is appended to the generated subjectAltName and defaults to empty.
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.
What
Adds an optional
pg_cert_extra_sanlist (default[]) whose entries are appended to the subjectAltName of every PostgreSQL server certificate thatpg_cert_issuegenerates.Why
We point clients (Cloudflare Hyperdrive with
sslmode=verify-full) at a DNS name that a Patroni callback moves to the current primary. That name is neither<cluster>nor<cluster><pg_dns_suffix>, so it needs to be in each member's certificate. Two things block doing that by hand today:pg_cert_copyreplaces/pg/cert/server.crtwhenever its content differs from the generated one, not only when it is missing, so a hand-issued cert is lost on the nextpg_cert/pgsql.ymlrun.files/pki/pgsql/does not help either:pg_cert_issueregenerates it from the CSR and drops the extra names.The same list is handy for an extra address (for example a Tailscale IP that Patroni's REST
connect_addressuses oncepatroni_ssl_enabledis on).Testing
On v4.6.0 (Debian 12, 3-node cluster): with the list set,
./pgsql.yml -t pg_certreissued all members' certs signed by the existing CA with the extra names,patronictl reloadplussystemctl reload pgbouncerpicked them up, andopenssl s_client -starttls postgres -verify_hostname <name>returned0 (ok)on 5432 and 6432. With the default[], the generated SAN list is unchanged.Not included
files/cmdb.sqlregisters parameters with hand-assigned ids, so I left that entry (and the pigsty.io parameter docs) for you. Happy to add them if you tell me the id to use.