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

update cipher and mac

This commit is contained in:
Lilian Roller 2020-03-17 17:25:08 +01:00
parent 3b008f27ad
commit 289ab2be94
No known key found for this signature in database
GPG key ID: 5215C3441797AB2B
3 changed files with 53 additions and 18 deletions

View file

@ -13,9 +13,34 @@ sshd:
# - ecdsa
# - dsa # (do not use!)
kex_algorithmus:
- 'curve25519-sha256@libssh.org'
- 'diffie-hellman-group-exchange-sha256'
# - 'diffie-hellman-group-exchange-sha1'
# - 'diffie-hellman-group14-sha1'
# - 'diffie-hellman-group1-sha1'
ciphers:
- 'chacha20-poly1305@openssh.com'
- 'aes256-gcm@openssh.com'
# - 'aes256-ctr'
# - 'aes256-cbc'
# - 'aes128-ctr'
# - 'aes128-cbc'
macs:
- 'hmac-sha2-512-etm@openssh.com'
- 'hmac-sha2-256-etm@openssh.com'
# - 'hmac-sha2-512'
# - 'hmac-sha2-256'
# - 'hmac-ripemd160-etm@openssh.com'
# - 'umac-128-etm@openssh.com'
# - 'hmac-sha1'
## default users for SSH access
#
# default users for SSH access
#sshd_default_allowed_users:
# - "root"
# - "ansible"

View file

@ -14,12 +14,10 @@
- name: read default variable
include_vars: vars/default.yml
- pause:
- name: Collect all users and groups allowed to login via ssh
set_fact:
sshd_allow_users: '{{ sshd_default_allowed_users + users.keys() | default({}) | sort }}'
sshd_allow_groups: '{{ sshd_default_allowed_groups + users.keys() | default({}) | sort }}'
#- name: Collect all users and groups allowed to login via ssh
# set_fact:
# sshd_allow_users: '{{ sshd_default_allowed_users + users.keys() | default({}) | sort }}'
# sshd_allow_groups: '{{ sshd_default_allowed_groups + users.keys() | default({}) | sort }}'
- name: Copy sshd configuration
become: yes
@ -29,10 +27,12 @@
owner: root
group: root
mode: 'u=rw,g=r,o=r'
validate: /usr/sbin/sshd -t -f %s
# validate: /usr/sbin/sshd -t -f %s
backup: yes
notify:
- systemctrl restart ssh
- pause:
- name: Generate new ecdsa ssh host key pair if necessary
become: yes

View file

@ -7,17 +7,26 @@ Port {{ sshd.port }}
TCPKeepAlive yes
# Key exchange
#KexAlgorithms curve25519-sha256@libssh.org,
# diffie-hellman-group-exchange-sha256
{% 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 %}
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 %}
{#
# Server authentication
Protocol 2
{% if ansible_distribution_release == 'wheezy' %}
@ -105,3 +114,4 @@ Subsystem sftp /usr/lib/openssh/sftp-server
{% endif %}
# ETC
#}