From 5f7778ec1ace25877f9b7c5e972e2acadd32c0a6 Mon Sep 17 00:00:00 2001 From: Miha Purg Date: Thu, 28 Nov 2024 15:03:26 +0100 Subject: [PATCH] Revert "Remove Ubuntu oval and remediation for nftables_rules_permanent" --- .../nftables_rules_permanent/bash/ubuntu.sh | 18 ++++++++ .../nftables_rules_permanent/oval/ubuntu.xml | 43 +++++++++++++++++++ .../nftables_rules_permanent/rule.yml | 2 +- 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 linux_os/guide/system/network/network-nftables/nftables_rules_permanent/bash/ubuntu.sh create mode 100644 linux_os/guide/system/network/network-nftables/nftables_rules_permanent/oval/ubuntu.xml diff --git a/linux_os/guide/system/network/network-nftables/nftables_rules_permanent/bash/ubuntu.sh b/linux_os/guide/system/network/network-nftables/nftables_rules_permanent/bash/ubuntu.sh new file mode 100644 index 00000000000..f5cd2afef19 --- /dev/null +++ b/linux_os/guide/system/network/network-nftables/nftables_rules_permanent/bash/ubuntu.sh @@ -0,0 +1,18 @@ +# platform = multi_platform_ubuntu +# reboot = false +# strategy = restrict +# complexity = low +# disruption = high + +{{{ bash_instantiate_variables("var_nftables_master_config_file") }}} + +{{{ bash_instantiate_variables("var_nftables_family") }}} + +if [ ! -f "${var_nftables_master_config_file}" ]; then + touch "${var_nftables_master_config_file}" +fi + +nft list ruleset > "/etc/${var_nftables_family}-filter.rules" + +grep -qxF 'include "/etc/'"${var_nftables_family}"'-filter.rules"' "${var_nftables_master_config_file}" \ + || echo 'include "/etc/'"${var_nftables_family}"'-filter.rules"' >> "${var_nftables_master_config_file}" diff --git a/linux_os/guide/system/network/network-nftables/nftables_rules_permanent/oval/ubuntu.xml b/linux_os/guide/system/network/network-nftables/nftables_rules_permanent/oval/ubuntu.xml new file mode 100644 index 00000000000..a1aec949bb0 --- /dev/null +++ b/linux_os/guide/system/network/network-nftables/nftables_rules_permanent/oval/ubuntu.xml @@ -0,0 +1,43 @@ + + + {{{ oval_metadata("Make sure that there is permanent nftables configuration file used + to save and re-apply rules on reboot") }}} + + + + + + + + + + + + + + + + ^[\s]*include[\s]+\"([^\s]+)"$ + 1 + + + + + ^.*$ + 1 + + + + + + + + diff --git a/linux_os/guide/system/network/network-nftables/nftables_rules_permanent/rule.yml b/linux_os/guide/system/network/network-nftables/nftables_rules_permanent/rule.yml index 1414ee5c298..c0d61ce7d35 100644 --- a/linux_os/guide/system/network/network-nftables/nftables_rules_permanent/rule.yml +++ b/linux_os/guide/system/network/network-nftables/nftables_rules_permanent/rule.yml @@ -16,7 +16,7 @@ rationale: |- severity: medium -platform: package[nftables] and service_disabled[firewalld] and service_disabled[ufw] +platform: package[nftables] and service_disabled[firewalld] identifiers: cce@sle15: CCE-92485-2