FreeBSD.erb 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. # $OpenBSD: sshd_config,v 1.81 2009/10/08 14:03:41 markus Exp $
  2. # $FreeBSD: src/crypto/openssh/sshd_config,v 1.49.2.2.2.1 2010/06/14 02:09:06 kensmith Exp $
  3. # This is the sshd server system-wide configuration file. See
  4. # sshd_config(5) for more information.
  5. # This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
  6. # The strategy used for options in the default sshd_config shipped with
  7. # OpenSSH is to specify options with their default value where
  8. # possible, but leave them commented. Uncommented options change a
  9. # default value.
  10. # Note that some of FreeBSD's defaults differ from OpenBSD's, and
  11. # FreeBSD has a few additional options.
  12. #VersionAddendum FreeBSD-20100308
  13. <% unless (s=scope.lookupvar('sshd::head_additional_options')).empty? -%>
  14. <%= s %>
  15. <% end -%>
  16. # What ports, IPs and protocols we listen for
  17. <% scope.lookupvar('sshd::ports').to_a.each do |port| -%>
  18. <% if port == 'off' -%>
  19. #Port -- disabled by puppet
  20. <% else -%>
  21. Port <%= port %>
  22. <% end -%>
  23. <% end -%>
  24. #AddressFamily any
  25. <% scope.lookupvar('sshd::listen_address').to_a.each do |address| -%>
  26. ListenAddress <%= address %>
  27. <% end -%>
  28. # The default requires explicit activation of protocol 1
  29. Protocol 2
  30. # HostKey for protocol version 1
  31. #HostKey /etc/ssh/ssh_host_key
  32. # HostKeys for protocol version 2
  33. <% scope.lookupvar('sshd::hostkey_type').to_a.each do |hostkey_type| -%>
  34. HostKey /etc/ssh/ssh_host_<%=hostkey_type %>_key
  35. <% end -%>
  36. # Lifetime and size of ephemeral version 1 server key
  37. #KeyRegenerationInterval 1h
  38. #ServerKeyBits 1024
  39. # Logging
  40. # obsoletes QuietMode and FascistLogging
  41. SyslogFacility AUTH
  42. LogLevel INFO
  43. # Authentication:
  44. LoginGraceTime 600
  45. PermitRootLogin <%= scope.lookupvar('sshd::permit_root_login') %>
  46. StrictModes <%= scope.lookupvar('sshd::strict_modes') %>
  47. #MaxAuthTries 6
  48. #MaxSessions 10
  49. RSAAuthentication <%= scope.lookupvar('sshd::rsa_authentication') %>
  50. PubkeyAuthentication <%= scope.lookupvar('sshd::pubkey_authentication') %>
  51. AuthorizedKeysFile <%= scope.lookupvar('sshd::authorized_keys_file') %>
  52. # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
  53. RhostsRSAAuthentication <%= scope.lookupvar('sshd::rhosts_rsa_authentication') %>
  54. # similar for protocol version 2
  55. HostbasedAuthentication <%= scope.lookupvar('sshd::hostbased_authentication') %>
  56. # Change to yes if you don't trust ~/.ssh/known_hosts for
  57. # RhostsRSAAuthentication and HostbasedAuthentication
  58. #IgnoreUserKnownHosts no
  59. # Don't read the user's ~/.rhosts and ~/.shosts files
  60. #IgnoreRhosts yes
  61. # Change to yes to enable built-in password authentication.
  62. PasswordAuthentication <%= scope.lookupvar('sshd::password_authentication') %>
  63. PermitEmptyPasswords <%= scope.lookupvar('sshd::permit_empty_passwords') %>
  64. # Change to no to disable PAM authentication
  65. ChallengeResponseAuthentication <%= scope.lookupvar('sshd::challenge_response_authentication') %>
  66. # Kerberos options
  67. KerberosAuthentication <%= scope.lookupvar('sshd::kerberos_authentication') %>
  68. KerberosOrLocalPasswd <%= scope.lookupvar('sshd::kerberos_orlocalpasswd') %>
  69. KerberosTicketCleanup <%= scope.lookupvar('sshd::kerberos_ticketcleanup') %>
  70. # GSSAPI options
  71. GSSAPIAuthentication <%= scope.lookupvar('sshd::gssapi_authentication') %>
  72. GSSAPICleanupCredentials <%= scope.lookupvar('sshd::gssapi_cleanupcredentials') %>
  73. # Set this to 'no' to disable PAM authentication, account processing,
  74. # and session processing. If this is enabled, PAM authentication will
  75. # be allowed through the ChallengeResponseAuthentication and
  76. # PasswordAuthentication. Depending on your PAM configuration,
  77. # PAM authentication via ChallengeResponseAuthentication may bypass
  78. # the setting of "PermitRootLogin without-password".
  79. # If you just want the PAM account and session checks to run without
  80. # PAM authentication, then enable this but set PasswordAuthentication
  81. # and ChallengeResponseAuthentication to 'no'.
  82. UsePAM <%= scope.lookupvar('sshd::use_pam') %>
  83. AllowAgentForwarding <%= scope.lookupvar('sshd::agent_forwarding') %>
  84. AllowTcpForwarding <%= scope.lookupvar('sshd::tcp_forwarding') %>
  85. #GatewayPorts no
  86. X11Forwarding <%= scope.lookupvar('sshd::x11_forwarding') %>
  87. X11DisplayOffset 10
  88. #X11UseLocalhost yes
  89. PrintMotd <%= sshd_print_motd %>
  90. #PrintLastLog yes
  91. TCPKeepAlive yes
  92. #UseLogin no
  93. #UsePrivilegeSeparation yes
  94. #PermitUserEnvironment no
  95. #Compression delayed
  96. #ClientAliveInterval 0
  97. #ClientAliveCountMax 3
  98. #UseDNS yes
  99. #PidFile /var/run/sshd.pid
  100. #MaxStartups 10
  101. #PermitTunnel no
  102. #ChrootDirectory none
  103. # no default banner path
  104. #Banner none
  105. # override default of no subsystems
  106. Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ? '/usr/libexec/sftp-server' : s %>
  107. # Example of overriding settings on a per-user basis
  108. #Match User anoncvs
  109. # X11Forwarding no
  110. # AllowTcpForwarding no
  111. # ForceCommand cvs server
  112. <% unless (s=scope.lookupvar('sshd::allowed_users')).empty? -%>
  113. AllowUsers <%= s %>
  114. <% end -%>
  115. <% unless (s=scope.lookupvar('sshd::allowed_groups')).empty? -%>
  116. AllowGroups <%= s %>
  117. <%- end -%>
  118. <% if scope.lookupvar('sshd::hardened') == 'yes' -%>
  119. <% if (scope.function_versioncmp([scope.lookupvar('::ssh_version'),'6.5'])) >= 0 -%>
  120. KexAlgorithms curve25519-sha256@libssh.org
  121. Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes256-ctr
  122. 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
  123. <% else -%>
  124. Ciphers aes256-ctr
  125. MACs hmac-sha1
  126. <% end -%>
  127. <% end -%>
  128. <% unless (s=scope.lookupvar('sshd::tail_additional_options')).empty? -%>
  129. <%= s %>
  130. <% end -%>