Skip to content

Commit e8e4531

Browse files
authored
Merge pull request #14353 from vojtapolasek/rhel_sysctl_dropin_remediations
RHEL: use dropin files when remediating sysctl rules
2 parents 967905c + d0f87db commit e8e4531

7 files changed

Lines changed: 23 additions & 3 deletions

File tree

products/rhel10/product.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,4 @@ reference_uris:
5757
journald_conf_dir_path: /etc/systemd/journald.conf.d
5858
audit_watches_style: modern
5959
rsyslog_cafile: /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
60+
sysctl_remediate_drop_in_file: true

products/rhel8/product.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,4 @@ reference_uris:
107107
cis: 'https://www.cisecurity.org/benchmark/red_hat_linux/'
108108

109109
journald_conf_dir_path: /etc/systemd/journald.conf.d
110+
sysctl_remediate_drop_in_file: true

products/rhel9/product.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,4 @@ centos_pkg_version: "8483c65d"
6060
centos_major_version: "9"
6161

6262
journald_conf_dir_path: /etc/systemd/journald.conf.d
63+
sysctl_remediate_drop_in_file: true
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
{{% if SYSCTLVAL == "" %}}
3+
# variables = sysctl_{{{ SYSCTLID }}}_value={{{ SYSCTL_CORRECT_VALUE }}}
4+
{{% endif %}}
5+
6+
# Clean sysctl config directories
7+
{{% if "ubuntu" in product %}}
8+
rm -rf /usr/lib/sysctl.d/* /run/sysctl.d/* /etc/sysctl.d/* /etc/ufw/sysctl.conf
9+
{{% else %}}
10+
rm -rf /usr/lib/sysctl.d/* /run/sysctl.d/* /etc/sysctl.d/*
11+
{{% endif %}}
12+
13+
sed -i "/{{{ SYSCTLVAR }}}/d" /etc/sysctl.conf
14+
15+
echo "{{{ SYSCTLVAR }}} = {{{ SYSCTL_CORRECT_VALUE }}}" >> /etc/sysctl.d/duplicate.conf
16+
17+
sysctl -w {{{ SYSCTLVAR }}}="{{{ SYSCTL_CORRECT_VALUE }}}"

tests/data/product_stability/rhel10.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ release_key_fingerprint: 567E347AD0044ADE55BA8A5F199E2F91FD431D51
104104
rsyslog_cafile: /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
105105
sshd_distributed_config: 'true'
106106
sshd_runtime_check: 'false'
107-
sysctl_remediate_drop_in_file: 'false'
107+
sysctl_remediate_drop_in_file: 'true'
108108
target_oval_version:
109109
- 5
110110
- 11

tests/data/product_stability/rhel8.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ release_key_fingerprint: 567E347AD0044ADE55BA8A5F199E2F91FD431D51
151151
rsyslog_cafile: /etc/pki/tls/cert.pem
152152
sshd_distributed_config: 'false'
153153
sshd_runtime_check: 'false'
154-
sysctl_remediate_drop_in_file: 'false'
154+
sysctl_remediate_drop_in_file: 'true'
155155
target_oval_version:
156156
- 5
157157
- 11

tests/data/product_stability/rhel9.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ release_key_fingerprint: 567E347AD0044ADE55BA8A5F199E2F91FD431D51
108108
rsyslog_cafile: /etc/pki/tls/cert.pem
109109
sshd_distributed_config: 'true'
110110
sshd_runtime_check: 'false'
111-
sysctl_remediate_drop_in_file: 'false'
111+
sysctl_remediate_drop_in_file: 'true'
112112
target_oval_version:
113113
- 5
114114
- 11

0 commit comments

Comments
 (0)