Repository navigation
Conversation
Puppet Server's JRuby on a FIPS host cannot load openssl: no FIPS
BouncyCastle jar provides the lightweight-API classes jruby-openssl needs,
so the bare `require 'openssl'` in lib/shared/pe_status_check.rb raised
NameError, aborting the file and leaving the pe_status_check fact undefined
server-side ("cannot load (ext) (org.jruby.ext.openssl.OpenSSL)").
Make the require non-fatal and record the result in
PEStatusCheck.openssl_available?. Availability is tracked by our own
rescue rather than defined?(OpenSSL), because Puppet's openssl_loader
installs stub constants under that name on FIPS JRuby.
When openssl is unavailable, http_get returns false without building an
SSL client, and the cert/CRL expiry chunks (S0005, S0015, S0023, S0025,
AS001, AS004) are skipped. Behaviour on MRI is unchanged.
Root cause analysis: PE-45614.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| false | ||
| end | ||
|
|
||
| OPENSSL_AVAILABLE = load_openssl |
There was a problem hiding this comment.
This is what's breaking acceptance. The shared file gets loaded twice, once from the modulepath and once from the pluginsync cache, so the constant is assigned twice and Ruby warns:
warning: already initialized constant PEStatusCheck::OPENSSL_AVAILABLE
That warning kills the idempotent apply in the exclude list test, and users would see it on agent runs too. Something like this should fix it:
OPENSSL_AVAILABLE = load_openssl unless const_defined?(:OPENSSL_AVAILABLE)
There was a problem hiding this comment.
Good catch, thanks. I reproduced it locally: loading the shared file from two paths emits warning: already initialized constant PEStatusCheck::OPENSSL_AVAILABLE. The old file defined no constants, which is why this never came up before. It also explains the acceptance results: the 4 failures already present on #254 plus 4 new ones here.
Fixed in 68413fa as you suggested: OPENSSL_AVAILABLE = load_openssl unless const_defined?(:OPENSSL_AVAILABLE, false), with a comment explaining the double load. I passed false so the check doesn't pick up a constant of the same name from an ancestor or the top level. I also added a unit spec that loads the shared file a second time and asserts nothing is written to stderr. It fails without the guard and passes with it.
| chunk(:AS001) do | ||
| # Is the hostcert expiring within 90 days | ||
| # | ||
| next unless PEStatusCheck.openssl_available? |
There was a problem hiding this comment.
this file doesn't require the shared lib itself and only works because pe_status_check_role.rb loads it first. Not new, but worth adding require_relative '../shared/pe_status_check' now that we're calling into it more.
There was a problem hiding this comment.
Agreed. Done in 68413fa. agent_status_check.rb now does require_relative '../shared/pe_status_check' straight after require 'puppet', the same way pe_status_check.rb does. I moved the confine { PEStatusCheck.enabled? } below it so the module is defined before that confine runs, rather than relying on load order.
…agent fact The shared file can be loaded twice in one process (from the modulepath and from the pluginsync cache), so re-assigning OPENSSL_AVAILABLE emitted "already initialized constant PEStatusCheck::OPENSSL_AVAILABLE" on agent runs, which broke the idempotent apply in acceptance. Only assign it when it is not already defined, and add a spec that loads the file again. agent_status_check now requires the shared lib itself instead of relying on another fact having loaded it first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Update on CI after 68413fa: the double-load constant warning is gone. All 8 remaining acceptance failures are S0007/S0008 (less than 20% disk free on the Litmus VM, plus |
Summary
On a FIPS PE primary, Puppet Server's JRuby cannot load openssl. The bare
require 'openssl'atlib/shared/pe_status_check.rb:4raisesNameError, the file aborts, and thepe_status_checkfact is never defined server-side:This was reported by a customer on PE 2025.11.3 (JRuby 9.4.12.1). It's not specific to JRuby 10. The full root-cause analysis is in PE-45614.
Changes
PEStatusCheck.load_openssl, which rescuesLoadError/NameError. The result is exposed asPEStatusCheck.openssl_available?.defined?(OpenSSL). On FIPS JRuby, Puppet'sopenssl_loaderinstalls stub constants under that name, so the constant exists even though the crypto doesn't.http_getreturnsfalseearly when openssl is unavailable.S0005,S0015,S0023andS0025(inpe_status_check) andAS001andAS004(inagent_status_check) are skipped.Note for reviewers: when the fact resolves server-side on FIPS, chunks that call
http_get(S0004, S0016, etc.) reportfalse, which is the same as when the HTTP call fails. This follows the proposal in PE-45614. We could skip those chunks instead if that's preferred.Testing
spec/unit/pe_status_check_openssl_spec.rb:NameErrorandLoadError;http_getnot building an SSL client;lib/facterguards, the new specs fail (6 failures). With them, all 27 unit examples pass.rubocop,syntaxandlintare clean.puppetserver.log.Follow-up
pe-modules-vanagon/configs/components/pe_status_check.json(PE-45614).Jira: MODULES-12083, PE-45614
🤖 Generated with Claude Code