2014-03-14 10:35:02 +01:00
|
|
|
class sshd::base {
|
2013-02-03 00:30:54 +01:00
|
|
|
|
|
|
|
$sshd_config_content = $::lsbdistcodename ? {
|
|
|
|
'' => template("sshd/sshd_config/${::operatingsystem}.erb"),
|
|
|
|
default => template ("sshd/sshd_config/${::operatingsystem}_${::lsbdistcodename}.erb"),
|
|
|
|
}
|
|
|
|
|
2009-12-10 23:15:07 +01:00
|
|
|
file { 'sshd_config':
|
2014-01-26 11:19:11 +01:00
|
|
|
ensure => present,
|
2013-02-03 00:30:54 +01:00
|
|
|
path => '/etc/ssh/sshd_config',
|
|
|
|
content => $sshd_config_content,
|
|
|
|
notify => Service[sshd],
|
|
|
|
owner => root,
|
|
|
|
group => 0,
|
|
|
|
mode => '0600';
|
2009-12-10 23:15:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# Now add the key, if we've got one
|
2012-06-05 23:23:03 +02:00
|
|
|
case $::sshrsakey {
|
|
|
|
'': { info("no sshrsakey on ${::fqdn}") }
|
2009-12-10 23:15:07 +01:00
|
|
|
default: {
|
2012-06-05 23:23:03 +02:00
|
|
|
@@sshkey{$::fqdn:
|
2013-02-03 00:30:54 +01:00
|
|
|
ensure => present,
|
|
|
|
tag => 'fqdn',
|
2009-12-27 17:23:51 +01:00
|
|
|
type => ssh-rsa,
|
2012-06-05 23:23:03 +02:00
|
|
|
key => $::sshrsakey,
|
2009-12-10 23:15:07 +01:00
|
|
|
}
|
2010-01-31 00:32:12 +01:00
|
|
|
# In case the node has uses a shared network address,
|
2009-12-27 17:23:51 +01:00
|
|
|
# we don't define a sshkey resource using an IP address
|
2013-02-03 00:30:54 +01:00
|
|
|
if $sshd::shared_ip == 'no' {
|
2014-02-21 14:37:55 +01:00
|
|
|
@@sshkey{$sshkey_ipaddress:
|
2013-02-03 00:30:54 +01:00
|
|
|
ensure => present,
|
|
|
|
tag => 'ipaddress',
|
2009-12-27 17:23:51 +01:00
|
|
|
type => ssh-rsa,
|
2012-06-05 23:23:03 +02:00
|
|
|
key => $::sshrsakey,
|
2009-12-27 17:23:51 +01:00
|
|
|
}
|
2009-12-10 23:15:07 +01:00
|
|
|
}
|
2009-09-29 19:53:04 +02:00
|
|
|
}
|
2009-12-10 23:15:07 +01:00
|
|
|
}
|
|
|
|
service{'sshd':
|
2013-02-03 00:30:54 +01:00
|
|
|
ensure => running,
|
|
|
|
name => 'sshd',
|
|
|
|
enable => true,
|
2009-12-10 23:15:07 +01:00
|
|
|
hasstatus => true,
|
2013-02-03 00:30:54 +01:00
|
|
|
require => File[sshd_config],
|
2009-12-10 23:15:07 +01:00
|
|
|
}
|
2009-09-29 19:53:04 +02:00
|
|
|
}
|