ROX-33303: Env-based TLS profile configuration for PostgreSQL services#19160
ROX-33303: Env-based TLS profile configuration for PostgreSQL services#19160vladbologa wants to merge 1 commit intomasterfrom
Conversation
|
Skipping CI for Draft Pull Request. |
|
Images are ready for the commit at 6da9db2. To use with deploy scripts, first |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #19160 +/- ##
==========================================
- Coverage 49.52% 49.52% -0.01%
==========================================
Files 2672 2672
Lines 201667 201667
==========================================
- Hits 99878 99871 -7
- Misses 94330 94337 +7
Partials 7459 7459
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ec2a39d to
b2ed562
Compare
b2ed562 to
6da9db2
Compare
Do you expect this configuration to change often? If not, why not put it into the postgresql.conf instead?
I disagree with the enforcing approach, there could be users running in environments other than OpenShift. Is there anything that prevents us keeping the defaults compliant with the OpenShift TLS, but still overridable? |
This has to be inherited from the OpenShift cluster, and can change dynamically. There's more context here:
These env vars are only set by the Operator, which retrieves the TLS profile from the OpenShift API server. If the cluster has no TLS profile (non-OpenShift, or OpenShift with default/legacy settings), the env vars are simply not set, and PostgreSQL uses its built-in defaults (or whatever the user configured in The enforcement is intentional and mandated. When a cluster administrator configures a TLS profile, it's a cluster-wide compliance requirement and individual components should not be able to weaken it. |
|
I see. To summarize, it means that the only case, when this would be enforced, is if there is an OpenShift TLS profile, but user actively doesn't want to use it. Makes sense to me. Just to clarify about this one:
AFAICT currently the relevant postgresql.conf bits could be overwritten only using overlays in the SecuredClusterCR. Btw, what will happen if one adds |
| ### ROX_TLS_MIN_VERSION: passed to ssl_min_protocol_version (e.g. "TLSv1.2", "TLSv1.3"). | ||
| ### ROX_TLS_OPENSSL_CIPHERS: colon-separated OpenSSL cipher names | ||
| ### (e.g. "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384"). | ||
| ### Only affects TLS 1.2; TLS 1.3 ciphers are not configurable in PostgreSQL 15. |
There was a problem hiding this comment.
Just FYI, they will be configurable in PG18, there is ssl_tls13_ciphers.
There was a problem hiding this comment.
I know, but the current OpenShift design is that ciphers are not being passed at all for TLS 1.3. So it doesn't affect us, for now.
There was a problem hiding this comment.
PG18 will probably be upon us sooner than we think due to other Red Hat/OpenShift requirements. So something to keep in the back of our head.
There was a problem hiding this comment.
Yes, we actually need the ssl_groups setting for another issue (enabling PQC key exchange algos) and that's only available in PG18 right now.
But because Go doesn't allow customizing ciphers when using TLS 1.3, the TLS adherence API from OpenShift doesn't allow ciphers in that case. So for now we're not required to set ciphers when using TLS 1.3.
Good question. Overlays would win, I think. That's already the case with env vars like Anyway, I think it's OK to allow overlays as an escape hatch for overriding TLS settings. |
Description
Follow-up of #19110 for PostgreSQL services.
ROX-32095 requires StackRox components to adhere to the cluster-wide TLS profile configured by the OpenShift API server. The Operator will read this profile and propagate it to all components via environment variables. This PR adds the receiving end for PostgreSQL deployments (
central-dbandscanner-v4-db).I used the
docker-entrypoint.shscripts in order to pass these values directly to PostgreSQL, overriding any setting that might be present inpostgresql.conf(even if this file was overridden by the user).Why env vars + -c flags instead of postgresql.conf: Users can replace postgresql.conf entirely via
configOverride. The-ccommand-line flags have the highest precedence in PostgreSQL, ensuring the cluster-wide TLS profile is enforced regardless of user customizations. When the env vars are not set (non-Operator installs, or clusters without a TLS profile), nothing changes (Postgres uses its defaults, or the values from a user customizedpostgresql.conf).This change does not cover Scanner V2. We will request an exception for TLS settings adherence due to it being deprecated.
More context: design doc, OpenShift enhancement proposal
User-facing documentation
Testing and quality
Automated testing
How I validated my change
Manual tests with various settings (did similar tests for both central-db and scanner-v4-indexer)