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

Merge pull request #7 from roles-ansible/keys

Allow more configuration options for ssh options
This commit is contained in:
L3D 2022-05-03 19:21:42 +02:00 committed by GitHub
commit 15b7867a37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 35 deletions

View file

@ -51,6 +51,7 @@ sshd__kex_algorithmus:
# - 'diffie-hellman-group14-sha1' # - 'diffie-hellman-group14-sha1'
# - 'diffie-hellman-group1-sha1' # - 'diffie-hellman-group1-sha1'
sshd__manage_ciphers: true
sshd__ciphers: sshd__ciphers:
- 'chacha20-poly1305@openssh.com' - 'chacha20-poly1305@openssh.com'
- 'aes256-gcm@openssh.com' - 'aes256-gcm@openssh.com'
@ -59,6 +60,7 @@ sshd__ciphers:
# - 'aes128-ctr' # - 'aes128-ctr'
# - 'aes128-cbc' # - 'aes128-cbc'
sshd__manage_macs: true
sshd__macs: sshd__macs:
- 'hmac-sha2-512-etm@openssh.com' - 'hmac-sha2-512-etm@openssh.com'
- 'hmac-sha2-256-etm@openssh.com' - 'hmac-sha2-256-etm@openssh.com'

View file

@ -5,6 +5,7 @@
# sshd_config(5) for more information. # sshd_config(5) for more information.
{% if sshd__version_is_above_eight | default(false) | bool %} {% if sshd__version_is_above_eight | default(false) | bool %}
# Include SSHD config snippets
Include /etc/ssh/sshd_config.d/*.conf Include /etc/ssh/sshd_config.d/*.conf
{% endif %} {% endif %}
@ -16,58 +17,56 @@ AddressFamily any
TCPKeepAlive yes TCPKeepAlive yes
{% if sshd__manage_key_algorithmus | bool %} # SSHD Key exchange
# Key exchange # -> HostkeyAlgorithms
{% if not sshd__manage_key_algorithmus | bool %}#{% endif -%}
{{ 'HostkeyAlgorithms ' }} {{ 'HostkeyAlgorithms ' }}
{%- for algo in sshd__key_algorithmus -%} {%- for algo in sshd__key_algorithmus -%}
{{ algo }}{{ "," if not loop.last }} {{- algo -}}
{{- "," if not loop.last -}}
{%- endfor %} {%- endfor %}
{% endif %}
# -> KexAlgorithms
{% if not sshd__manage_kex_algorithmus | bool %}#{% endif -%}
{{ 'KexAlgorithms ' }} {{ 'KexAlgorithms ' }}
{%- for algo in sshd__kex_algorithmus -%} {%- for algo in sshd__kex_algorithmus -%}
{{ algo }}{{ "," if not loop.last }} {{- algo -}}
{{- "," if not loop.last -}}
{%- endfor %} {%- endfor %}
# Ciphers and keying # Ciphers and keying
#RekeyLimit default none # RekeyLimit default none
# -> Ciphers
{% if not sshd__manage_ciphers | bool %}#{% endif -%}
{{ 'Ciphers ' }} {{ 'Ciphers ' }}
{%- for cipher in sshd__ciphers -%} {%- for cipher in sshd__ciphers -%}
{{ cipher }}{{ "," if not loop.last }} {{- cipher -}}
{{- "," if not loop.last -}}
{%- endfor %} {%- endfor %}
# Logging
SyslogFacility AUTH
LogLevel INFO
# -> Macs
# Macs {% if not sshd__manage_macs | bool %}#{% endif -%}
{{ 'MACs ' }} {{ 'MACs ' }}
{%- for mac in sshd__macs -%} {%- for mac in sshd__macs -%}
{{ mac }}{{ "," if not loop.last }} {{- mac -}}
{{- "," if not loop.last -}}
{%- endfor %} {%- endfor %}
# Server Authentication # Server Authentication
Protocol 2 Protocol 2
# Logging
SyslogFacility AUTH
LogLevel INFO
{% if sshd__manage_key_types | bool -%} # SSHD Host Keys
# host key types
{% for key in sshd__key_types %} {% for key in sshd__key_types %}
# -> {{ key }}
{% if not sshd__manage_key_types | bool %}#{% endif -%}
HostKey /etc/ssh/ssh_host_{{ key }}_key HostKey /etc/ssh/ssh_host_{{ key }}_key
{% endfor %} {% endfor %}
{%- endif %}
{% if sshd__manage_kex_algorithmus | bool -%}
# HostKeyAlgorithms
# Maybe not available in openssh 6.7
{{ 'HostKeyAlgorithms ' }}
{%- for key in sshd__key_algorithmus -%}
{{ key }}{{ "," if not loop.last }}
{%- endfor %}
{% endif %}
# Client authentication # Client authentication
@ -112,19 +111,16 @@ TCPKeepAlive yes
UsePAM yes UsePAM yes
# User Authentication # User Authentication
{% if sshd__restrict_users -%} {% if not sshd__restrict_users -%}#{%- endif -%}
AllowUsers {{ sshd__allowed_users|join(' ') }} AllowUsers {{ sshd__allowed_users|join(' ') }}
{% endif %}
{% if sshd__restrict_groups -%} # Group Authentication
AllowGroups {{ sshd__allowed_groups|join(' ') }} {% if not sshd__restrict_groups -%}#{%- endif -%}
{%- endif %} AllowGroups {{ sshd__allowed_groups|join(' ') }}
# Allow client to pass locale environment variables # Allow client to pass locale environment variables
AcceptEnv LANG LC_* AcceptEnv LANG LC_*
PrintMotd no
# sftp (required by ansible) # sftp (required by ansible)
# Subsystem sftp /usr/lib/openssh/sftp-server # Subsystem sftp /usr/lib/openssh/sftp-server
{% if ansible_os_family == 'RedHat' %} {% if ansible_os_family == 'RedHat' %}

View file

@ -1,5 +1,5 @@
--- ---
playbook_version_number: 5003 playbook_version_number: 5004
playbook_version_path: 'role-sshd_chaos-bodensee_github.com.version' playbook_version_path: 'role-sshd_chaos-bodensee_github.com.version'
sshd__service_var_path: sshd__service_var_path: