Keep PostgreSQL TLS on with FIPS groups on a fips package

What failed

On the EL9 nightly-fips-builds package 19.5.3+rnightly.fips.3043008886.2f4f9db2-0.el9 (REVISION c380201e691), up --base omnibus --edition ee --image-family almalinux-9 never reached ready. The PostgreSQL service logged FATAL: could not set group names specified in ssl_groups: No valid groups found on every restart, the reconfigure failed at postgresql_user[gitlab], and up ended phase=failed, failed_step=omnibus_rerun. An earlier rig run on this package finished only after a hand edit of postgresql['ssl'] = 'off'.

Cause

flowchart TD
  A[up: install gitlab-fips on a FIPS host] --> B[dnf install runs its own reconfigure]
  B --> C[initdb writes postgresql.conf, no ssl_groups line]
  C --> D[PostgreSQL 18 default ssl_groups = X25519:prime256v1]
  D --> E{FIPS-mode OpenSSL accepts X25519?}
  E -- no --> F[FATAL: could not set group names specified in ssl_groups]
  F --> G[postgresql service restarts in a loop]
  G --> H[reconfigure fails at postgresql_user]
  H --> I[up ends phase=failed, failed_step=omnibus_rerun]
  C -. fix .-> J[bootstrap appends ssl_groups = prime256v1:secp384r1 to postgresql.auto.conf]
  J --> K[reconfigure starts PostgreSQL with TLS on]
  K --> L[up reaches phase=ready]
  • The package bundles PostgreSQL 18.6 (postgres --version on the rig; config/software/postgresql_new.rb in omnibus-gitlab sets default_version '18.6'). PostgreSQL 18 documents ssl_groups with the default X25519:prime256v1; X25519 is not FIPS-approved, and OpenSSL in FIPS mode rejects the list.
  • omnibus-gitlab has no attribute for it. In the package's own cookbook (/opt/gitlab/embedded/cookbooks/postgresql/templates/default/postgresql.conf.erb, and the same file on omnibus-gitlab master) the SSL block renders ssl, ssl_ciphers, ssl_cert_file, ssl_key_file, ssl_ca_file and ssl_crl_file only, and the postgresql[...] keys in the package's gitlab.rb list no ssl_groups, ssl_ecdh_curve or free-form PostgreSQL setting. The only attribute-level way out was postgresql['ssl'] = 'off'.

Fix

For a package named *fips* only, the bootstrap appends ssl_groups = 'prime256v1:secp384r1' to /var/opt/gitlab/postgresql/data/postgresql.auto.conf after the install and before its own reconfigure. PostgreSQL reads that file after postgresql.conf, and omnibus never writes it. TLS stays on. If gitlab.rb already carries the sim tuning (a retry), it reconfigures once more to apply the setting. A package that is not fips takes none of this, and its gitlab.rb is byte-for-byte the same.

up already fails rather than hangs when reconfigure cannot start PostgreSQL (phase=failed, failed_step=omnibus_rerun, about 14 minutes in), so the wait needs no new bound.

bootstrap-omnibus-selftest.sh gains cases for the fips setting, a retry after a failed reconfigure, an existing setting, a missing data directory, and the unchanged output of a package that is not fips. Four of them fail without the fix. bases.md gains one sentence, with the same number of words trimmed from the same file.

Rig proof

Both on 19.5.3+rnightly.fips.3043008886.2f4f9db2-0.el9, --edition ee --image-family almalinux-9 --skip-activation.

Run Code Result
sim-fips-pg origin/main phase=failed, failed_step=omnibus_rerun; the PostgreSQL log shows the ssl_groups FATAL on every restart
sim-fips-pg2 this branch bootstrapping 00:29:50Z, configuring 00:46:37Z, ready 00:52:24Z

On sim-fips-pg2: SHOW ssl is on, SHOW ssl_groups is prime256v1:secp384r1, and fips-mode-setup --check reports FIPS mode is enabled. Both rigs were deleted by name, and gcloud compute instances list shows neither.

Checks

commit-trailers, word-budget (46000, the ceiling), shellcheck at warning level on both scripts, vale-check (parity) and the bootstrap self-test pass locally.

Edited by Andrew Dunn

Merge request reports

Loading
Loading