Puppet Class: ssh::server

Defined in:
manifests/server.pp

Overview

This class handles the configuration and servic ehandling for the SSH daemon. The configuration parameters for sshd(8) are handled through the ssh::server::config class.

Examples:

include ssh::server


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'manifests/server.pp', line 8

class ssh::server {
  include ssh
  include ssh::install
  include ssh::server::config

  concat { $ssh::sshd_config:
    owner   => 'root',
    group   => '0',
    mode    => '0640',
    require => Class['ssh::install'],
    notify  => Service[$ssh::ssh_service],
  }

  concat::fragment { 'sshd_config-header':
    order   => '00',
    target  => $ssh::sshd_config,
    content => template('ssh/sshd_config-header.erb'),
  }

  if size($ssh::ssh_packages) > 0 {
    Service {
      subscribe => Package[$ssh::ssh_packages],
    }
  }

  service { 'sshd':
    ensure     => running,
    name       => $ssh::ssh_service,
    enable     => true,
    hasstatus  => true,
    hasrestart => $ssh::service_hasrestart,
  }

  file { $ssh::ssh_dir:
    ensure => directory,
    owner  => 'root',
    group  => '0',
    mode   => '0755',
  }

  file { $ssh::known_hosts:
    ensure => present,
    owner  => 'root',
    group  => '0',
    mode   => '0644',
  }

  # If root login is permitted, then the root group granted access.
  $permitrootlogin = $ssh::server::config::permitrootlogin

  if $permitrootlogin != 'no' {
    ssh::allowgroup { $ssh::root_group: }
  }
}