@@ -38,6 +38,14 @@ def https_plugins
3838 plugins . select { |p | p [ :https_enabled ] } . map { |p | p [ :class ] }
3939 end
4040
41+ # Imitate OpenSSL::X509::Certificate.load_file for openssl < 3.0.0
42+ def load_fullchain ( bundle_pem )
43+ File . read ( bundle_pem )
44+ . lines
45+ . slice_after ( /END CERTIFICATE/ )
46+ . map { |pem | OpenSSL ::X509 ::Certificate . new ( pem . join ) }
47+ end
48+
4149 def http_app ( http_port , plugins = http_plugins )
4250 return nil unless http_enabled?
4351 app = Rack ::Builder . new do
@@ -62,6 +70,10 @@ def https_app(https_port, plugins = https_plugins)
6270 logger . error "Unable to read #{ settings . ssl_ca_file } . Are the values correct in settings.yml and do permissions allow reading?"
6371 end
6472
73+ unless File . readable? ( settings . foreman_ssl_ca )
74+ logger . error "Unable to read #{ settings . foreman_ssl_ca } . Are the values correct in settings.yml and do permissions allow reading?"
75+ end
76+
6577 app = Rack ::Builder . new do
6678 plugins . each { |p | instance_eval ( p . https_rackup ) }
6779 end
@@ -95,6 +107,7 @@ def https_app(https_port, plugins = https_plugins)
95107 :SSLVerifyClient => OpenSSL ::SSL ::VERIFY_PEER ,
96108 :SSLPrivateKey => load_ssl_private_key ( settings . ssl_private_key ) ,
97109 :SSLCertificate => load_ssl_certificate ( settings . ssl_certificate ) ,
110+ :SSLExtraChainCert => load_fullchain ( settings . foreman_ssl_ca ) ,
98111 :SSLCACertificateFile => settings . ssl_ca_file ,
99112 :SSLOptions => ssl_options ,
100113 :SSLCiphers => CIPHERS - Proxy ::SETTINGS . ssl_disabled_ciphers ,
0 commit comments