summaryrefslogtreecommitdiffstats
path: root/lib/puppet/ssl
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-09-18 12:54:03 -0700
committerJames Turnbull <james@lovedthanlost.net>2009-11-20 07:27:21 +1100
commit2d137e2e1ce603ee2727d66b1aba57458bf4d1be (patch)
tree44660e699774dd54a6c721cac514cf41a2a543c9 /lib/puppet/ssl
parent089ac3e37dd1418751bc4dfe152e09fbacbc5122 (diff)
downloadpuppet-2d137e2e1ce603ee2727d66b1aba57458bf4d1be.tar.gz
puppet-2d137e2e1ce603ee2727d66b1aba57458bf4d1be.tar.xz
puppet-2d137e2e1ce603ee2727d66b1aba57458bf4d1be.zip
Fixing #1507 - Adding a :ca_name setting
This allows one to specify the name to use in the CA certificate. It defaults to the :certname, but for those stuck using mod_ssl it can be changed. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet/ssl')
-rw-r--r--lib/puppet/ssl/certificate_request.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/puppet/ssl/certificate_request.rb b/lib/puppet/ssl/certificate_request.rb
index 6a0464a33..4008ababe 100644
--- a/lib/puppet/ssl/certificate_request.rb
+++ b/lib/puppet/ssl/certificate_request.rb
@@ -29,9 +29,14 @@ class Puppet::SSL::CertificateRequest < Puppet::SSL::Base
# Support either an actual SSL key, or a Puppet key.
key = key.content if key.is_a?(Puppet::SSL::Key)
+ # If we're a CSR for the CA, then use the real certname, rather than the
+ # fake 'ca' name. This is mostly for backward compatibility with 0.24.x,
+ # but it's also just a good idea.
+ common_name = name == Puppet::SSL::CA_NAME ? Puppet.settings[:ca_name] : name
+
csr = OpenSSL::X509::Request.new
csr.version = 0
- csr.subject = OpenSSL::X509::Name.new([["CN", name]])
+ csr.subject = OpenSSL::X509::Name.new([["CN", common_name]])
csr.public_key = key.public_key
csr.sign(key, OpenSSL::Digest::MD5.new)