From 4edf92fe0d2f32f656daa78b8364f05ef4f55e26 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Tue, 8 Dec 2020 23:15:51 +0200 Subject: [PATCH] roles/common: Allow adding extra SSH users --- roles/common/templates/sshd_config_Ubuntu-20.04.j2 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/roles/common/templates/sshd_config_Ubuntu-20.04.j2 b/roles/common/templates/sshd_config_Ubuntu-20.04.j2 index 0c5c1ad..9e0e8d6 100644 --- a/roles/common/templates/sshd_config_Ubuntu-20.04.j2 +++ b/roles/common/templates/sshd_config_Ubuntu-20.04.j2 @@ -131,5 +131,10 @@ Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes256-ctr MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512,hmac-sha2-256 KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256 -# only allow shell access by provisioning user -AllowUsers {{ provisioning_user.name }} +{% if ssh_allowed_users is defined and ssh_allowed_users %} +# Is there a list of allowed users? +# Is it populated? (An empty list is 'None', which evaluates as False in Python) +# merge the items of a list into one string using a space as a separator +# http://jinja.pocoo.org/docs/dev/templates/#join +AllowUsers {{ ssh_allowed_users|join(" ") }} {{ provisioning_user.name }} +{% endif %}