Skip to content

Commit

Permalink
Update rule tests to rely on platform_package_overrides + add needed …
Browse files Browse the repository at this point in the history
…alternatives to products
  • Loading branch information
litios committed Nov 28, 2022
1 parent f0bd335 commit 795f076
Show file tree
Hide file tree
Showing 29 changed files with 7 additions and 102 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#!/bin/bash
# platform = multi_platform_ubuntu,multi_platform_rhel
{{% if "ubuntu" in product %}}
# packages = libpam-pkcs11
{{% elif "rhel7" == product %}}
# packages = pam_pkcs11
{{% else %}}
# packages = openssl-pkcs11
{{% endif %}}

if [ ! -f /etc/pam_pkcs11/pam_pkcs11.conf ]; then
cp /usr/share/doc/libpam-pkcs11/examples/pam_pkcs11.conf.example /etc/pam_pkcs11/pam_pkcs11.conf
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#!/bin/bash
# platform = multi_platform_ol,multi_platform_rhel,multi_platform_ubuntu
{{% if "ubuntu" in product %}}
# packages = libpam-pkcs11
{{% elif product in ["ol7", "rhel7"] %}}
# packages = pam_pkcs11
{{% else %}}
# packages = openssl-pkcs11
{{% endif %}}

if [ ! -f /etc/pam_pkcs11/pam_pkcs11.conf ]; then
cp /usr/share/doc/libpam-pkcs11/examples/pam_pkcs11.conf.example /etc/pam_pkcs11/pam_pkcs11.conf
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#!/bin/bash
# platform = multi_platform_ol,multi_platform_rhel,multi_platform_ubuntu
{{% if "ubuntu" in product %}}
# packages = libpam-pkcs11
{{% elif product in ["ol7", "rhel7"] %}}
# packages = pam_pkcs11
{{% else %}}
# packages = openssl-pkcs11
{{% endif %}}

if [ ! -f /etc/pam_pkcs11/pam_pkcs11.conf ]; then
cp /usr/share/doc/libpam-pkcs11/examples/pam_pkcs11.conf.example /etc/pam_pkcs11/pam_pkcs11.conf
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/bash
{{% if "ubuntu" in product%}}
# packages = auditd
{{% else %}}
# packages = audit
{{% endif %}}

