OpenBSD.erb 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. # $OpenBSD: sshd_config,v 1.74 2006/07/19 13:07:10 dtucker Exp $
  2. # This is the sshd server system-wide configuration file. See
  3. # sshd_config(5) for more information.
  4. # The strategy used for options in the default sshd_config shipped with
  5. # OpenSSH is to specify options with their default value where
  6. # possible, but leave them commented. Uncommented options change a
  7. # default value.
  8. <% unless (s=scope.lookupvar('sshd::head_additional_options')).empty? -%>
  9. <%= s %>
  10. <% end -%>
  11. <% scope.lookupvar('sshd::ports').to_a.each do |port| -%>
  12. <% if port == 'off' -%>
  13. #Port -- disabled by puppet
  14. <% else -%>
  15. Port <%= port %>
  16. <% end -%>
  17. <% end -%>
  18. # Use these options to restrict which interfaces/protocols sshd will bind to
  19. <% scope.lookupvar('sshd::listen_address').to_a.each do |address| -%>
  20. ListenAddress <%= address %>
  21. <% end -%>
  22. #Protocol 2,1
  23. #AddressFamily any
  24. # HostKey for protocol version 1
  25. #HostKey /etc/ssh/ssh_host_key
  26. # HostKeys for protocol version 2
  27. #HostKey /etc/ssh/ssh_host_rsa_key
  28. #HostKey /etc/ssh/ssh_host_dsa_key
  29. # Lifetime and size of ephemeral version 1 server key
  30. #KeyRegenerationInterval 1h
  31. #ServerKeyBits 768
  32. # Logging
  33. # obsoletes QuietMode and FascistLogging
  34. #SyslogFacility AUTH
  35. #LogLevel INFO
  36. # Authentication:
  37. #LoginGraceTime 2m
  38. PermitRootLogin <%= scope.lookupvar('sshd::permit_root_login') %>
  39. StrictModes <%= scope.lookupvar('sshd::strict_modes') %>
  40. #MaxAuthTries 6
  41. RSAAuthentication <%= scope.lookupvar('sshd::rsa_authentication') %>
  42. PubkeyAuthentication <%= scope.lookupvar('sshd::pubkey_authentication') %>
  43. AuthorizedKeysFile <%= scope.lookupvar('sshd::authorized_keys_file') %>
  44. # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
  45. RhostsRSAAuthentication <%= scope.lookupvar('sshd::rhosts_rsa_authentication') %>
  46. # similar for protocol version 2
  47. HostbasedAuthentication <%= scope.lookupvar('sshd::hostbased_authentication') %>
  48. # Change to yes if you don't trust ~/.ssh/known_hosts for
  49. # RhostsRSAAuthentication and HostbasedAuthentication
  50. #IgnoreUserKnownHosts no
  51. # Don't read the user's ~/.rhosts and ~/.shosts files
  52. IgnoreRhosts <%= scope.lookupvar('sshd::ignore_rhosts') %>
  53. # To disable tunneled clear text passwords, change to no here!
  54. PasswordAuthentication <%= scope.lookupvar('sshd::password_authentication') %>
  55. # To enable empty passwords, change to yes (NOT RECOMMENDED)
  56. PermitEmptyPasswords <%= scope.lookupvar('sshd::permit_empty_passwords') %>
  57. # Change to no to disable s/key passwords
  58. ChallengeResponseAuthentication <%= scope.lookupvar('sshd::challenge_response_authentication') %>
  59. # Kerberos options
  60. #KerberosAuthentication no
  61. #KerberosOrLocalPasswd yes
  62. #KerberosTicketCleanup yes
  63. #KerberosGetAFSToken no
  64. # GSSAPI options
  65. #GSSAPIAuthentication no
  66. #GSSAPICleanupCredentials yes
  67. AllowTcpForwarding <%= scope.lookupvar('sshd::tcp_forwarding') %>
  68. #GatewayPorts no
  69. X11Forwarding <%= scope.lookupvar('sshd::x11_forwarding') %>
  70. #X11DisplayOffset 10
  71. #X11UseLocalhost yes
  72. PrintMotd <%= scope.lookupvar('sshd::print_motd') %>
  73. #PrintLastLog yes
  74. #TCPKeepAlive yes
  75. #UseLogin no
  76. #UsePrivilegeSeparation yes
  77. #PermitUserEnvironment no
  78. #Compression delayed
  79. #ClientAliveInterval 0
  80. #ClientAliveCountMax 3
  81. #UseDNS yes
  82. #PidFile /var/run/sshd.pid
  83. #MaxStartups 10
  84. #PermitTunnel no
  85. # no default banner path
  86. #Banner /some/path
  87. # override default of no subsystems
  88. Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ? '/usr/libexec/sftp-server' : s %>
  89. <% unless (s=scope.lookupvar('sshd::allowed_users')).empty? -%>
  90. AllowUsers <%= s %>
  91. <% end -%>
  92. <% unless (s=scope.lookupvar('sshd::allowed_groups')).empty? -%>
  93. AllowGroups <%= s %>
  94. <%- end -%>
  95. # Example of overriding settings on a per-user basis
  96. #Match User anoncvs
  97. # X11Forwarding no
  98. # AllowTcpForwarding no
  99. # ForceCommand cvs server
  100. <% if scope.lookupvar('sshd::hardened') == 'yes' -%>
  101. <% if (scope.function_versioncmp([scope.lookupvar('::ssh_version'),'6.5'])) >= 0 -%>
  102. KexAlgorithms curve25519-sha256@libssh.org
  103. Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes256-ctr
  104. MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com
  105. <% else -%>
  106. Ciphers aes256-ctr
  107. MACs hmac-sha1
  108. <% end -%>
  109. <% end -%>
  110. <% unless (s=scope.lookupvar('sshd::tail_additional_options')).empty? -%>
  111. <%= s %>
  112. <% end -%>