File: openssl_loader.rb

package info (click to toggle)
puppet-agent 8.10.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 27,404 kB
  • sloc: ruby: 286,820; sh: 492; xml: 116; makefile: 88; cs: 68
file content (26 lines) | stat: -rw-r--r-- 720 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

require_relative '../../puppet/util/platform'

# This file should be required instead of writing `require 'openssl'`
# or any library that loads openssl like `net/https`. This allows the
# core Puppet code to load correctly in JRuby environments that do not
# have a functioning openssl (eg a FIPS enabled one).

if Puppet::Util::Platform.jruby_fips?
  # Even in JRuby we need to define the constants that are wrapped in
  # Indirections: Puppet::SSL::{Key, Certificate, CertificateRequest}
  module OpenSSL
    module PKey
      class RSA; end
    end

    module X509
      class Request; end
      class Certificate; end
    end
  end
else
  require 'openssl'
  require 'net/https'
end