diff options
-rw-r--r-- | lib/puppet/parser/functions/ssh_keygen.rb | 5 | ||||
-rw-r--r-- | spec/unit/parser/functions/ssh_keygen.rb | 2 | ||||
-rw-r--r-- | templates/sshd_config/OpenBSD.erb | 2 |
3 files changed, 6 insertions, 3 deletions
diff --git a/lib/puppet/parser/functions/ssh_keygen.rb b/lib/puppet/parser/functions/ssh_keygen.rb index 09b3d3b..597315e 100644 --- a/lib/puppet/parser/functions/ssh_keygen.rb +++ b/lib/puppet/parser/functions/ssh_keygen.rb @@ -14,7 +14,10 @@ Puppet::Parser::Functions::newfunction(:ssh_keygen, :type => :rvalue, :doc => end dir = File.dirname(private_key_path) - Puppet::Util.recmkdir(dir,0700) unless File.directory?(dir) + unless File.directory?(dir) + require 'fileutils' + FileUtils.mkdir_p(dir, :mode => 0700) + end unless [private_key_path,public_key_path].all?{|path| File.exists?(path) } output = Puppet::Util.execute(['/usr/bin/ssh-keygen','-t', 'rsa', '-b', '4096', '-f', private_key_path, '-P', '', '-q']) raise Puppet::ParseError, "Something went wrong during key generation! Output: #{output}" unless output.empty? diff --git a/spec/unit/parser/functions/ssh_keygen.rb b/spec/unit/parser/functions/ssh_keygen.rb index f830065..da45779 100644 --- a/spec/unit/parser/functions/ssh_keygen.rb +++ b/spec/unit/parser/functions/ssh_keygen.rb @@ -74,7 +74,7 @@ describe "the ssh_keygen function" do File.stubs(:exists?).with("/tmp/a/b/c").returns(false) File.stubs(:exists?).with("/tmp/a/b/c.pub").returns(false) File.stubs(:directory?).with("/tmp/a/b").returns(false) - Puppet::Util.expects(:recmkdir).with("/tmp/a/b",0700) + FileUtils.expects(:mkdir_p).with("/tmp/a/b", :mode => 0700) Puppet::Util.expects(:execute).returns("") result = @scope.function_ssh_keygen('/tmp/a/b/c') result.length.should == 2 diff --git a/templates/sshd_config/OpenBSD.erb b/templates/sshd_config/OpenBSD.erb index 6b474d7..fd5bb17 100644 --- a/templates/sshd_config/OpenBSD.erb +++ b/templates/sshd_config/OpenBSD.erb @@ -95,7 +95,7 @@ AllowTcpForwarding <%= scope.lookupvar('sshd::tcp_forwarding') %> X11Forwarding <%= scope.lookupvar('sshd::x11_forwarding') %> #X11DisplayOffset 10 #X11UseLocalhost yes -PrintMotd <%= sshd_print_motd %> +PrintMotd <%= scope.lookupvar('sshd::sshd_print_motd') %> #PrintLastLog yes #TCPKeepAlive yes #UseLogin no |