Skip to content

Commit

Permalink
Improve rule file_permssions_crontab
Browse files Browse the repository at this point in the history
This change solves problem of failing rule `file_permissions_crontab`
when the `crontabs` RPM package isn't installed. This situation happens
namely when builidng a CS9 bootable container image because the
base image doesn't contain the crontabs RPM package.

In profiles which contain rules checking permissions on files that are
provided by `crontabs`, we will install the `crontabs` package by
installing the `cronie` package which provides the `cron` service and
has `crontabs` as dependency. This will be achieved by adding the rule
`package_cron_installed` to these profiles.

Notice that the `cronie` package will be installed as a result of rule
`package_cron_installed` which installs either `cron` or `cronie`
based on the product name. This rule is fixed by this commit because
the correct package name for RHEL 9 is `cronie` as well.
  • Loading branch information
jan-cerny committed Dec 3, 2024
1 parent 4c8b22c commit c8d0381
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions controls/cis_rhel10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1104,6 +1104,7 @@ controls:
- l1_workstation
status: automated
rules:
- package_cron_installed
- service_crond_enabled

- id: 2.4.1.2
Expand Down
1 change: 1 addition & 0 deletions controls/cis_rhel9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,7 @@ controls:
- l1_workstation
status: automated
rules:
- package_cron_installed
- service_crond_enabled

- id: 2.4.1.2
Expand Down
1 change: 1 addition & 0 deletions controls/srg_gpos/SRG-OS-000480-GPOS-00227.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ controls:
- package_nss-tools_installed
- package_policycoreutils-python-utils_installed
- package_policycoreutils_installed
- package_cron_installed

# mount options
- mount_option_nodev_remote_filesystems
Expand Down
1 change: 1 addition & 0 deletions controls/stig_rhel9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,7 @@ controls:
- medium
title: RHEL 9 cron configuration directories must have a mode of 0700 or less permissive.
rules:
- package_cron_installed
- file_permissions_cron_d
- file_permissions_cron_daily
- file_permissions_cron_hourly
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{% if product in ["rhel10", "sle12", "sle15"] %}}
{{% if product in ["rhel9", "rhel10", "sle12", "sle15"] %}}
{{% set package_name = "cronie" %}}
{{% else %}}
{{% set package_name = "cron" %}}
Expand All @@ -15,6 +15,7 @@ rationale: 'The cron service allow periodic job execution, needed for almost all
severity: medium

identifiers:
cce@rhel9: CCE-86170-8
cce@rhel10: CCE-86619-4
cce@sle12: CCE-92263-3
cce@sle15: CCE-91379-8
Expand Down Expand Up @@ -42,6 +43,7 @@ template:
name: package_installed
vars:
pkgname: cron
pkgname@rhel9: cronie
pkgname@rhel10: cronie
pkgname@sle12: cronie
pkgname@sle15: cronie
1 change: 1 addition & 0 deletions products/rhel9/profiles/hipaa.profile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ selections:
- package_talk-server_removed
- package_telnet_removed
- package_telnet-server_removed
- package_cron_installed
- service_crond_enabled
- service_telnet_disabled
- use_kerberos_security_all_exports
Expand Down
1 change: 0 additions & 1 deletion shared/references/cce-redhat-avail.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
CCE-86170-8
CCE-86178-1
CCE-86179-9
CCE-86180-7
Expand Down
1 change: 1 addition & 0 deletions tests/data/profile_stability/rhel9/cis.profile
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ selections:
- package_audit_installed
- package_bind_removed
- package_chrony_installed
- package_cron_installed
- package_cyrus-imapd_removed
- package_dhcp_removed
- package_dnsmasq_removed
Expand Down
1 change: 1 addition & 0 deletions tests/data/profile_stability/rhel9/cis_server_l1.profile
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ selections:
- package_aide_installed
- package_bind_removed
- package_chrony_installed
- package_cron_installed
- package_cyrus-imapd_removed
- package_dhcp_removed
- package_dnsmasq_removed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ selections:
- package_aide_installed
- package_bind_removed
- package_chrony_installed
- package_cron_installed
- package_cyrus-imapd_removed
- package_dhcp_removed
- package_dnsmasq_removed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ selections:
- package_audit_installed
- package_bind_removed
- package_chrony_installed
- package_cron_installed
- package_cyrus-imapd_removed
- package_dhcp_removed
- package_dnsmasq_removed
Expand Down
1 change: 1 addition & 0 deletions tests/data/profile_stability/rhel9/stig.profile
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ selections:
- package_audispd-plugins_installed
- package_audit_installed
- package_chrony_installed
- package_cron_installed
- package_crypto-policies_installed
- package_fapolicyd_installed
- package_firewalld_installed
Expand Down

0 comments on commit c8d0381

Please sign in to comment.