class sshd::base {
+
+ $sshd_config_content = $::lsbdistcodename ? {
+ '' => template("sshd/sshd_config/${::operatingsystem}.erb"),
+ default => template ("sshd/sshd_config/${::operatingsystem}_${::lsbdistcodename}.erb"),
+ }
+
file { 'sshd_config':
- path => '/etc/ssh/sshd_config',
- content => $::lsbdistcodename ? {
- '' => template("sshd/sshd_config/${::operatingsystem}.erb"),
- default => template ("sshd/sshd_config/${::operatingsystem}_${::lsbdistcodename}.erb"),
- },
- notify => Service[sshd],
- owner => root, group => 0, mode => 600;
+ path => '/etc/ssh/sshd_config',
+ content => $sshd_config_content,
+ notify => Service[sshd],
+ owner => root,
+ group => 0,
+ mode => '0600';
}
# Now add the key, if we've got one
'': { info("no sshrsakey on ${::fqdn}") }
default: {
@@sshkey{$::fqdn:
- tag => "fqdn",
+ ensure => present,
+ tag => 'fqdn',
type => ssh-rsa,
key => $::sshrsakey,
- ensure => present,
}
# In case the node has uses a shared network address,
# we don't define a sshkey resource using an IP address
- if $sshd::shared_ip == "no" {
+ if $sshd::shared_ip == 'no' {
@@sshkey{$::ipaddress:
- tag => "ipaddress",
+ ensure => present,
+ tag => 'ipaddress',
type => ssh-rsa,
key => $::sshrsakey,
- ensure => present,
}
}
}
}
service{'sshd':
- name => 'sshd',
- enable => true,
- ensure => running,
+ ensure => running,
+ name => 'sshd',
+ enable => true,
hasstatus => true,
- require => File[sshd_config],
+ require => File[sshd_config],
}
}
class sshd::client::base {
# this is needed because the gid might have changed
file { '/etc/ssh/ssh_known_hosts':
- mode => 0644, owner => root, group => 0;
+ mode => '0644',
+ owner => root,
+ group => 0;
}
# Now collect all server keys
case $sshd::client::shared_ip {
no: { Sshkey <<||>> }
- yes: { Sshkey <<| tag == "fqdn" |>> }
+ yes: { Sshkey <<| tag == fqdn |>> }
}
}
}
$sshd_restartandstatus = $::lsbdistcodename ? {
- etch => false,
+ etch => false,
default => true
}
Service[sshd]{
- name => 'ssh',
- pattern => 'sshd',
- hasstatus => $sshd_restartandstatus,
+ name => 'ssh',
+ pattern => 'sshd',
+ hasstatus => $sshd_restartandstatus,
hasrestart => $sshd_restartandstatus,
}
}
) {
class{'sshd::client':
- shared_ip => $sshd::shared_ip,
- ensure_version => $sshd::ensure_version,
+ shared_ip => $sshd::shared_ip,
+ ensure_version => $sshd::ensure_version,
manage_shorewall => $manage_shorewall,
}
if $manage_shorewall {
class{'shorewall::rules::ssh':
- ports => $ports,
+ ports => $ports,
source => $shorewall_source
}
}
class sshd::linux inherits sshd::base {
- package{openssh:
+ package{'openssh':
ensure => $sshd::ensure_version,
}
File[sshd_config]{
) {
$real_port = $port ? {
'absent' => $name,
- default => $port,
+ default => $port,
}
case $check_hostname {
'absent': {
nagios::service{"ssh_port_${name}":
- ensure => $ensure,
+ ensure => $ensure,
check_command => "check_ssh_port!${real_port}"
}
}
default: {
nagios::service{"ssh_port_host_${name}":
- ensure => $ensure,
+ ensure => $ensure,
check_command => "check_ssh_port_host!${real_port}!${check_hostname}"
}
}
class sshd::openbsd inherits sshd::base {
Service[sshd]{
- restart => '/bin/kill -HUP `/bin/cat /var/run/sshd.pid`',
- stop => '/bin/kill `/bin/cat /var/run/sshd.pid`',
- start => '/usr/sbin/sshd',
+ restart => '/bin/kill -HUP `/bin/cat /var/run/sshd.pid`',
+ stop => '/bin/kill `/bin/cat /var/run/sshd.pid`',
+ start => '/usr/sbin/sshd',
hasstatus => false,
}
}
-class sshd::redhat inherits sshd::linux {
- Package[openssh]{
- name => 'openssh-server',
- }
+class sshd::redhat inherits sshd::linux {
+ Package[openssh]{
+ name => 'openssh-server',
+ }
}
}
$real_user = $user ? {
- false => $name,
- '' => $name,
+ false => $name,
+ '' => $name,
default => $user,
}
}
ssh_authorized_key{$name:
ensure => $ensure,
- type => $type,
- key => $key,
- user => $real_user,
+ type => $type,
+ key => $key,
+ user => $real_user,
target => $real_target,
}
case $options {
- 'absent': { info("not setting any option for ssh_authorized_key: $name") }
+ 'absent': { info("not setting any option for ssh_authorized_key: ${name}") }
default: {
Ssh_authorized_key[$name]{
options => $options,