Puppet Class: ssh::server::chocolatey

Inherits:
ssh::params
Defined in:
manifests/server/chocolatey.pp

Overview

Windows native OpenSSH server

Parameters:

  • default_shell_ensure (Enum[present, absent]) (defaults to: present)

    The ensure option for a default shell.

  • default_shell (Stdlib::Absolutepath) (defaults to: $ssh::params::default_shell)

    The default shell to use.

  • default_shell_command_option (String) (defaults to: '/c')

    Options to pass to the default shell.



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
# File 'manifests/server/chocolatey.pp', line 8

class ssh::server::chocolatey (
  Enum[present, absent] $default_shell_ensure         = present,
  Stdlib::Absolutepath  $default_shell                = $ssh::params::default_shell,
  String                $default_shell_command_option = '/c',
) inherits ssh::params {
  # The client package is the same as the server package. The server package
  # just needs an extra parameter.
  #
  # Unfortunately, it will not reinstall if the package options change.
  Package <| title == $ssh::params::server_package |> {
    install_options => ['-params', '/SSHServerFeature'],
  }

  registry_key { 'HKLM:\SOFTWARE\OpenSSH': }

  registry_value {
    default:
      ensure  => $default_shell_ensure,
      require => Package[$ssh::params::server_package],
      ;
    'HKLM:\SOFTWARE\OpenSSH\DefaultShell':
      data => $default_shell,
      ;
    'HKLM:\SOFTWARE\OpenSSH\DefaultShellCommandOption':
      data => $default_shell_command_option,
      ;
  }

  file { $ssh::params::authorized_keys_dir:
    ensure => directory,
    owner  => 'Administrators',
    group  => 'NT AUTHORITY\SYSTEM',
  }

  acl {
    default:
      purge                      => true,
      inherit_parent_permissions => false,
      permissions                => [
        { 'identity' => 'Administrators', 'rights' => ['full'] },
        { 'identity' => 'NT AUTHORITY\SYSTEM', 'rights' => ['full'] },
        { 'identity' => 'Everyone', 'rights' => ['read'] },
      ],
      ;
    $ssh::params::sshd_config:;
    $ssh::params::authorized_keys_dir:;
  }
}