diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-04-19 15:35:04 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-04-19 15:35:04 +0000 |
commit | d2634baa0ec8dc00170bd54bea25f526c8a7ed97 (patch) | |
tree | d5c265653d3dfd7071708e458435292dd90212b1 | |
parent | 449f6626904cbf4165a3e481e8b9c7433be997d8 (diff) | |
download | puppet-d2634baa0ec8dc00170bd54bea25f526c8a7ed97.tar.gz |
Fixing #118; the hash is now always 8 hex characters, 0-padded. Also changed the CA cert name to the FQDN of the host serving the CA, rather than "CAcert".
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1117 980ebf18-57e1-0310-9a29-db15c13687c0
-rwxr-xr-x | lib/puppet/sslcertificates.rb | 4 | ||||
-rw-r--r-- | lib/puppet/sslcertificates/ca.rb | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/puppet/sslcertificates.rb b/lib/puppet/sslcertificates.rb index a56e64add..a003c6551 100755 --- a/lib/puppet/sslcertificates.rb +++ b/lib/puppet/sslcertificates.rb @@ -124,7 +124,8 @@ module Puppet::SSLCertificates end def self.mkhash(dir, cert, certfile) - hash = "%x" % cert.issuer.hash + # Make sure the hash is zero-padded to 8 chars + hash = "%08x" % cert.issuer.hash hashpath = nil 10.times { |i| path = File.join(dir, "%s.%s" % [hash, i]) @@ -149,6 +150,7 @@ module Puppet::SSLCertificates break } + return hashpath end require 'puppet/sslcertificates/certificate' diff --git a/lib/puppet/sslcertificates/ca.rb b/lib/puppet/sslcertificates/ca.rb index 04d950e21..aacf3352c 100644 --- a/lib/puppet/sslcertificates/ca.rb +++ b/lib/puppet/sslcertificates/ca.rb @@ -177,8 +177,13 @@ class Puppet::SSLCertificates::CA # Create the root certificate. def mkrootcert + # Make the root cert's name the FQDN of the host running the CA. + name = Facter["hostname"].value + if domain = Facter["domain"].value + name += "." + domain + end cert = Certificate.new( - :name => "CAcert", + :name => name, :cert => @config[:cacert], :encrypt => @config[:capass], :key => @config[:cakey], |