summaryrefslogtreecommitdiffstats
path: root/lib/puppet/ssl/inventory.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-04-19 14:50:18 -0500
committerLuke Kanies <luke@madstop.com>2008-04-19 14:50:18 -0500
commit809fc77bc767fb3acabc83d55183686200b1e384 (patch)
tree26f0fa4954f693168f7f366c5ea8653531de3ac6 /lib/puppet/ssl/inventory.rb
parent16056a24c65a7c6485b65f15700ff3971781031b (diff)
downloadpuppet-809fc77bc767fb3acabc83d55183686200b1e384.tar.gz
puppet-809fc77bc767fb3acabc83d55183686200b1e384.tar.xz
puppet-809fc77bc767fb3acabc83d55183686200b1e384.zip
Finishing the interface between the CA and the CRL.
Certificate revocation now works, the CA knows how to generate the CRL, and the SSL::Host class knows how to configure the CRL class for indirection.
Diffstat (limited to 'lib/puppet/ssl/inventory.rb')
-rw-r--r--lib/puppet/ssl/inventory.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/puppet/ssl/inventory.rb b/lib/puppet/ssl/inventory.rb
index 3b32b6d7b..38cbf46e9 100644
--- a/lib/puppet/ssl/inventory.rb
+++ b/lib/puppet/ssl/inventory.rb
@@ -38,4 +38,15 @@ class Puppet::SSL::Inventory
Puppet::SSL::Certificate.search("*").each { |cert| add(cert) }
end
+
+ # Find the serial number for a given certificate.
+ def serial(name)
+ return nil unless FileTest.exist?(@path)
+
+ File.readlines(@path).each do |line|
+ next unless line =~ /^(\S+).+\/CN=#{name}$/
+
+ return Integer($1)
+ end
+ end
end