init.pp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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_ssl = '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. ) {
  53. validate_bool($manage_shorewall)
  54. validate_bool($manage_client)
  55. validate_array($listen_address)
  56. validate_array($ports)
  57. if $manage_client {
  58. class{'sshd::client':
  59. shared_ip => $shared_ip,
  60. ensure_version => $ensure_version,
  61. manage_shorewall => $manage_shorewall,
  62. }
  63. }
  64. case $::operatingsystem {
  65. gentoo: { include sshd::gentoo }
  66. redhat,centos: { include sshd::redhat }
  67. openbsd: { include sshd::openbsd }
  68. debian,ubuntu: { include sshd::debian }
  69. default: { include sshd::base }
  70. }
  71. if $manage_nagios {
  72. sshd::nagios{$ports:
  73. check_hostname => $nagios_check_ssh_hostname
  74. }
  75. }
  76. if $manage_shorewall {
  77. class{'shorewall::rules::ssh':
  78. ports => $ports,
  79. source => $shorewall_source
  80. }
  81. }
  82. }