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
This commit is contained in:
ng 2015-01-17 09:52:07 +00:00
commit 2d6433e0ca
2 changed files with 3 additions and 2 deletions

View file

@ -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?

View file

@ -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',
},