1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_sshd.git synced 2024-08-16 11:59:49 +02:00
ansible_role_sshd/templates/sshd_config.j2

104 lines
2.7 KiB
Text
Raw Normal View History

2019-04-09 22:13:59 +02:00
# Attention, do not make changes
2018-03-20 20:21:57 +01:00
# {{ ansible_managed }}
2018-03-09 03:13:41 +01:00
# Networking
2019-04-14 15:01:00 +02:00
Port {{ ssh_port }}
TCPKeepAlive yes
# Key exchange
#KexAlgorithms curve25519-sha256@libssh.org,
# diffie-hellman-group-exchange-sha256
2019-07-17 14:03:00 +02:00
{% if ansible_distribution_release == 'wheezy' -%}
KexAlgorithms diffie-hellman-group-exchange-sha256
{%- else -%}
KexAlgorithms diffie-hellman-group-exchange-sha256
{%- if use_diffie_hellman_group_exchange_sha256 -%}
,diffie-hellman-group-exchange-sha256
{%- endif -%}
{%- endif %}
# Server authentication
Protocol 2
2019-09-16 17:43:19 +02:00
{% if ansible_distribution_release == 'wheezy' %}
# HostKey /etc/ssh/ssh_host_ed25519_key
2019-07-22 17:10:11 +02:00
{% else %}
2019-09-16 17:43:19 +02:00
HostKey /etc/ssh/ssh_host_ed25519_key
{% if generate_ecdsa_too %}
HostKey /etc/ssh/ssh_host_ecdsa_key
2019-09-16 17:43:19 +02:00
{% endif %}
{% endif %}
# Not available in openssh 6.7
# HostKeyAlgorithms ssh-ed25519-cert-v01@openssh.com,ssh-ed25519
# Client authentication
PasswordAuthentication {{ sshd_password_authentication }}
ChallengeResponseAuthentication no
PubkeyAuthentication yes
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes
# User Authentication
{% if restrict_allow_users|default(True) %}
AllowUsers {{ sshd_allow_users|join(' ') }}
AllowGroups {{ sshd_allow_groups|join(' ') }}
{% endif %}
PermitRootLogin without-password
LoginGraceTime 120
StrictModes yes
# Not available in openssh 6.7
{% if only_allow_ed25519 == false %}# {%
endif %}PubkeyAcceptedKeyTypes ssh-ed25519-cert-v01@openssh.com,ssh-ed25519
# Symmetric ciphers
#Ciphers chacha20-poly1305@openssh.com,
# aes256-gcm@openssh.com,
# aes128-gcm@openssh.com,
# aes256-ctr,
# aes192-ctr,
# aes128-ctr
2019-07-17 14:03:00 +02:00
{% if ansible_distribution_release == 'wheezy' -%}
Ciphers aes192-ctr,aes256-ctr,arcfour256
{%- else -%}
Ciphers chacha20-poly1305@openssh.com
{%- if use_aes256_ctr -%}
,aes256-ctr
{%- endif -%}
{%- endif %}
# Message authentication codes
#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
2019-07-17 14:03:00 +02:00
{% if ansible_distribution_release == 'wheezy' -%}
MACs hmac-sha1,umac-64@openssh.com,hmac-ripemd160
{%- else -%}
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com
{%- if use_hmac_sha2_512 -%}
,hmac-sha2-512
{%- endif -%}
{%- endif %}
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
PrintMotd no
# sftp (required by ansible)
2019-11-20 09:44:44 +01:00
# Subsystem sftp /usr/lib/openssh/sftp-server
2019-11-20 09:51:21 +01:00
Subsystem sftp {{ sftp_server }}
# ETC