summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-08-07 17:38:26 -0700
committerLuke Kanies <luke@madstop.com>2008-08-07 17:38:26 -0700
commit2cad30a18c5e0e4fb93603ab422c290a62d45131 (patch)
tree253eba019e8b55e7688aeb0df01edfd6f8440291 /lib
parent93fd55fdaa409020f18001ac436ddad9b6c491e4 (diff)
downloadpuppet-2cad30a18c5e0e4fb93603ab422c290a62d45131.tar.gz
puppet-2cad30a18c5e0e4fb93603ab422c290a62d45131.tar.xz
puppet-2cad30a18c5e0e4fb93603ab422c290a62d45131.zip
Caching the SSL store for the SSL Host.
We were creating a new SSL store every time, which caused problems during testing -- it created an infinite loop when trying to create the store while looking up the CRL. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/ssl/host.rb19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/puppet/ssl/host.rb b/lib/puppet/ssl/host.rb
index 6bbd93853..a449dcc7e 100644
--- a/lib/puppet/ssl/host.rb
+++ b/lib/puppet/ssl/host.rb
@@ -168,17 +168,20 @@ class Puppet::SSL::Host
# Create/return a store that uses our SSL info to validate
# connections.
def ssl_store(purpose = OpenSSL::X509::PURPOSE_ANY)
- store = OpenSSL::X509::Store.new
- store.purpose = purpose
+ unless defined?(@ssl_store) and @ssl_store
+ @ssl_store = OpenSSL::X509::Store.new
+ @ssl_store.purpose = purpose
- store.add_file(Puppet[:localcacert])
+ @ssl_store.add_file(Puppet[:localcacert])
- # If there's a CRL, add it to our store.
- if crl = Puppet::SSL::CertificateRevocationList.find("ca")
- store.flags = OpenSSL::X509::V_FLAG_CRL_CHECK_ALL|OpenSSL::X509::V_FLAG_CRL_CHECK
- store.add_crl(crl.content)
+ # If there's a CRL, add it to our store.
+ if crl = Puppet::SSL::CertificateRevocationList.find("ca")
+ @ssl_store.flags = OpenSSL::X509::V_FLAG_CRL_CHECK_ALL|OpenSSL::X509::V_FLAG_CRL_CHECK
+ @ssl_store.add_crl(crl.content)
+ end
+ return @ssl_store
end
- return store
+ @ssl_store
end
# Attempt to retrieve a cert, if we don't already have one.