diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-08-20 23:02:06 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-08-20 23:02:08 +0200 |
commit | c054d22c4818d916ac6dd9c8d7a7a2c614408e17 (patch) | |
tree | c0239045b1587cd950fd1d777f0c84fe5c23aa92 /roles/sshd/templates/sshd_config.j2 | |
parent | add ansible_managed comment to templates (diff) | |
download | infra-ansible-c054d22c4818d916ac6dd9c8d7a7a2c614408e17.tar.gz infra-ansible-c054d22c4818d916ac6dd9c8d7a7a2c614408e17.zip |
append .j2 extension to templates
I saw a good point somewhere that it should help with syntax
highlighting.
Diffstat (limited to 'roles/sshd/templates/sshd_config.j2')
-rw-r--r-- | roles/sshd/templates/sshd_config.j2 | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/roles/sshd/templates/sshd_config.j2 b/roles/sshd/templates/sshd_config.j2 new file mode 100644 index 0000000..abcf0d7 --- /dev/null +++ b/roles/sshd/templates/sshd_config.j2 @@ -0,0 +1,31 @@ +{{ ansible_managed | comment }} + +# Parameters that have sane defaults on Debian 11 are omitted. + +{% set ssh_port = hostvars[inventory_hostname].ansible_port %} +{% set ssh_user = hostvars[inventory_hostname].ansible_user %} + +{% set groups = [ssh_user] + ssh_allowed_groups %} +{% set groups = groups | sort | unique %} + +Port {{ ssh_port }} + +# Whitelist users: +PermitRootLogin no +AllowGroups {{ groups | join(' ') }} + +# Only public key authentication: +PasswordAuthentication no +ChallengeResponseAuthentication no +AuthenticationMethods publickey + +# Whitelist accepted environment variables: +AcceptEnv LANG LC_* + +# Drop idle sessions: +ClientAliveCountMax 3 +ClientAliveInterval 15 + +# Miscellaneous: +PrintMotd no +Subsystem sftp /usr/lib/openssh/sftp-server |