Commit Graph
3 Commits
Author SHA1 Message Date
Michael Munchandkfox1111 1ce42d587a fix(spire-server): support postgres TLS client-certificate (passwordless) auth (#922)
* fix(spire-server): support postgres TLS client-certificate (passwordless) auth

The postgres datastore always injected a password into the connection
string, always created the -dbpw Secret, and always set the DBPW env var,
with no way to use TLS client-certificate (or IAM) authentication. This
forced a dummy password (e.g. "unused") when authenticating with certs.

- Map dataStore.sql.rootCAPath / clientCertPath / clientKeyPath to the
  postgres connection-string options sslrootcert / sslcert / sslkey
  (previously these were mysql-only and rejected for postgres). MySQL keeps
  using the root_ca_path / client_cert_path / client_key_path plugin fields,
  now correctly gated to mysql/aws_mysql only.
- For postgres/aws_postgres, when dataStore.sql.password is empty, omit
  "password=${DBPW}" from the connection string and skip creating the -dbpw
  Secret and the DBPW/RODBPW env vars (mirrors the existing gcp_mysql_sa_iam
  passwordless behavior).
- Add a guard: for postgres, dataStore.sql.password and clientCertPath are
  mutually exclusive.
- Fix a stray tab in the mysql client_key_path config field.
- Update value docs and regenerate the README.

Existing configurations with a password set are unaffected.

Signed-off-by: Michael Munch <[email protected]>

* 🐛 fix(spire-server): keep postgres password when external secret is used

The postgres passwordless path keyed only on an empty password, so
enabling dataStore.sql.externalSecret (or readOnly.externalSecret) with
an empty password dropped the password token from the connection string
and skipped the DBPW/RODBPW env vars, breaking external-secret auth.

- Add shared passwordless predicates that also require external secrets
  to be disabled, evaluated independently for read-write and read-only.
- Use the predicates in datastore-config, secret.yaml, and
  server-resource.yaml so the gating cannot drift.
- Add unit tests for postgres with read-write and read-only external
  secrets plus the cert-auth passwordless case.

Signed-off-by: Michael Munch <[email protected]>

* 🔁 ci: re-trigger checks

Re-run CI; the previous spiffe-step-ssh integration job failed on an
unrelated flaky SSH host-key verification on k8s v1.35.1 (passed on
v1.33.7 and v1.34.3).

Signed-off-by: Michael Munch <[email protected]>

---------

Signed-off-by: Michael Munch <[email protected]>
Co-authored-by: kfox1111 <[email protected]>
2026-08-20 11:15:26 -07:00
Michael Munchandkfox1111 ab5e5d8677 fix(spiffe-oidc-discovery-provider): run under restricted PSA/SCC on OpenShift (#920)
* fix(spiffe-oidc-discovery-provider): run under restricted PSA/SCC on OpenShift

The OIDC discovery provider does not require any elevated privileges: it
runs fine under OpenShift's built-in restricted-v2 SCC (non-root, no
privilege escalation, all capabilities dropped, RuntimeDefault seccomp,
read-only root filesystem) and mounts only restricted-compatible volumes
(csi, configMap, emptyDir, secret, projected, downwardAPI).

Despite this, on OpenShift the chart:
- downgraded the spire-server namespace from restricted to privileged PSA
  whenever the OIDC provider was enabled, and
- created a fully privileged SecurityContextConstraints (host network/IPC/
  PID, privileged container, hostPath, arbitrary seccomp, RunAsAny) bound
  to the provider's ServiceAccount.

Both contradict the chart's own Namespaces documentation, which specifies
restricted PSA for spire-server, and violate least privilege for an
internet-facing OIDC endpoint.

Remove the privileged PSA override for the OIDC provider (spire-server
stays restricted; the scc.podSecurityLabelSync=false label is retained)
and drop the privileged SCC so the provider falls through to restricted-v2.

With spire-server enforcing restricted PSA, the inline-CSI PodSecurity
check reads the cluster-scoped CSIDriver's
security.openshift.io/csi-ephemeral-volume-profile label. If the CSIDriver
is not committed before the spire-server StatefulSet (which mounts the
inline upstream.csi.spiffe.io volume) is admitted, the profile defaults to
privileged and admission is denied. Under ArgoCD the CSIDriver and the
server StatefulSet can land in the same sync wave, racing admission.
Annotate the CSIDriver with argocd.argoproj.io/sync-wave: "-1" (OpenShift
only) so it is applied before the default-wave server workloads; the
annotation is inert for plain helm installs.

Signed-off-by: Michael Munch <[email protected]>

* ✨ make CSIDriver sync-wave ordering configurable

Add syncWave and csiDriverAnnotations values to the spiffe-csi-driver
chart so the OpenShift argocd.argoproj.io/sync-wave annotation number
can be overridden (e.g. when the chart is nested) and arbitrary
annotations can be applied to the CSIDriver.

Signed-off-by: Michael Munch <[email protected]>

---------

Signed-off-by: Michael Munch <[email protected]>
Co-authored-by: kfox1111 <[email protected]>
2026-08-20 10:51:35 -07:00
Michael Munchandkfox1111 0726faa076 ✨ add topologySpreadConstraints support to OIDC discovery provider (#925)
Add optional topologySpreadConstraints to the spiffe-oidc-discovery-provider
Deployment, matching the pattern used by spire-server and the spike-* charts.

Signed-off-by: Michael Munch <[email protected]>
Co-authored-by: kfox1111 <[email protected]>
2026-08-19 16:30:25 -07:00