2020-03-17 16:39:59 +01:00
|
|
|
# Attention, local changew will be overwritten
|
2018-03-20 20:21:57 +01:00
|
|
|
# {{ ansible_managed }}
|
2018-03-09 03:13:41 +01:00
|
|
|
|
2018-03-07 03:28:23 +01:00
|
|
|
# Networking
|
2020-03-17 16:39:59 +01:00
|
|
|
Port {{ sshd.port }}
|
2018-03-07 03:28:23 +01:00
|
|
|
|
|
|
|
TCPKeepAlive yes
|
|
|
|
|
|
|
|
# Key exchange
|
2020-03-17 17:25:08 +01:00
|
|
|
KexAlgorithms
|
|
|
|
{%- for algo in sshd.kex_algorithmus -%}
|
|
|
|
{{ ' ' }}{{ algo }}{{ "," if not loop.last }}
|
|
|
|
{%- endfor %}
|
|
|
|
|
|
|
|
|
|
|
|
# Ciphers:
|
|
|
|
Ciphers
|
|
|
|
{%- for cipher in sshd.ciphers -%}
|
|
|
|
{{ ' ' }}{{ cipher }}{{ "," if not loop.last }}
|
|
|
|
{%- endfor %}
|
|
|
|
|
|
|
|
|
|
|
|
# Macs
|
|
|
|
MACs
|
|
|
|
{%- for mac in sshd.macs -%}
|
|
|
|
{{ ' ' }}{{ mac }}{{ "," if not loop.last }}
|
|
|
|
{%- endfor %}
|
2018-03-07 03:28:23 +01:00
|
|
|
|
|
|
|
# Server authentication
|
|
|
|
Protocol 2
|
|
|
|
|
2020-03-17 18:47:15 +01:00
|
|
|
{% if sshd.manage_key_types | bool -%}
|
|
|
|
# host key types
|
|
|
|
{% for key in sshd.key_types %}
|
|
|
|
HostKey /etc/ssh/ssh_host_{{ key }}_key
|
|
|
|
{% endfor %}
|
|
|
|
{%- endif %}
|
|
|
|
|
|
|
|
|
|
|
|
# HostKeyAlgorithms
|
|
|
|
# Maybe not available in openssh 6.7
|
|
|
|
HostKeyAlgorithms
|
|
|
|
{%- for key in sshd.key_algorithmus -%}
|
|
|
|
{{ ' ' }}{{ key }}{{ "," if not loop.last }}
|
|
|
|
{%- endfor %}
|
|
|
|
|
|
|
|
|
|
|
|
{#
|
2018-03-07 03:28:23 +01:00
|
|
|
# Client authentication
|
2019-04-08 19:34:58 +02:00
|
|
|
PasswordAuthentication {{ sshd_password_authentication }}
|
2018-03-07 03:28:23 +01:00
|
|
|
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
|
2018-08-26 17:25:12 +02:00
|
|
|
{% if restrict_allow_users|default(True) %}
|
2018-03-07 03:28:23 +01:00
|
|
|
AllowUsers {{ sshd_allow_users|join(' ') }}
|
|
|
|
AllowGroups {{ sshd_allow_groups|join(' ') }}
|
2018-08-26 17:25:12 +02:00
|
|
|
{% endif %}
|
2018-03-07 03:28:23 +01:00
|
|
|
PermitRootLogin without-password
|
|
|
|
|
|
|
|
LoginGraceTime 120
|
|
|
|
|
|
|
|
StrictModes yes
|
|
|
|
|
|
|
|
# Not available in openssh 6.7
|
2019-04-09 22:03:00 +02:00
|
|
|
{% if only_allow_ed25519 == false %}# {%
|
|
|
|
endif %}PubkeyAcceptedKeyTypes ssh-ed25519-cert-v01@openssh.com,ssh-ed25519
|
2018-03-07 03:28:23 +01:00
|
|
|
|
|
|
|
# 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 %}
|
2018-03-07 03:28:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
# 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 %}
|
2018-03-07 03:28:23 +01:00
|
|
|
|
|
|
|
# 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 10:20:58 +01:00
|
|
|
{% if ansible_os_family == 'RedHat' %}
|
2019-11-20 10:15:12 +01:00
|
|
|
Subsystem sftp /usr/libexec/openssh/sftp-server
|
|
|
|
{% else %}
|
|
|
|
Subsystem sftp /usr/lib/openssh/sftp-server
|
|
|
|
{% endif %}
|
2018-03-07 03:28:23 +01:00
|
|
|
|
|
|
|
# ETC
|
2020-03-17 17:25:08 +01:00
|
|
|
#}
|