rm -f /etc/audit/rules.d/*
> /etc/audit/audit.rules
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/bash
{{% if "ubuntu" in product%}}
# packages = auditd
{{% else %}}
# packages = audit
{{% endif %}}

rm -f /etc/audit/rules.d/*
> /etc/audit/audit.rules
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/bash
{{% if "ubuntu" in product%}}
# packages = auditd
{{% else %}}
# packages = audit
{{% endif %}}

rm -f /etc/audit/rules.d/*
> /etc/audit/audit.rules\
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/bash
{{% if "ubuntu" in product%}}
# packages = auditd
{{% else %}}
# packages = audit
{{% endif %}}

rm -f /etc/audit/rules.d/*
> /etc/audit/audit.rules
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/bash
{{% if "ubuntu" in product%}}
# packages = auditd
{{% else %}}
# packages = audit
{{% endif %}}

{{% if product in ["ol7", "ol8"] or 'rhel' in product %}}
echo "-a always,exit -F arch=b32 -S finit_module -F auid>=1000 -F auid!=unset -k modules" >> /etc/audit/rules.d/modules.rules
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#!/bin/bash
# remediation = bash
{{% if "ubuntu" in product%}}
# packages = auditd
{{% else %}}
# packages = audit
{{% endif %}}

rm -f /etc/audit/rules.d/*
> /etc/audit/audit.rules
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/bash
{{% if "ubuntu" in product%}}
# packages = auditd
{{% else %}}
# packages = audit
{{% endif %}}

{{% if product in ["ol7", "ol8"] or 'rhel' in product %}}
echo "-a always,exit -F arch=b32 -S init_module -F auid>=1000 -F auid!=unset -k modules" >> /etc/audit/rules.d/modules.rules
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#!/bin/bash
# remediation = bash
{{% if "ubuntu" in product%}}
# packages = auditd
{{% else %}}
# packages = audit
{{% endif %}}

rm -f /etc/audit/rules.d/*
> /etc/audit/audit.rules
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/bash
{{% if "ubuntu" in product %}}
# packages = auditd
{{% else %}}
# packages = audit
{{% endif %}}

source common.sh

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/bash
{{% if "ubuntu" in product %}}
# packages = auditd
{{% else %}}
# packages = audit
{{% endif %}}

source common.sh

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/bash
{{% if "ubuntu" in product %}}
# packages = auditd
{{% else %}}
# packages = audit
{{% endif %}}
# platform = multi_platform_rhel

if grep -iwq "log_file" /etc/audit/auditd.conf; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/bash
{{% if "ubuntu" in product %}}
# packages = auditd
{{% else %}}
# packages = audit
{{% endif %}}

source common.sh

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/bash
{{% if "ubuntu" in product %}}
# packages = auditd
{{% else %}}
# packages = audit
{{% endif %}}

source common.sh

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/bash
{{% if "ubuntu" in product %}}
# packages = auditd
{{% else %}}
# packages = audit
{{% endif %}}
# platform = multi_platform_rhel

if grep -iwq "log_file" /etc/audit/auditd.conf; then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/bash
{{% if "ubuntu" in product%}}
# packages = auditd
{{% else %}}
# packages = audit
{{% endif %}}

source common.sh

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/bash
{{% if "ubuntu" in product%}}
# packages = auditd
{{% else %}}
# packages = audit
{{% endif %}}
# variables = var_auditd_disk_full_action=action1|action2|action3

source common.sh
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/bash
{{% if "ubuntu" in product%}}
# packages = auditd
{{% else %}}
# packages = audit
{{% endif %}}
# variables = var_auditd_disk_full_action=action1

source common.sh
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/bash
{{% if "ubuntu" in product%}}
# packages = auditd
{{% else %}}
# packages = audit
{{% endif %}}
# variables = var_auditd_disk_full_action=action1|action2|action3

source common.sh
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/bash
{{% if "ubuntu" in product%}}
# packages = auditd
{{% else %}}
# packages = audit
{{% endif %}}
# variables = var_auditd_disk_full_action=halt

source common.sh
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
#!/bin/bash
{{% if "ubuntu" in product%}}
# packages = auditd
{{% else %}}
# packages = audit
{{% endif %}}

source common.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/bash
{{% if "ubuntu" in product%}}
# packages = auditd
{{% else %}}
# packages = audit
{{% endif %}}

source common.sh

Expand Down
1 change: 1 addition & 0 deletions products/ol7/product.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ cpes:
# Mapping of CPE platform to package
platform_package_overrides:
login_defs: "shadow-utils"
openssl-pkcs11: "pam_pkcs11"

reference_uris:
cis: 'https://www.cisecurity.org/benchmark/oracle_linux/'
1 change: 1 addition & 0 deletions products/rhel7/product.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ cpes:
# Mapping of CPE platform to package
platform_package_overrides:
login_defs: "shadow-utils"
openssl-pkcs11: "pam_pkcs11"

centos_pkg_release: "53a7ff4b"
centos_pkg_version: "f4a80eb5"
Expand Down
2 changes: 2 additions & 0 deletions products/ubuntu1604/product.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ cpes:
check_id: installed_OS_is_ubuntu1604

platform_package_overrides:
audit: auditd
gdm: gdm3
grub2: grub2-common
net-snmp: snmp
nss-pam-ldapd: libpam-ldap
pam: libpam-runtime
shadow: login
sssd: sssd-common
openssl-pkcs11: libpam-pkcs11

reference_uris:
cis: 'https://www.cisecurity.org/benchmark/ubuntu_linux/'
2 changes: 2 additions & 0 deletions products/ubuntu1804/product.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ cpes:
check_id: installed_OS_is_ubuntu1804

platform_package_overrides:
audit: auditd
gdm: gdm3
grub2: grub2-common
net-snmp: snmp
nss-pam-ldapd: libpam-ldap
pam: libpam-runtime
shadow: login
sssd: sssd-common
openssl-pkcs11: libpam-pkcs11

reference_uris:
cis: 'https://www.cisecurity.org/benchmark/ubuntu_linux/'
1 change: 1 addition & 0 deletions products/ubuntu2004/product.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ platform_package_overrides:
pam: libpam-runtime
shadow: login
sssd: sssd-common
openssl-pkcs11: libpam-pkcs11

reference_uris:
cis: 'https://www.cisecurity.org/benchmark/ubuntu_linux/'

0 comments on commit 795f076

Please sign in to comment.