Repository navigation
Description
AI-assisted issue. Filed by agent driven by @Cervator via GDD.
Context
Deferred from #19, which enabled the shared MySQL cluster and the operator's MySQL engine. CodeRabbit flagged that MIMIR_MYSQL_TLS=true gives encrypted-but-unauthenticated connections; the gate was merged with the finding accepted rather than fixed, because the same trade already applies to Postgres and fixing one engine alone would leave the two provisioners inconsistent while the larger live surface stayed unverified.
Problem / Current State
Both provisioners encrypt their admin connections and neither authenticates the server.
operator/internal/engine/mysql.gosetscfg.TLSConfig = "skip-verify"whenMIMIR_MYSQL_TLSis on.operator/internal/engine/postgres.gousessslmode=require, which is the libpq equivalent: encrypt, do not verify.
Both are already commented as a deliberate choice — the server certificate is issued by the Percona operator's internal CA, which the operator does not carry — and both name this as a shared hardening follow-up. This issue is that follow-up.
The exposure is a man-in-the-middle on the in-cluster path to the shared clusters, using admin credentials that can create and drop databases and roles for every tenant. Low likelihood inside the cluster network, high impact if it happens, and the mitigation is ordinary rather than exotic.
Acceptance Criteria
- The operator verifies the server certificate for BOTH engines: CA chain and expected server name, not one or the other.
- MySQL uses a registered
tls.ConfigwithRootCAsandServerNameinstead ofskip-verify. - Postgres moves from
sslmode=requiretoverify-full(orverify-cawith an explicit reason recorded for why the hostname check is skipped). - The CA source is configuration, not a hardcoded path — a homelab or k3d cluster generates different secret names.
- Verification failure is a clear error naming the CA and the expected server name, not a bare handshake failure.
- Behaviour is unchanged when TLS is off, so k3d and test paths keep working.
- Existing tenants (artifactory, keycloak, xenforo) keep working across the change — this touches how the OPERATOR connects, so a regression shows up as failure to vend, not as tenant downtime.
Technical Notes
Key files: operator/internal/engine/mysql.go (around the t.TLS block, ~line 597), operator/internal/engine/postgres.go, and operator/config/deploy/operator.yaml for whatever new env and volume the CA needs.
The Postgres CA is already present and easy: mimir-postgres-cluster-ca-cert in the mimir namespace, which the Percona PG operator maintains.
The MySQL side needs investigating first. As of 2026-09-06 there is no mimir-mysql-ssl secret in the namespace, no cert-manager Certificate or Issuer, and spec.tls / sslSecretName / sslInternalSecretName are all unset on the PerconaXtraDBCluster — yet TLS is demonstrably on, because the operator connects successfully with MIMIR_MYSQL_TLS=true. Find where PXC's server certificate actually comes from before assuming it mirrors the Postgres arrangement; that answer may change the shape of the fix.
Note the Go MySQL driver requires mysql.RegisterTLSConfig(name, cfg) and then cfg.TLSConfig = name — it does not accept a *tls.Config inline.
Explicitly out of scope: whether TENANTS verify. The published uri carries a TLS hint that non-Go consumers ignore (already documented in mysqlURI), and each app configures TLS its own way — Artifactory needed an explicit ?sslmode=require because JDBC does not default to TLS the way libpq's sslmode=prefer does. That is a per-consumer concern across several repos, not this one.
Related
- Enable the shared MySQL cluster and the operator's MySQL engine #19 — enabled the MySQL gates; this is its deferred finding, with the reasoning in the review thread on
operator/config/deploy/operator.yaml.
Activity