Merge branch 'hostkey_type' into 'master'

Hostkey type

This is the pull request associated with: https://labs.riseup.net/code/issues/8285

See merge request !6
This commit is contained in:
Antoine Beaupré 2015-04-17 18:43:16 +00:00
commit d4923b2c3a
12 changed files with 41 additions and 21 deletions

View file

@ -0,0 +1,5 @@
Facter.add("ssh_version") do
setcode do
ssh_version = Facter::Util::Resolution.exec('ssh -V 2>&1 1>/dev/null').chomp.split(' ')[0].split('_')[1]
end
end

View file

@ -27,3 +27,4 @@ Puppet::Parser::Functions::newfunction(:ssh_keygen, :type => :rvalue, :doc =>
end
[File.read(private_key_path),File.read(public_key_path)]
end

View file

@ -49,6 +49,10 @@ class sshd(
$shorewall_source = 'net',
$sshkey_ipaddress = $::ipaddress,
$manage_client = true,
$hostkey_type = versioncmp($::ssh_version, '6.5') ? {
/(^1|0)/ => [ 'rsa', 'ed25519' ],
/-1/ => [ 'rsa', 'dsa' ]
}
) {
validate_bool($manage_shorewall)

View file

@ -35,9 +35,9 @@ ListenAddress <%= address %>
# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
<% scope.lookupvar('sshd::hostkey_type').to_a.each do |hostkey_type| -%>
HostKey /etc/ssh/ssh_host_<%=hostkey_type %>_key
<% end -%>
# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h

View file

@ -20,6 +20,10 @@ ListenAddress <%= address %>
<% end -%>
Protocol 2
# HostKeys for protocol version 2
<% scope.lookupvar('sshd::hostkey_type').to_a.each do |hostkey_type| -%>
HostKey /etc/ssh/ssh_host_<%=hostkey_type %>_key
<% end -%>
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security

View file

@ -22,10 +22,9 @@ ListenAddress <%= address %>
<% end -%>
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
<% scope.lookupvar('sshd::hostkey_type').to_a.each do |hostkey_type| -%>
HostKey /etc/ssh/ssh_host_<%=hostkey_type %>_key
<% end -%>
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

View file

@ -22,10 +22,9 @@ ListenAddress <%= address %>
<% end -%>
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
<% scope.lookupvar('sshd::hostkey_type').to_a.each do |hostkey_type| -%>
HostKey /etc/ssh/ssh_host_<%=hostkey_type %>_key
<% end -%>
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

View file

@ -22,8 +22,10 @@ ListenAddress <%= address %>
<% end -%>
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
<% scope.lookupvar('sshd::hostkey_type').to_a.each do |hostkey_type| -%>
HostKey /etc/ssh/ssh_host_<%=hostkey_type %>_key
<% end -%>
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

View file

@ -22,8 +22,9 @@ ListenAddress <%= address %>
<% end -%>
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
<% scope.lookupvar('sshd::hostkey_type').to_a.each do |hostkey_type| -%>
HostKey /etc/ssh/ssh_host_<%=hostkey_type %>_key
<% end -%>
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

View file

@ -40,8 +40,9 @@ Protocol 2
# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
<% scope.lookupvar('sshd::hostkey_type').to_a.each do |hostkey_type| -%>
HostKey /etc/ssh/ssh_host_<%=hostkey_type %>_key
<% end -%>
# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h

View file

@ -22,8 +22,10 @@ ListenAddress <%= address %>
<% end -%>
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
<% scope.lookupvar('sshd::hostkey_type').to_a.each do |hostkey_type| -%>
HostKey /etc/ssh/ssh_host_<%=hostkey_type %>_key
<% end -%>
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

View file

@ -20,8 +20,10 @@ ListenAddress <%= address %>
<% end -%>
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
<% scope.lookupvar('sshd::hostkey_type').to_a.each do |hostkey_type| -%>
HostKey /etc/ssh/ssh_host_<%=hostkey_type %>_key
<% end -%>
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes