diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-08-28 02:27:17 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-08-28 02:27:17 +0000 |
commit | ed1547112dcffe712605e1985c287d252788582c (patch) | |
tree | ec52c11ace6c5f7a9372040d4c08a8372da48868 /lib/puppet | |
parent | 55d3fb8360bff73711f3d4bf9286fb380a1b2d61 (diff) | |
download | puppet-ed1547112dcffe712605e1985c287d252788582c.tar.gz puppet-ed1547112dcffe712605e1985c287d252788582c.tar.xz puppet-ed1547112dcffe712605e1985c287d252788582c.zip |
Fixing #231.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1491 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet')
-rwxr-xr-x | lib/puppet/daemon.rb | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/lib/puppet/daemon.rb b/lib/puppet/daemon.rb index a4594eb7f..79241deb6 100755 --- a/lib/puppet/daemon.rb +++ b/lib/puppet/daemon.rb @@ -98,10 +98,14 @@ module Puppet # we are not going to encrypt our key, but we need at a minimum # a keyfile and a certfile - @certfile = File.join(Puppet[:certdir], [@fqdn, "pem"].join(".")) - @cacertfile = File.join(Puppet[:certdir], ["ca", "pem"].join(".")) - @keyfile = File.join(Puppet[:privatekeydir], [@fqdn, "pem"].join(".")) - @publickeyfile = File.join(Puppet[:publickeydir], [@fqdn, "pem"].join(".")) + #@certfile = File.join(Puppet[:certdir], [@fqdn, "pem"].join(".")) + #@cacertfile = File.join(Puppet[:certdir], ["ca", "pem"].join(".")) + #@keyfile = File.join(Puppet[:privatekeydir], [@fqdn, "pem"].join(".")) + #@publickeyfile = File.join(Puppet[:publickeydir], [@fqdn, "pem"].join(".")) + @certfile = Puppet[:hostcert] + @cacertfile = Puppet[:localcacert] + @keyfile = Puppet[:hostprivkey] + @publickeyfile = Puppet[:hostpubkey] if File.exists?(@keyfile) # load the key @@ -151,10 +155,14 @@ module Puppet # create a new one and store it Puppet.info "Creating a new SSL key at %s" % @keyfile @key = OpenSSL::PKey::RSA.new(Puppet[:keylength]) - File.open(@keyfile, "w", 0660) { |f| f.print @key.to_pem } - File.open(@publickeyfile, "w", 0660) { |f| + Puppet.config.write(:hostprivkey) do |f| f.print @key.to_pem end + Puppet.config.write(:hostpubkey) do |f| f.print @key.public_key.to_pem - } + end + #File.open(@keyfile, "w", 0660) { |f| f.print @key.to_pem } + #File.open(@publickeyfile, "w", 0660) { |f| + # f.print @key.public_key.to_pem + #} end @@ -207,8 +215,10 @@ module Puppet if cert.nil? or cert == "" return nil end - File.open(@certfile, "w", 0644) { |f| f.print cert } - File.open(@cacertfile, "w", 0644) { |f| f.print cacert } + Puppet.config.write(:hostcert) do |f| f.print cert end + Puppet.config.write(:localcacert) do |f| f.print cacert end + #File.open(@certfile, "w", 0644) { |f| f.print cert } + #File.open(@cacertfile, "w", 0644) { |f| f.print cacert } begin @cert = OpenSSL::X509::Certificate.new(cert) @cacert = OpenSSL::X509::Certificate.new(cacert) |