init.pp 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. # manage an sshd installation
  2. class sshd(
  3. $manage_nagios = false,
  4. $nagios_check_ssh_hostname = 'absent',
  5. $ports = [ 22 ],
  6. $shared_ip = 'no',
  7. $ensure_version = 'installed',
  8. $listen_address = [ '0.0.0.0', '::' ],
  9. $allowed_users = '',
  10. $allowed_groups = '',
  11. $use_pam = 'no',
  12. $permit_root_login = 'without-password',
  13. $password_authentication = 'no',
  14. $kerberos_authentication = 'no',
  15. $kerberos_orlocalpasswd = 'yes',
  16. $kerberos_ticketcleanup = 'yes',
  17. $gssapi_authentication = 'no',
  18. $gssapi_cleanupcredentials = 'yes',
  19. $tcp_forwarding = 'no',
  20. $x11_forwarding = 'no',
  21. $agent_forwarding = 'no',
  22. $challenge_response_authentication = 'no',
  23. $pubkey_authentication = 'yes',
  24. $rsa_authentication = 'no',
  25. $strict_modes = 'yes',
  26. $ignore_rhosts = 'yes',
  27. $rhosts_rsa_authentication = 'no',
  28. $hostbased_authentication = 'no',
  29. $permit_empty_passwords = 'no',
  30. $authorized_keys_file = $::osfamily ? {
  31. Debian => $::lsbmajdistrelease ? {
  32. 6 => '%h/.ssh/authorized_keys',
  33. default => '%h/.ssh/authorized_keys %h/.ssh/authorized_keys2',
  34. },
  35. RedHat => $::operatingsystemmajrelease ? {
  36. 5 => '%h/.ssh/authorized_keys',
  37. 6 => '%h/.ssh/authorized_keys',
  38. default => '%h/.ssh/authorized_keys %h/.ssh/authorized_keys2',
  39. },
  40. OpenBSD => '%h/.ssh/authorized_keys',
  41. default => '%h/.ssh/authorized_keys %h/.ssh/authorized_keys2',
  42. },
  43. $hardened = 'no',
  44. $sftp_subsystem = '',
  45. $head_additional_options = '',
  46. $tail_additional_options = '',
  47. $print_motd = 'yes',
  48. $manage_shorewall = false,
  49. $shorewall_source = 'net',
  50. $sshkey_ipaddress = $::ipaddress,
  51. $manage_client = true,
  52. $hostkey_type = versioncmp($::ssh_version, '6.5') ? {
  53. /(^1|0)/ => [ 'rsa', 'ed25519' ],
  54. /-1/ => [ 'rsa', 'dsa' ]
  55. }
  56. ) {
  57. validate_bool($manage_shorewall)
  58. validate_bool($manage_client)
  59. validate_array($listen_address)
  60. validate_array($ports)
  61. if $manage_client {
  62. class{'sshd::client':
  63. shared_ip => $shared_ip,
  64. ensure_version => $ensure_version,
  65. manage_shorewall => $manage_shorewall,
  66. }
  67. }
  68. case $::operatingsystem {
  69. gentoo: { include sshd::gentoo }
  70. redhat,centos: { include sshd::redhat }
  71. openbsd: { include sshd::openbsd }
  72. debian,ubuntu: { include sshd::debian }
  73. default: { include sshd::base }
  74. }
  75. if $manage_nagios {
  76. sshd::nagios{$ports:
  77. check_hostname => $nagios_check_ssh_hostname
  78. }
  79. }
  80. if $manage_shorewall {
  81. class{'shorewall::rules::ssh':
  82. ports => $ports,
  83. source => $shorewall_source
  84. }
  85. }
  86. }