summaryrefslogtreecommitdiffstats
path: root/lib/puppet
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
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')
-rw-r--r--lib/puppet/defaults.rb1
-rw-r--r--lib/puppet/ssl/certificate_request.rb7
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb
index 4924f2ced..ef194bc31 100644
--- a/lib/puppet/defaults.rb
+++ b/lib/puppet/defaults.rb
@@ -284,6 +284,7 @@ module Puppet
)
setdefaults(:ca,
+ :ca_name => ["$certname", "The name to use the Certificate Authority certificate."],
:cadir => { :default => "$ssldir/ca",
:owner => "service",
:group => "service",
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)