Skip to content

Commit 0392b3b

Browse files
committed
(PUP-11471) Make using default path an option of create_x509_store
OpenSSL::X509::Store are created by #create_x509_store. The store is often kept as is but in the context of #create_system_context it is modified to also include system certificates. In order to add support for system certificates to more SSL Contexts, add a parameter to include or not the system's certificates. No functional change.
1 parent 8f5e224 commit 0392b3b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/puppet/ssl/ssl_provider.rb

+4-3
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ def create_root_context(cacerts:, crls: [], revocation: Puppet[:certificate_revo
5151
# @raise (see #create_context)
5252
# @api private
5353
def create_system_context(cacerts:, path: Puppet[:ssl_trust_store])
54-
store = create_x509_store(cacerts, [], false)
55-
store.set_default_paths
54+
store = create_x509_store(cacerts, [], false, include_system_store: true)
5655

5756
if path
5857
stat = Puppet::FileSystem.stat(path)
@@ -186,14 +185,16 @@ def default_flags
186185
end
187186
end
188187

189-
def create_x509_store(roots, crls, revocation)
188+
def create_x509_store(roots, crls, revocation, include_system_store: false)
190189
store = OpenSSL::X509::Store.new
191190
store.purpose = OpenSSL::X509::PURPOSE_ANY
192191
store.flags = default_flags | revocation_mode(revocation)
193192

194193
roots.each { |cert| store.add_cert(cert) }
195194
crls.each { |crl| store.add_crl(crl) }
196195

196+
store.set_default_paths if include_system_store
197+
197198
store
198199
end
199200

0 commit comments

Comments
 (0)