Repository navigation
feat(redis,postgres): certify the per-engine external hostname - #4627
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (6)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughPostgreSQL and Redis certificates now include an engine-qualified external hostname alongside the existing flat hostname. Related tests and documentation are updated. PostgreSQL documentation also states the direct TLS negotiation requirements for SNI routing. ChangesExternal TLS SANs
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Feature Merge Risk: ⚪ Minimal · up to The new certificate names match the documented access requirements. No actionable issue introduced by this change remains after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The added names remain release-specific and use the existing tenant hostname and external-access controls. No new listener, certificate authority, or credential privilege is established by this change. Certificate propagation and rollback still depend on the existing issuance and workload reload mechanisms. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
IvanHunters
left a comment
There was a problem hiding this comment.
Verdict
LGTM
SAN-only, and additive. Each engine renders the new <release>.<engine>.<apex> name under the same gate that already controls the flat name, the default install renders exactly as before, and the single leaf reissue an upgrade triggers comes off the same CA, so it is expected rather than a regression.
Caveats
- Existing-customer upgrade (external + TLS releases): render-diff against the merge base reports
external=true->changed-output(serverAltDNSNames 1->2) andexternal=false->unchanged, 0 regressions. At head, postgresserverAltDNSNames= [pg-test.example.cozy.local,pg-test.postgres.example.cozy.local], and the redis leafdnsNamesgainsmy-redis.redis.example.comnext tomy-redis.example.com. The longer SAN list makes CNPG (postgres) and cert-manager (redis) reissue the server leaf from the same CA. The trust anchor does not change, so CA-verifying clients keep working, and the redis operator rolls pods one at a time the way it does on any renewal. Both are mutable CR spec fields the release owns (not apiserver-defaulted), so there is no SSA-ownership or immutable-field conflict. - Fresh install: with default values (
external=false) both charts render 0 external SANs. Postgres emits nocertificatesblock and the redis Certificate is gated on TLS, which is off by default. Unaffected. - Pre-existing, non-blocking: under external+TLS with a missing tenant apex, postgres hard-fails render through
cozy-lib.ns-host-required(packages/apps/postgres/templates/db.yaml:78) while redis just skips the external SAN (packages/apps/redis/templates/certmanager.yaml:112). That divergence predates this PR, and the new name follows the same gate as the flat one, so each chart stays internally consistent.
fdba7e3 to
d9f52a2
Compare
|
The postgres and redis split on a tenant without a host is older than this PR, and so is the issue for it: #4047. I updated it with the current state across all engines: #4047 (comment) |
The tenant Gateway's TLS-passthrough listeners are designed to route databases by SNI under a per-engine subdomain (*.redis.<apex>, *.postgres.<apex>), and a passthrough listener forwards the handshake untouched, so the engine's own server certificate must carry <release>.<engine>.<apex> or a verifying client fails the hostname check. The name is issued next to the existing flat <release>.<apex>, under the same TLS-and-external condition, so that a later move between the two hostname schemes reissues no certificate and leaves clients on the same trust anchor. Nothing renders a route yet; the certificate is prepared ahead of it. Adding the name changes the SAN list, so existing external TLS releases get their server certificate reissued once on upgrade, from the same CA. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <[email protected]>
d9f52a2 to
48e3d1d
Compare
IvanHunters
left a comment
There was a problem hiding this comment.
LGTM. Rendered merge-base vs head: the new SANs are added inside the existing TLS/external guards, so this is additive and unchanged for a tenant without the external host. helm unittest green (postgres 179/179, redis 48/48).
What this PR does
Redis and postgres server certificates now carry the per-engine external name
<release>.<engine>.<apex>(for exampleredis-foo.redis.example.org) next to the flat<release>.<apex>they already had. Both names appear under the same condition as before: TLS on andexternal: true, with a tenant apex present.A TLS-passthrough listener on the tenant Gateway forwards the handshake untouched, so the certificate the client checks is the engine's own. The design in #2815 routes databases by SNI under
*.redis.<apex>and*.postgres.<apex>, and without the per-engine name in the SAN list a verifying client would fail the hostname check. Issuing both names now means a later move between the two hostname schemes reissues no certificate and keeps clients on the same trust anchor. This is the certificate step of #2815. Nothing renders a route yet.The SAN list changes, so an existing external TLS release gets its server certificate reissued once on upgrade, from the same CA. For redis the operator then rolls the Redis and Sentinel pods one at a time, the same way it handles a renewal.
The READMEs say who can reach the new name through a passthrough listener. For postgres that is only clients using direct TLS negotiation (server 17+,
sslnegotiation=direct), because by default a plaintext SSLRequest comes before the handshake.redis-clineeds--sni.MongoDB is not in this PR. PSMDB issues the certificate itself and its CRD has no field for extra SANs, so adding the mongos name means the chart taking over the certificate. That needs its own change.
Covered by helm-unittest: the name is present with TLS and external on, and absent with external off, with TLS off, and in a tenant with no apex.
Screenshots
Downstream repositories
Release note
Summary by CodeRabbit
New Features
postgreshostname for external connections.redishostname when external services are enabled.Documentation