CentOS_7.erb 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. # $OpenBSD: sshd_config,v 1.90 2013/05/16 04:09:14 dtucker Exp $
  2. # This is the sshd server system-wide configuration file. See
  3. # sshd_config(5) for more information.
  4. # This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin
  5. # The strategy used for options in the default sshd_config shipped with
  6. # OpenSSH is to specify options with their default value where
  7. # possible, but leave them commented. Uncommented options change a
  8. # default value.
  9. <% unless (s=scope.lookupvar('sshd::head_additional_options')).empty? -%>
  10. <%= s %>
  11. <% end -%>
  12. # If you want to change the port on a SELinux system, you have to tell
  13. # SELinux about this change.
  14. # semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
  15. #
  16. <% scope.lookupvar('sshd::ports').to_a.each do |port| -%>
  17. <% if port == 'off' -%>
  18. #Port -- disabled by puppet
  19. <% else -%>
  20. Port <%= port %>
  21. <% end -%>
  22. <% end -%>
  23. <% scope.lookupvar('sshd::listen_address').to_a.each do |address| -%>
  24. ListenAddress <%= address %>
  25. <% end -%>
  26. # The default requires explicit activation of protocol 1
  27. #Protocol 2
  28. # HostKey for protocol version 1
  29. #HostKey /etc/ssh/ssh_host_key
  30. # HostKeys for protocol version 2
  31. HostKey /etc/ssh/ssh_host_rsa_key
  32. #HostKey /etc/ssh/ssh_host_dsa_key
  33. HostKey /etc/ssh/ssh_host_ecdsa_key
  34. # Lifetime and size of ephemeral version 1 server key
  35. #KeyRegenerationInterval 1h
  36. #ServerKeyBits 1024
  37. # Ciphers and keying
  38. #RekeyLimit default none
  39. # Logging
  40. # obsoletes QuietMode and FascistLogging
  41. #SyslogFacility AUTH
  42. SyslogFacility AUTHPRIV
  43. #LogLevel INFO
  44. # Authentication:
  45. #LoginGraceTime 2m
  46. PermitRootLogin <%= scope.lookupvar('sshd::permit_root_login') %>
  47. StrictModes <%= scope.lookupvar('sshd::strict_modes') %>
  48. #MaxAuthTries 6
  49. #MaxSessions 10
  50. RSAAuthentication <%= scope.lookupvar('sshd::rsa_authentication') %>
  51. PubkeyAuthentication <%= scope.lookupvar('sshd::pubkey_authentication') %>
  52. AuthorizedKeysFile <%= scope.lookupvar('sshd::authorized_keys_file') %>
  53. #AuthorizedPrincipalsFile none
  54. #AuthorizedKeysCommand none
  55. #AuthorizedKeysCommandRunAs nobody
  56. # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
  57. RhostsRSAAuthentication <%= scope.lookupvar('sshd::rhosts_rsa_authentication') %>
  58. # similar for protocol version 2
  59. HostbasedAuthentication <%= scope.lookupvar('sshd::hostbased_authentication') %>
  60. # Change to yes if you don't trust ~/.ssh/known_hosts for
  61. # RhostsRSAAuthentication and HostbasedAuthentication
  62. #IgnoreUserKnownHosts no
  63. # Don't read the user's ~/.rhosts and ~/.shosts files
  64. IgnoreRhosts <%= scope.lookupvar('sshd::ignore_rhosts') %>
  65. # To disable tunneled clear text passwords, change to no here!
  66. PasswordAuthentication <%= scope.lookupvar('sshd::password_authentication') %>
  67. # To enable empty passwords, change to yes (NOT RECOMMENDED)
  68. PermitEmptyPasswords <%= scope.lookupvar('sshd::permit_empty_passwords') %>
  69. # Change to no to disable s/key passwords
  70. ChallengeResponseAuthentication <%= scope.lookupvar('sshd::challenge_response_authentication') %>
  71. # Kerberos options
  72. #KerberosAuthentication no
  73. #KerberosOrLocalPasswd yes
  74. #KerberosTicketCleanup yes
  75. #KerberosGetAFSToken no
  76. #KerberosUseKuserok yes
  77. # GSSAPI options
  78. GSSAPIAuthentication no
  79. GSSAPICleanupCredentials yes
  80. #GSSAPIStrictAcceptorCheck yes
  81. #GSSAPIKeyExchange no
  82. # Set this to 'yes' to enable PAM authentication, account processing,
  83. # and session processing. If this is enabled, PAM authentication will
  84. # be allowed through the ChallengeResponseAuthentication and
  85. # PasswordAuthentication. Depending on your PAM configuration,
  86. # PAM authentication via ChallengeResponseAuthentication may bypass
  87. # the setting of "PermitRootLogin without-password".
  88. # If you just want the PAM account and session checks to run without
  89. # PAM authentication, then enable this but set PasswordAuthentication
  90. # and ChallengeResponseAuthentication to 'no'.
  91. # WARNING: 'UsePAM no' is not supported in Red Hat Enterprise Linux and may cause several
  92. # problems.
  93. #UsePAM no
  94. UsePAM <%= scope.lookupvar('sshd::use_pam') %>
  95. #AllowAgentForwarding yes
  96. AllowTcpForwarding <%= scope.lookupvar('sshd::tcp_forwarding') %>
  97. #GatewayPorts no
  98. #X11Forwarding no
  99. X11Forwarding <%= scope.lookupvar('sshd::x11_forwarding') %>
  100. #X11DisplayOffset 10
  101. #X11UseLocalhost yes
  102. PrintMotd <%= scope.lookupvar('sshd::print_motd') %>
  103. #PrintLastLog yes
  104. #TCPKeepAlive yes
  105. #UseLogin no
  106. UsePrivilegeSeparation sandbox # Default for new installations.
  107. #PermitUserEnvironment no
  108. #Compression delayed
  109. #ClientAliveInterval 0
  110. #ClientAliveCountMax 3
  111. #ShowPatchLevel no
  112. #UseDNS yes
  113. #PidFile /var/run/sshd.pid
  114. #MaxStartups 10:30:100
  115. #PermitTunnel no
  116. #ChrootDirectory none
  117. #VersionAddendum none
  118. # no default banner path
  119. #Banner none
  120. # Accept locale-related environment variables
  121. AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
  122. AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
  123. AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
  124. AcceptEnv XMODIFIERS
  125. # override default of no subsystems
  126. Subsystem sftp <%= (s=scope.lookupvar('sshd::sftp_subsystem')).empty? ? '/usr/libexec/openssh/sftp-server' : s %>
  127. <% unless (s=scope.lookupvar('sshd::allowed_users')).empty? -%>
  128. AllowUsers <%= s %>
  129. <% end -%>
  130. <% unless (s=scope.lookupvar('sshd::allowed_groups')).empty? -%>
  131. AllowGroups <%= s %>
  132. <%- end -%>
  133. # Uncomment this if you want to use .local domain
  134. #Host *.local
  135. # CheckHostIP no
  136. <% if scope.lookupvar('sshd::hardened_ssl') == 'yes' -%>
  137. Ciphers aes256-ctr
  138. MACs hmac-sha1
  139. <% end -%>
  140. # Example of overriding settings on a per-user basis
  141. #Match User anoncvs
  142. # X11Forwarding no
  143. # AllowTcpForwarding no
  144. # ForceCommand cvs server
  145. <% unless (s=scope.lookupvar('sshd::tail_additional_options')).empty? -%>
  146. <%= s %>
  147. <% end -%>