diff options
author | ng <ng+gitlab@immerda.ch> | 2015-01-17 09:52:07 +0000 |
---|---|---|
committer | ng <ng+gitlab@immerda.ch> | 2015-01-17 09:52:07 +0000 |
commit | 2d6433e0ca548d0bf083904fbfc5a95ae49c4029 (patch) | |
tree | 88e09fcd60322f3a60a0ebd29c866fa5242e228c | |
parent | ae9cf81188a0fb4f14a519c1ca97ed8f9789abd4 (diff) | |
parent | 1e4f46a35b666980de6f55da121dc455b70d80bb (diff) | |
download | puppet-sshd-2d6433e0ca548d0bf083904fbfc5a95ae49c4029.tar.gz puppet-sshd-2d6433e0ca548d0bf083904fbfc5a95ae49c4029.tar.bz2 |
Merge branch 'master' into 'master'
Fix for Debian squeeze and ssh_keygen for Puppet < 3 installs
Facter versions that are shipping in Debian squeeze and wheezy do not support the operatingsystemmajrelease core fact, which appears only from facter 1.7 onwards.
This isn't a big problem for wheezy since the openssh-server version it ships supports multiple AuthorizedKeysFile file paths,
On Debian squeeze, openssh-server does NOT support multuple AuthorizedKeysFile and will refuse to start with such a definition.
ALSO:
`ssh_keygen` is currently broken for Puppet 2.7.x clients. This commit should resolve the issue.
The fix was suggested by @ng in reference to https://github.com/duritong/puppet-sysctl/blob/master/lib/puppet/provider/sysctl_runtime/sysctl_runtime.rb#L16-L17
See merge request !3
-rw-r--r-- | lib/puppet/parser/functions/ssh_keygen.rb | 3 | ||||
-rw-r--r-- | manifests/init.pp | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/puppet/parser/functions/ssh_keygen.rb b/lib/puppet/parser/functions/ssh_keygen.rb index b732b87..87a3452 100644 --- a/lib/puppet/parser/functions/ssh_keygen.rb +++ b/lib/puppet/parser/functions/ssh_keygen.rb @@ -19,7 +19,8 @@ Puppet::Parser::Functions::newfunction(:ssh_keygen, :type => :rvalue, :doc => FileUtils.mkdir_p(dir, :mode => 0700) end unless [private_key_path,public_key_path].all?{|path| File.exists?(path) } - output = Puppet::Util::Execution.execute( + executor = (Facter.value(:puppetversion).to_i < 3) ? Puppet::Util : Puppet::Util::Execution + output = executor.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/manifests/init.pp b/manifests/init.pp index 5a38293..666b5ac 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -28,7 +28,7 @@ class sshd( $hostbased_authentication = 'no', $permit_empty_passwords = 'no', $authorized_keys_file = $::osfamily ? { - Debian => $::operatingsystemmajrelease ? { + Debian => $::lsbmajdistrelease ? { 6 => '%h/.ssh/authorized_keys', default => '%h/.ssh/authorized_keys %h/.ssh/authorized_keys2', }, |