|
|
abb996 |
From ea37df6b736d22f32fd0d64457d731aa76b656c8 Mon Sep 17 00:00:00 2001
|
|
|
abb996 |
From: =?UTF-8?q?Mat=C4=9Bj=20T=C3=BD=C4=8D?= <matyc@redhat.com>
|
|
|
abb996 |
Date: Wed, 18 Aug 2021 16:17:15 +0200
|
|
|
abb996 |
Subject: [PATCH 1/2] Come up with a better basename
|
|
|
abb996 |
|
|
|
abb996 |
On Red Hat systems, there is 50-redhat.conf, so
|
|
|
abb996 |
60-complianceascode.conf seems to be a generally good fit.
|
|
|
abb996 |
---
|
|
|
abb996 |
shared/templates/sshd_lineinfile/bash.template | 3 ++-
|
|
|
abb996 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
abb996 |
|
|
|
abb996 |
diff --git a/shared/templates/sshd_lineinfile/bash.template b/shared/templates/sshd_lineinfile/bash.template
|
|
|
abb996 |
index eac758e310b..e15ab9521b8 100644
|
|
|
abb996 |
--- a/shared/templates/sshd_lineinfile/bash.template
|
|
|
abb996 |
+++ b/shared/templates/sshd_lineinfile/bash.template
|
|
|
abb996 |
@@ -11,8 +11,9 @@ mkdir -p /etc/ssh/sshd_config.d
|
|
|
abb996 |
touch /etc/ssh/sshd_config.d/hardening
|
|
|
abb996 |
{{{ lineinfile_absent("/etc/ssh/sshd_config", line_regex, insensitive=true) }}}
|
|
|
abb996 |
{{{ lineinfile_absent_in_directory("/etc/ssh/sshd_config.d", line_regex, insensitive=true) }}}
|
|
|
abb996 |
+{{%- set hardening_config_basename = "00-complianceascode-hardening.conf" %}}
|
|
|
abb996 |
{{{ set_config_file(
|
|
|
abb996 |
- path="/etc/ssh/sshd_config.d/hardening",
|
|
|
abb996 |
+ path="/etc/ssh/sshd_config.d/" ~ hardening_config_basename,
|
|
|
abb996 |
parameter=PARAMETER,
|
|
|
abb996 |
value=VALUE,
|
|
|
abb996 |
create=true,
|
|
|
abb996 |
|
|
|
abb996 |
From 9fc6f549d9494730c4d973330a24a5a2a209b1c3 Mon Sep 17 00:00:00 2001
|
|
|
abb996 |
From: =?UTF-8?q?Mat=C4=9Bj=20T=C3=BD=C4=8D?= <matyc@redhat.com>
|
|
|
abb996 |
Date: Wed, 18 Aug 2021 17:51:17 +0200
|
|
|
abb996 |
Subject: [PATCH 2/2] Fix the sshd directory config check
|
|
|
abb996 |
|
|
|
abb996 |
The check should consider only files matching .*\.conf
|
|
|
abb996 |
---
|
|
|
abb996 |
.../sshd_disable_pubkey_auth/tests/conflict.fail.sh | 4 ++--
|
|
|
abb996 |
.../tests/correct_value_directory.pass.sh | 2 +-
|
|
|
abb996 |
shared/macros-oval.jinja | 2 +-
|
|
|
abb996 |
3 files changed, 4 insertions(+), 4 deletions(-)
|
|
|
abb996 |
|
|
|
abb996 |
diff --git a/linux_os/guide/services/ssh/ssh_server/sshd_disable_pubkey_auth/tests/conflict.fail.sh b/linux_os/guide/services/ssh/ssh_server/sshd_disable_pubkey_auth/tests/conflict.fail.sh
|
|
|
abb996 |
index 177a99e0b82..6e064ffc739 100644
|
|
|
abb996 |
--- a/linux_os/guide/services/ssh/ssh_server/sshd_disable_pubkey_auth/tests/conflict.fail.sh
|
|
|
abb996 |
+++ b/linux_os/guide/services/ssh/ssh_server/sshd_disable_pubkey_auth/tests/conflict.fail.sh
|
|
|
abb996 |
@@ -11,5 +11,5 @@ else
|
|
|
abb996 |
echo "# PubkeyAuthentication no" >> /etc/ssh/sshd_config
|
|
|
abb996 |
fi
|
|
|
abb996 |
|
|
|
abb996 |
-echo "PubkeyAuthentication no" > /etc/ssh/sshd_config.d/good_config
|
|
|
abb996 |
-echo "PubkeyAuthentication yes" > /etc/ssh/sshd_config.d/rogue_config
|
|
|
abb996 |
+echo "PubkeyAuthentication no" > /etc/ssh/sshd_config.d/good_config.conf
|
|
|
abb996 |
+echo "PubkeyAuthentication yes" > /etc/ssh/sshd_config.d/rogue_config.conf
|
|
|
abb996 |
diff --git a/linux_os/guide/services/ssh/ssh_server/sshd_disable_pubkey_auth/tests/correct_value_directory.pass.sh b/linux_os/guide/services/ssh/ssh_server/sshd_disable_pubkey_auth/tests/correct_value_directory.pass.sh
|
|
|
abb996 |
index 0aa2e775dbe..acb650915fe 100644
|
|
|
abb996 |
--- a/linux_os/guide/services/ssh/ssh_server/sshd_disable_pubkey_auth/tests/correct_value_directory.pass.sh
|
|
|
abb996 |
+++ b/linux_os/guide/services/ssh/ssh_server/sshd_disable_pubkey_auth/tests/correct_value_directory.pass.sh
|
|
|
abb996 |
@@ -11,4 +11,4 @@ else
|
|
|
abb996 |
echo "# PubkeyAuthentication no" >> /etc/ssh/sshd_config
|
|
|
abb996 |
fi
|
|
|
abb996 |
|
|
|
abb996 |
-echo "PubkeyAuthentication no" > /etc/ssh/sshd_config.d/correct
|
|
|
abb996 |
+echo "PubkeyAuthentication no" > /etc/ssh/sshd_config.d/correct.conf
|
|
|
abb996 |
diff --git a/shared/macros-oval.jinja b/shared/macros-oval.jinja
|
|
|
abb996 |
index 87e0fd7d87d..f2fa7d79fc8 100644
|
|
|
abb996 |
--- a/shared/macros-oval.jinja
|
|
|
abb996 |
+++ b/shared/macros-oval.jinja
|
|
|
abb996 |
@@ -227,7 +227,7 @@
|
|
|
abb996 |
{{%- endmacro %}}
|
|
|
abb996 |
|
|
|
abb996 |
{{%- macro oval_line_in_directory_object(path='', section='', prefix_regex='^[ \\t]*', parameter='', separator_regex='[ \\t]+', missing_parameter_pass=false, multi_value=false) -%}}
|
|
|
abb996 |
-{{{- oval_line_in_file_object(path=path, section=section, prefix_regex=prefix_regex, parameter=parameter, separator_regex=separator_regex, missing_parameter_pass=missing_parameter_pass, multi_value=multi_value, filepath_regex=".*", id_stem=rule_id ~ "_config_dir") -}}}
|
|
|
abb996 |
+{{{- oval_line_in_file_object(path=path, section=section, prefix_regex=prefix_regex, parameter=parameter, separator_regex=separator_regex, missing_parameter_pass=missing_parameter_pass, multi_value=multi_value, filepath_regex=".*\.conf$", id_stem=rule_id ~ "_config_dir") -}}}
|
|
|
abb996 |
{{%- endmacro %}}
|
|
|
abb996 |
|
|
|
abb996 |
{{%- macro oval_line_in_directory_state(value='', multi_value='', quotes='') -%}}
|