From 6cec39be950ccc6073bb1ba08050c31b44878f47 Mon Sep 17 00:00:00 2001 From: Christian Krause Date: Mon, 10 Jul 2023 13:05:04 +0200 Subject: [PATCH] [template] wip ssh users is empty check --- templates/sshd_config_archlinux.conf | 5 ++++- templates/sshd_config_d_90_redhat_9.conf | 4 +++- templates/sshd_config_redhat_7.conf | 5 ++++- templates/sshd_config_redhat_8.conf | 5 ++++- templates/sshd_config_ubuntu_16.conf | 5 ++++- templates/sshd_config_ubuntu_18.conf | 5 ++++- templates/sshd_config_ubuntu_20.conf | 5 ++++- 7 files changed, 27 insertions(+), 7 deletions(-) diff --git a/templates/sshd_config_archlinux.conf b/templates/sshd_config_archlinux.conf index 7f83288..4019f47 100644 --- a/templates/sshd_config_archlinux.conf +++ b/templates/sshd_config_archlinux.conf @@ -197,8 +197,9 @@ Subsystem {{ subsystem.name }} {{ subsystem.command }} # override default of no subsystems Subsystem sftp /usr/lib/ssh/sftp-server {% endif %} - {% if ssh_users is defined %} +{% if ssh_users %} + {% for user in ssh_users %} Match User {{ user.name }} {% if user.settings is defined %} @@ -213,7 +214,9 @@ Match User {{ user.name }} {% endif %} {% endfor %} +{% endif %} {% else %} + # Example of overriding settings on a per-user basis #Match User anoncvs # X11Forwarding no diff --git a/templates/sshd_config_d_90_redhat_9.conf b/templates/sshd_config_d_90_redhat_9.conf index 4aad79e..8816a2e 100644 --- a/templates/sshd_config_d_90_redhat_9.conf +++ b/templates/sshd_config_d_90_redhat_9.conf @@ -78,8 +78,9 @@ Banner {{ ssh_banner.dest }} AcceptEnv {{ env }} {% endfor %} {% endif %} - {% if ssh_users is defined %} +{% if ssh_users %} + {% for user in ssh_users %} Match User {{ user.name }} {% if user.settings is defined %} @@ -95,3 +96,4 @@ Match User {{ user.name }} {% endif %} {% endfor %} {% endif %} +{% endif %} diff --git a/templates/sshd_config_redhat_7.conf b/templates/sshd_config_redhat_7.conf index 3c134b9..bd4bd98 100644 --- a/templates/sshd_config_redhat_7.conf +++ b/templates/sshd_config_redhat_7.conf @@ -219,8 +219,9 @@ Subsystem {{ subsystem.name }} {{ subsystem.command }} # override default of no subsystems Subsystem sftp /usr/libexec/openssh/sftp-server {% endif %} - {% if ssh_users is defined %} +{% if ssh_users %} + {% for user in ssh_users %} Match User {{ user.name }} {% if user.settings is defined %} @@ -235,7 +236,9 @@ Match User {{ user.name }} {% endif %} {% endfor %} +{% endif %} {% else %} + # Example of overriding settings on a per-user basis #Match User anoncvs # X11Forwarding no diff --git a/templates/sshd_config_redhat_8.conf b/templates/sshd_config_redhat_8.conf index 8a7e144..40639f3 100644 --- a/templates/sshd_config_redhat_8.conf +++ b/templates/sshd_config_redhat_8.conf @@ -225,8 +225,9 @@ Subsystem {{ subsystem.name }} {{ subsystem.command }} # override default of no subsystems Subsystem sftp /usr/libexec/openssh/sftp-server {% endif %} - {% if ssh_users is defined %} +{% if ssh_users %} + {% for user in ssh_users %} Match User {{ user.name }} {% if user.settings is defined %} @@ -241,7 +242,9 @@ Match User {{ user.name }} {% endif %} {% endfor %} +{% endif %} {% else %} + # Example of overriding settings on a per-user basis #Match User anoncvs # X11Forwarding no diff --git a/templates/sshd_config_ubuntu_16.conf b/templates/sshd_config_ubuntu_16.conf index ccfe191..601f887 100644 --- a/templates/sshd_config_ubuntu_16.conf +++ b/templates/sshd_config_ubuntu_16.conf @@ -216,8 +216,9 @@ Subsystem {{ subsystem.name }} {{ subsystem.command }} # override default of no subsystems Subsystem sftp /usr/lib/openssh/sftp-server {% endif %} - {% if ssh_users is defined %} +{% if ssh_users %} + {% for user in ssh_users %} Match User {{ user.name }} {% if user.settings is defined %} @@ -232,7 +233,9 @@ Match User {{ user.name }} {% endif %} {% endfor %} +{% endif %} {% else %} + # Example of overriding settings on a per-user basis #Match User anoncvs # X11Forwarding no diff --git a/templates/sshd_config_ubuntu_18.conf b/templates/sshd_config_ubuntu_18.conf index 6f3b5e4..e98b1ac 100644 --- a/templates/sshd_config_ubuntu_18.conf +++ b/templates/sshd_config_ubuntu_18.conf @@ -203,8 +203,9 @@ Subsystem {{ subsystem.name }} {{ subsystem.command }} # override default of no subsystems Subsystem sftp /usr/lib/ssh/sftp-server {% endif %} - {% if ssh_users is defined %} +{% if ssh_users %} + {% for user in ssh_users %} Match User {{ user.name }} {% if user.settings is defined %} @@ -219,7 +220,9 @@ Match User {{ user.name }} {% endif %} {% endfor %} +{% endif %} {% else %} + # Example of overriding settings on a per-user basis #Match User anoncvs # X11Forwarding no diff --git a/templates/sshd_config_ubuntu_20.conf b/templates/sshd_config_ubuntu_20.conf index a126975..2caa1c4 100644 --- a/templates/sshd_config_ubuntu_20.conf +++ b/templates/sshd_config_ubuntu_20.conf @@ -204,8 +204,9 @@ Subsystem {{ subsystem.name }} {{ subsystem.command }} # override default of no subsystems Subsystem sftp /usr/lib/ssh/sftp-server {% endif %} - {% if ssh_users is defined %} +{% if ssh_users %} + {% for user in ssh_users %} Match User {{ user.name }} {% if user.settings is defined %} @@ -220,7 +221,9 @@ Match User {{ user.name }} {% endif %} {% endfor %} +{% endif %} {% else %} + # Example of overriding settings on a per-user basis #Match User anoncvs # X11Forwarding no