RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1673954 - Rule xccdf_org.ssgproject.content_rule_aide_periodic_cron_checking fails even though crontab entry is a proposed remediation
Summary: Rule xccdf_org.ssgproject.content_rule_aide_periodic_cron_checking fails even...
Keywords:
Status: CLOSED DUPLICATE of bug 1658036
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: scap-security-guide
Version: 7.6
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Watson Yuuma Sato
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-02-08 14:36 UTC by Renaud Métrich
Modified: 2023-09-07 19:43 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-02-11 09:18:54 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Renaud Métrich 2019-02-08 14:36:22 UTC
Description of problem:

On RHEL7.6 systems, the xccdf_org.ssgproject.content_rule_aide_periodic_cron_checking rule fails when the /etc/crontab file contains the proposed remediation for a "weekly" aide check:

# cat /etc/crontab
05 4 * * 0 root /usr/sbin/aide --check

"To implement a weekly execution of AIDE at 4:05am using cron, add the following line to /etc/crontab:
05 4 * * 0 root /usr/sbin/aide --check
"


Version-Release number of selected component (if applicable):

scap-security-guide-0.1.40-12.el7.noarch


How reproducible:

Always


Steps to Reproduce:
1. Create remediation entry in /etc/crontab for a weekly check

# cat /etc/crontab
05 4 * * 0 root /usr/sbin/aide --check

2. Execute the rule

# oscap xccdf eval --fetch-remote-resources --report report.html --results results.xml --profile xccdf_org.ssgproject.content_profile_pci-dss --rule xccdf_org.ssgproject.content_rule_aide_periodic_cron_checking /usr/share/xml/scap/ssg/content/ssg-rhel7-ds.xml


Actual results:

Result  fail


Expected results:

Result  pass


Additional info:

Looking at the code (shared/checks/oval/aide_periodic_cron_checking.xml), we can see the following pattern being checked for /etc/crontab:

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
 24   <ind:textfilecontent54_test check="all" check_existence="all_exist" comment="run aide with cron" id="test_aide_periodic_cron_checking" version="1">
 25     <ind:object object_ref="object_test_aide_periodic_cron_checking" />
 26   </ind:textfilecontent54_test>
 27   <ind:textfilecontent54_object comment="run aide with cron" id="object_test_aide_periodic_cron_checking" version="1">
 28     <ind:filepath>/etc/crontab</ind:filepath>
 29     <ind:pattern operation="pattern match">^(([0-9]*[\s]*[0-9]*[\s]*\*[\s]*\*[\s]*\*)|@(hourly|daily|weekly|monthly))[\s]*root[\s]*/usr/sbin/aide[\s]*\-\-check.*$</ind:pattern>
 30     <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
 31   </ind:textfilecontent54_object>
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Pattern: ^(([0-9]*[\s]*[0-9]*[\s]*\*[\s]*\*[\s]*\*)|@(hourly|daily|weekly|monthly))[\s]*root[\s]*/usr/sbin/aide[\s]*\-\-check.*$

The fifth field must here be "*" and a weekday number (0 -> 7) isn't expected at all, which is a bug.

Proposed new pattern: ^(([0-9]*[\s]*[0-9]*[\s]*\*[\s]*\*[\s]*(\*|[0-7]|sun|mon|tue|wed|thu|fri|sat))|@(hourly|daily|weekly|monthly))[\s]*root[\s]*/usr/sbin/aide[\s]*\-\-check.*$

This allows setting the weekday numerically or using the short name.

Still, this may not be sufficient because we should also allow ranges and lists of numbers for the 5 field at least.

Comment 2 Watson Yuuma Sato 2019-02-11 09:18:54 UTC
Hello Renaud, thank you for the regex suggestion.

*** This bug has been marked as a duplicate of bug 1658036 ***


Note You need to log in before you can comment on or make changes to this bug.