Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include rule for checking password last change in RHEL #10243

Merged
merged 3 commits into from
Feb 27, 2023

Conversation

marcusburghardt
Copy link
Member

@marcusburghardt marcusburghardt commented Feb 21, 2023

Description:

The accounts_password_last_change_is_in_past rule also satisfies the CIS requirements for RHEL7, RHEL8 and RHEL9.

Rationale:

Better CIS coverage for RHEL.

@marcusburghardt marcusburghardt added RHEL Red Hat Enterprise Linux product related. CIS CIS Benchmark related. labels Feb 21, 2023
@marcusburghardt marcusburghardt added this to the 0.1.67 milestone Feb 21, 2023
@marcusburghardt marcusburghardt requested a review from a team as a code owner February 21, 2023 14:23
@github-actions
Copy link

github-actions bot commented Feb 21, 2023

Start a new ephemeral environment with changes proposed in this pull request:

rhel8 (from CTF) Environment (using Fedora as testing environment)
Open in Gitpod

Fedora Testing Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

@jan-cerny jan-cerny self-assigned this Feb 22, 2023
Copy link
Collaborator

@jan-cerny jan-cerny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI fail looks legit:

xccdf_org.ssgproject.content_rule_accounts_password_last_change_is_in_past:unknown

from a quick look I can't find what it is

The accounts_password_last_change_is_in_past rule also satisfies the
CIS requirements for RHEL7, RHEL8 and RHEL9.
The OVAL check returns "unknown" when there is no password defined in
the /etc/shadow file. It is necessary to include a test scenario for
this case since it is relatively common to happen.
@github-actions
Copy link

This datastream diff is auto generated by the check Compare DS/Generate Diff

Click here to see the full diff
New content has different text for rule 'xccdf_org.ssgproject.content_rule_accounts_password_last_change_is_in_past'.
--- xccdf_org.ssgproject.content_rule_accounts_password_last_change_is_in_past
+++ xccdf_org.ssgproject.content_rule_accounts_password_last_change_is_in_past
@@ -8,6 +8,12 @@
 [warning]:
 Automatic remediation is not available, in order to avoid any system disruption.
 
+[reference]:
+5.6.1.5
+
 [rationale]:
 If a user recorded password change date is in the future then they could
 bypass any set password expiration.
+
+[ident]:
+CCE-86525-3

OVAL for rule 'xccdf_org.ssgproject.content_rule_accounts_password_last_change_is_in_past' differs.
--- oval:ssg-accounts_password_last_change_is_in_past:def:1
+++ oval:ssg-accounts_password_last_change_is_in_past:def:1
@@ -1,2 +1,3 @@
-criteria None
-criterion oval:ssg-test_accounts_password_last_change_time_secs:tst:1
+criteria OR
+criterion oval:ssg-test_accounts_password_last_change_is_in_past:tst:1
+criterion oval:ssg-test_accounts_password_last_change_is_in_past_no_pass:tst:1

@marcusburghardt marcusburghardt marked this pull request as draft February 23, 2023 14:57
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Used by openshift-ci bot. label Feb 23, 2023
The previous check was reporting "unknown" when there is no password
defined in the /etc/shadow file of the checked system. Before, it was
not clear the reason for the unknown result. Therefore, a new test was
included to check if passwords are inexistent in the system. The rule is
no longer reporting "unknown" and the generated reports are more clearly
informing which checks passed or not.
@marcusburghardt marcusburghardt marked this pull request as ready for review February 23, 2023 16:09
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Used by openshift-ci bot. label Feb 23, 2023
@codeclimate
Copy link

codeclimate bot commented Feb 23, 2023

Code Climate has analyzed commit 8def7b5 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 51.7% (0.0% change).

View more on Code Climate.

@marcusburghardt
Copy link
Member Author

The CI fail looks legit:

xccdf_org.ssgproject.content_rule_accounts_password_last_change_is_in_past:unknown

from a quick look I can't find what it is

The 8def7b5 fixes this issue. More details in the commit description.

Copy link
Collaborator

@jan-cerny jan-cerny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I have checked that the rule has been tested by Automatus on cs8 and cs9.

@jan-cerny jan-cerny merged commit ce4ce69 into ComplianceAsCode:master Feb 27, 2023
@marcusburghardt marcusburghardt deleted the cis_rhel_pass_past branch February 27, 2023 10:46
@marcusburghardt marcusburghardt added Update Rule Issues or pull requests related to Rules updates. Update Profile Issues or pull requests related to Profiles updates. labels Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CIS CIS Benchmark related. RHEL Red Hat Enterprise Linux product related. Update Profile Issues or pull requests related to Profiles updates. Update Rule Issues or pull requests related to Rules updates.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5.5.1.5 Ensure all users last password change date is in the past (Scored)
2 participants