sshd_config.j2 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. {% if ansible_prolog -%}
  2. {% from 'templates/ansible/prolog.j2' import prolog with context %}
  3. {{ prolog() }}
  4. {% endif -%}
  5. # Package generated configuration file
  6. # See the sshd_config(5) manpage for details
  7. # What ports, IPs and protocols we listen for
  8. {% if ssh_port is defined %}
  9. Port {{ ssh_port }}
  10. {% else %}
  11. Port 22
  12. {% endif %}
  13. {% if ssh_ports_extra is defined %}
  14. {% for port in ssh_ports_extra %}
  15. Port {{ port }}
  16. {% endfor %}
  17. {% endif %}
  18. # Use these options to restrict which interfaces/protocols sshd will bind to
  19. #ListenAddress ::
  20. #ListenAddress 0.0.0.0
  21. Protocol 2
  22. # HostKeys for protocol version 2
  23. HostKey /etc/ssh/ssh_host_rsa_key
  24. HostKey /etc/ssh/ssh_host_dsa_key
  25. {% if ssh_ecdsa_key %}
  26. HostKey /etc/ssh/ssh_host_ecdsa_key
  27. {% endif %}
  28. #Privilege Separation is turned on for security
  29. UsePrivilegeSeparation yes
  30. {% if not ssh_usedns %}
  31. # Enable/Disable reverse DNS check
  32. # Avois long lag in case of IPv6 connection with no reverse configured
  33. UseDns no
  34. {% endif %}
  35. # Lifetime and size of ephemeral version 1 server key
  36. KeyRegenerationInterval 3600
  37. ServerKeyBits 1024
  38. # Logging
  39. SyslogFacility AUTH
  40. LogLevel INFO
  41. # Authentication:
  42. LoginGraceTime 120
  43. PermitRootLogin without-password
  44. StrictModes yes
  45. RSAAuthentication yes
  46. PubkeyAuthentication yes
  47. #AuthorizedKeysFile %h/.ssh/authorized_keys
  48. # Don't read the user's ~/.rhosts and ~/.shosts files
  49. IgnoreRhosts yes
  50. # For this to work you will also need host keys in /etc/ssh_known_hosts
  51. RhostsRSAAuthentication no
  52. # similar for protocol version 2
  53. HostbasedAuthentication no
  54. # Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
  55. #IgnoreUserKnownHosts yes
  56. # To enable empty passwords, change to yes (NOT RECOMMENDED)
  57. PermitEmptyPasswords no
  58. # Change to yes to enable challenge-response passwords (beware issues with
  59. # some PAM modules and threads)
  60. ChallengeResponseAuthentication no
  61. # Change to no to disable tunnelled clear text passwords
  62. #PasswordAuthentication yes
  63. # Kerberos options
  64. #KerberosAuthentication no
  65. #KerberosGetAFSToken no
  66. #KerberosOrLocalPasswd yes
  67. #KerberosTicketCleanup yes
  68. # GSSAPI options
  69. #GSSAPIAuthentication no
  70. #GSSAPICleanupCredentials yes
  71. X11Forwarding no
  72. X11DisplayOffset 10
  73. PrintMotd no
  74. PrintLastLog yes
  75. TCPKeepAlive yes
  76. #UseLogin no
  77. #MaxStartups 10:30:60
  78. #Banner /etc/issue.net
  79. # Allow client to pass locale environment variables
  80. AcceptEnv LANG LC_*
  81. Subsystem sftp /usr/lib/openssh/sftp-server
  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. UsePAM yes
  92. # Maximum number of authentication attempts permitted per connection
  93. MaxAuthTries 3
  94. # Define users groups allowed to login
  95. AllowGroups root operator ssh