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

accounts_password_set_max_life_existing does not exclude no passwords or locked accounts #9954

Merged
merged 9 commits into from
Jan 7, 2023

Conversation

dodys
Copy link
Contributor

@dodys dodys commented Dec 12, 2022

Description:

  • At least CIS for Ubuntu 22.04 this rule specifically has the following check in both audit and remediation: [^!*].
  • Please confirm that this is also the case for other distros.

@github-actions
Copy link

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

@github-actions
Copy link

github-actions bot commented Dec 12, 2022

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

Click here to see the full diff
bash remediation for rule 'xccdf_org.ssgproject.content_rule_accounts_password_set_max_life_existing' differs.
--- xccdf_org.ssgproject.content_rule_accounts_password_set_max_life_existing
+++ xccdf_org.ssgproject.content_rule_accounts_password_set_max_life_existing
@@ -4,4 +4,4 @@
 
 while IFS= read -r i; do
 chage -M $var_accounts_maximum_age_login_defs $i
-done < <(awk -v var="$var_accounts_maximum_age_login_defs" -F: '$5 > var || $5 == "" {print $1}' /etc/shadow)
+done < <(awk -v var="$var_accounts_maximum_age_login_defs" -F: '(/^[^:]+:[^!*]/ && ($5 > var || $5 == "")) {print $1}' /etc/shadow)

ansible remediation for rule 'xccdf_org.ssgproject.content_rule_accounts_password_set_max_life_existing' differs.
--- xccdf_org.ssgproject.content_rule_accounts_password_set_max_life_existing
+++ xccdf_org.ssgproject.content_rule_accounts_password_set_max_life_existing
@@ -6,8 +6,8 @@
 
 - name: Collect users with not correct maximum time period between password changes
 ansible.builtin.command:
- cmd: awk -F':' '$5 > {{ var_accounts_maximum_age_login_defs }} || $5 == "" {print
- $1}' /etc/shadow
+ cmd: awk -F':' '(/^[^:]+:[^!*]/ && ($5 > {{ var_accounts_maximum_age_login_defs
+ }} || $5 == "")) {print $1}' /etc/shadow
 register: user_names
 tags:
 - CCE-82473-0

@dodys dodys requested a review from yuumasato December 13, 2022 16:12
@marcusburghardt marcusburghardt self-assigned this Dec 14, 2022
@marcusburghardt marcusburghardt added OVAL OVAL update. Related to the systems assessments. Bash Bash remediation update. labels Dec 14, 2022
@marcusburghardt marcusburghardt added this to the 0.1.66 milestone Dec 14, 2022
Copy link
Member

@marcusburghardt marcusburghardt left a comment

Choose a reason for hiding this comment

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

The assessment and bash remediation are working fine. Could you also update the Ansible remediation, please?

@dodys dodys added the Ansible Ansible remediation update. label Dec 19, 2022
Copy link
Member

@marcusburghardt marcusburghardt left a comment

Choose a reason for hiding this comment

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

The comments here are also valid for #9955 . After these small details I believe we they will be good to be merged.

Copy link
Member

@marcusburghardt marcusburghardt left a comment

Choose a reason for hiding this comment

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

The comments here are also valid for #9955 . After these small details I believe we they will be good to be merged.

@dodys dodys changed the title accounts_password_set_max_life_existing does not exclude system accounts accounts_password_set_max_life_existing does not exclude no passwords or locked accounts Jan 5, 2023
test user account.

Suggested-by: Marcus Burghardt <maburgha@redhat.com>
@codeclimate
Copy link

codeclimate bot commented Jan 6, 2023

Code Climate has analyzed commit 5eacd51 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 49.9% (0.1% change).

View more on Code Climate.

Copy link
Member

@marcusburghardt marcusburghardt left a comment

Choose a reason for hiding this comment

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

Thanks @dodys

@marcusburghardt marcusburghardt merged commit 6737e93 into ComplianceAsCode:master Jan 7, 2023
@dodys dodys deleted the max_life_existing branch April 17, 2023 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ansible Ansible remediation update. Bash Bash remediation update. OVAL OVAL update. Related to the systems assessments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants