Fixes #39518 - Fall back safely when tls_ciphers 'PROFILE=SYSTEM' is unsupported - #953
Draft
ogajduse wants to merge 1 commit into
Draft
Conversation
…unsupported resolve_tls_ciphers previously trusted the presence of /etc/crypto-policies/back-ends/opensslcnf.config alone to mean the 'PROFILE=SYSTEM' cipher-list alias would work, but that alias is a Red Hat/Fedora OpenSSL patch. On a nominally-RHEL host whose Ruby links a vendored, non-RHEL-patched OpenSSL (e.g. rbenv/ruby-build compiling openssl-1.1.1w for Ruby 3.0.4 on CentOS Stream 9), SSL_CTX_set_cipher_list rejects it outright and the server fails to start. Probe 'PROFILE=SYSTEM' before committing to it. If unsupported, parse and use the CipherString already resolved in opensslcnf.config directly (plain, portable OpenSSL syntax, not RHEL-specific) to preserve the active crypto policy's intent. Fall back to 'HIGH' only if that also fails, so the auto-detected default can never crash startup.
Contributor
|
When discussing #947 - and we discussed it a lot - there seemed to be a prevailing opinion that a RHEL system where Foreman can't use |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
resolve_tls_ciphers(added in #947 / #39405) defaultstls_ciphersto the literal string'PROFILE=SYSTEM'whenever/etc/crypto-policies/back-ends/opensslcnf.configexists, on the assumption that presence of that file means the currently-linked OpenSSL understandsPROFILE=SYSTEM(a Red Hat/Fedora-only OpenSSL patch keyword).This breaks on a nominally-RHEL host whose Ruby is linked against a vendored, non-RHEL-patched OpenSSL. Concretely:
smart-proxy-develop-source-release'sruby=3.0.4CI leg runs on RHEL/CentOS Stream 9 (crypto-policies present, correctly detected), butrbenv/ruby-buildvendors a plainopenssl-1.1.1wbuilt fromopenssl.orgsource for that specific Ruby version (itsneeds_opensslgate requires1.0.1-1.x.x; CentOS9's system OpenSSL 3.5.x falls outside that range). That vendored OpenSSL rejects'PROFILE=SYSTEM'outright:...and the proxy never starts. Reproduced this exact failure directly by compiling
openssl-1.1.1wfrom source in a realcentos:stream9container and confirming the byte-identical error. Full root-cause writeup: https://projects.theforeman.org/issues/39518Fix
opensslcnf.configisn't just a "RHEL detected" signal file — it contains the actual resolved cipher spec in plain, portable OpenSSL syntax (CipherString = @SECLEVEL=2:kEECDH:...), independent of thePROFILE=keyword.resolve_tls_ciphersnow:'PROFILE=SYSTEM'before committing to it (via a liveOpenSSL::SSL::SSLContext#ciphers=check).CipherStringfromopensslcnf.configdirectly — same security intent as the active crypto policy, but works on any OpenSSL build.'HIGH'only if that also fails, so the auto-detected default can never crash startup.validate_tls_ciphers!is refactored to share the same probe helper (cipher_string_supported?) — pure dedup, no behavior change for explicitly-configuredtls_ciphersvalues.Testing
bundle exec rake test TEST=test/launcher_test.rb— 25/25 pass, including 3 new tests covering the fallback chain.bundle exec rake test, excludingbmc/libvirtmodules which need unrelated native system libs) — 872/872 pass.PROFILE=SYSTEMis also rejected by the local OpenSSL build:resolve_tls_cipherscorrectly falls through to the parsedCipherStringinstead of returning an unusable value.Marked as draft pending maintainer input — opening for early visibility/feedback.