From 3fef0613f7fc948babf42544e760987dccf3f47f Mon Sep 17 00:00:00 2001 From: Edgar Aguilar Date: Tue, 12 Sep 2023 12:31:50 -0600 Subject: [PATCH 1/2] Update ansible in sshd_lineinfile Update a regex in specifically ansible_sshd_set macro to take into account leading blank spaces before the Include keyword in sshd_config file Signed-off-by: Edgar Aguilar --- shared/macros/10-ansible.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/macros/10-ansible.jinja b/shared/macros/10-ansible.jinja index 8a5a4c62c1d..0539e003218 100644 --- a/shared/macros/10-ansible.jinja +++ b/shared/macros/10-ansible.jinja @@ -203,7 +203,7 @@ value: :code:`Setting={{ varname1 }}` {{% if product in ["ol8", "ol9"] %}} - name: "Find sshd_config included files" shell: |- - included_files=$(grep -oP "^\s*(?i)include.*" /etc/ssh/sshd_config | sed -e 's/Include\s*//i' | sed -e 's|^[^/]|/etc/ssh/&|') + included_files=$(grep -oP "^\s*(?i)include.*" /etc/ssh/sshd_config | sed -e 's/\s*Include\s*//i' | sed -e 's|^[^/]|/etc/ssh/&|') [[ -n $included_files ]] && ls $included_files || true register: sshd_config_included_files From 1c35d98e9424fffa856dc0ccfcad5ae3e314c94f Mon Sep 17 00:00:00 2001 From: Edgar Aguilar Date: Thu, 28 Sep 2023 12:03:33 -0600 Subject: [PATCH 2/2] Update test on sshd_lineinfile Update test correct_value_multiple_includes to validate OVAL check is case insensitive and allow spaces Signed-off-by: Edgar Aguilar --- .../tests/correct_value_multiple_includes.pass.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/templates/sshd_lineinfile/tests/correct_value_multiple_includes.pass.sh b/shared/templates/sshd_lineinfile/tests/correct_value_multiple_includes.pass.sh index 80086031d7e..c4677e8be8d 100644 --- a/shared/templates/sshd_lineinfile/tests/correct_value_multiple_includes.pass.sh +++ b/shared/templates/sshd_lineinfile/tests/correct_value_multiple_includes.pass.sh @@ -4,8 +4,8 @@ source common.sh -{{{ bash_replace_or_append("/etc/ssh/sshd_config", "Include", "sshd_config.d/*.conf", "%s %s") }}} -echo "Include /etc/dummy" >> "/etc/ssh/sshd_config" +{{{ bash_replace_or_append("/etc/ssh/sshd_config", " InCLude", "sshd_config.d/*.conf", "%s %s") }}} +echo " INclUde /etc/dummy" >> "/etc/ssh/sshd_config" echo "{{{ PARAMETER }}} {{{ VALUE }}}" >> /etc/dummy echo "{{{ PARAMETER }}} {{{ VALUE }}}" >> /etc/ssh/sshd_config.d/other.conf