Skip to content

Commit 666e575

Browse files
committed
Fixes #36755 - Send full certificate chain to clients
Add option SSLExtraChainCert to the Webrick webserver, so the full certificate chain is sent to clients during the SSL handkshake.
1 parent 06092bb commit 666e575

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/launcher.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ def https_plugins
3838
plugins.select { |p| p[:https_enabled] }.map { |p| p[:class] }
3939
end
4040

41+
def load_fullchain(bundle_pem)
42+
File.read(bundle_pem)
43+
.lines
44+
.slice_after(/END CERTIFICATE/)
45+
.map { |pem| OpenSSL::X509::Certificate.new(pem.join) }
46+
end
47+
4148
def http_app(http_port, plugins = http_plugins)
4249
return nil unless http_enabled?
4350
app = Rack::Builder.new do
@@ -62,6 +69,10 @@ def https_app(https_port, plugins = https_plugins)
6269
logger.error "Unable to read #{settings.ssl_ca_file}. Are the values correct in settings.yml and do permissions allow reading?"
6370
end
6471

72+
unless File.readable?(settings.foreman_ssl_ca)
73+
logger.error "Unable to read #{settings.foreman_ssl_ca}. Are the values correct in settings.yml and do permissions allow reading?"
74+
end
75+
6576
app = Rack::Builder.new do
6677
plugins.each { |p| instance_eval(p.https_rackup) }
6778
end
@@ -95,6 +106,7 @@ def https_app(https_port, plugins = https_plugins)
95106
:SSLVerifyClient => OpenSSL::SSL::VERIFY_PEER,
96107
:SSLPrivateKey => load_ssl_private_key(settings.ssl_private_key),
97108
:SSLCertificate => load_ssl_certificate(settings.ssl_certificate),
109+
:SSLExtraChainCert => load_fullchain(settings.foreman_ssl_ca),
98110
:SSLCACertificateFile => settings.ssl_ca_file,
99111
:SSLOptions => ssl_options,
100112
:SSLCiphers => CIPHERS - Proxy::SETTINGS.ssl_disabled_ciphers,

0 commit comments

Comments
 (0)