Closed marcofortina closed 6 months ago
I did some tests and it seams this should fix this issue:
diff --git a/linux_os/guide/services/cron_and_at/restrict_at_cron_users/file_groupowner_cron_allow/rule.yml b/linux_os/guide/services/cron_and_at/restrict_at_cron_users/file_groupowner_cron_allow/rule.yml
index d7ba7b7b18..031c7bfbd3 100644
--- a/linux_os/guide/services/cron_and_at/restrict_at_cron_users/file_groupowner_cron_allow/rule.yml
+++ b/linux_os/guide/services/cron_and_at/restrict_at_cron_users/file_groupowner_cron_allow/rule.yml
@@ -3,12 +3,18 @@ documentation_complete: true
title: 'Verify Group Who Owns /etc/cron.allow file'
+{{% if "ubuntu" in product %}}
+ {{% set target_group="crontab" %}}
+{{% else %}}
+ {{% set target_group="root" %}}
+{{% endif %}}
+
description: |-
- If <tt>/etc/cron.allow</tt> exists, it must be group-owned by <tt>root</tt>.
- {{{ describe_file_group_owner(file="/etc/cron.allow", group="root") }}}
+ If <tt>/etc/cron.allow</tt> exists, it must be group-owned by <tt>target_group</tt>.
+ {{{ describe_file_group_owner(file="/etc/cron.allow", group=target_group) }}}
rationale: |-
- If the owner of the cron.allow file is not set to root, the possibility exists for an
+ If the owner of the cron.allow file is not set to target_group, the possibility exists for an
unauthorized user to view or edit sensitive information.
severity: medium
@@ -37,14 +43,18 @@ references:
stigid@ol7: OL07-00-021120
stigid@rhel7: RHEL-07-021120
-ocil_clause: '{{{ ocil_clause_file_group_owner(file="/etc/cron.allow", group="root") }}}'
+ocil_clause: '{{{ ocil_clause_file_group_owner(file="/etc/cron.allow", group=target_group) }}}'
ocil: |-
- {{{ ocil_file_group_owner(file="/etc/cron.allow", group="root") }}}
+ {{{ ocil_file_group_owner(file="/etc/cron.allow", group=target_group) }}}
template:
name: file_groupowner
vars:
filepath: /etc/cron.allow
missing_file_pass: 'true'
+{{% if "ubuntu" in product %}}
+ gid_or_name: '112'
+{{% else %}}
gid_or_name: '0'
+{{% endif %}}
I will create a PR for this.
@marcofortina thanks for reporting this. I believe this is an issue with CIS on Ubuntu 22.04 only, they seem to have already fixed it in CIS for Ubuntu 20.04. Nevertheless we can apply the fix here for both.
Description of problem:
Following remediation script for this rule, will produce an error on user allowed to run cron.
SCAP Security Guide Version:
master branch
Operating System Version:
Ubuntu 22.04 LTS
Steps to Reproduce:
ubuntu
user to run cron:Additional Information/Debugging Steps:
File /etc/cron.allow should be owned by the group
crontab
:Ticket 21619 was also opened to CIS WorkBench community.