-
Notifications
You must be signed in to change notification settings - Fork 717
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
[Stabilization]: fix set_password_hashing_min_rounds_logindefs #12998
Merged
Mab879
merged 2 commits into
ComplianceAsCode:stabilization-v0.1.76
from
vojtapolasek:stab_fix_rhel8_stig_hashing_rounds
Feb 7, 2025
Merged
[Stabilization]: fix set_password_hashing_min_rounds_logindefs #12998
Mab879
merged 2 commits into
ComplianceAsCode:stabilization-v0.1.76
from
vojtapolasek:stab_fix_rhel8_stig_hashing_rounds
Feb 7, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
in RHEL 8 STIG, there was a wrong variable used for the rule set_password_hashing_min_rounds_logindefs. The variable was actually not included in the profile at all and therefore its default value of 5000 was used. However, stig requires values of 100000. Also, the variable var_password_pam_unix_rounds was used in the file, but in fact it is not used by any rule in the profile.It got removed to reduce confusion.
the regex was overly complicated and it did not match values as expected. Also conditionals were enhanced so that they check if variables containing values slurped from the file actually exist at all.
vojtapolasek
added
bugfix
Fixes to reported bugs.
Ansible
Ansible remediation update.
backported-into-stabilization
PRs which were cherry-picked during stabilization process.
RHEL8
Red Hat Enterprise Linux 8 product related.
STIG
STIG Benchmark related.
labels
Feb 7, 2025
This datastream diff is auto generated by the check Click here to see the full diffansible remediation for rule 'xccdf_org.ssgproject.content_rule_set_password_hashing_min_rounds_logindefs' differs.
--- xccdf_org.ssgproject.content_rule_set_password_hashing_min_rounds_logindefs
+++ xccdf_org.ssgproject.content_rule_set_password_hashing_min_rounds_logindefs
@@ -55,11 +55,12 @@
has Minimum Value of 5000
ansible.builtin.replace:
path: /etc/login.defs
- regexp: (^\s*SHA_CRYPT_MIN_ROUNDS\s+)(?!(?:[5-9]\d{3,}|\d{5,}))\S*(\s*$)
+ regexp: (^\s*SHA_CRYPT_MIN_ROUNDS\s+)(?:\d+)(.*$)
replace: \g<1>{{ var_password_hashing_min_rounds_login_defs }}\g<2>
backup: false
- when: etc_login_defs_sha_crypt_min_rounds | length > 0 and etc_login_defs_sha_crypt_min_rounds
- | first | int < var_password_hashing_min_rounds_login_defs | int
+ when: etc_login_defs_sha_crypt_min_rounds is defined and etc_login_defs_sha_crypt_min_rounds
+ | length > 0 and etc_login_defs_sha_crypt_min_rounds | first | int < var_password_hashing_min_rounds_login_defs
+ | int
tags:
- CCE-89707-4
- DISA-STIG-RHEL-08-010130
@@ -74,11 +75,12 @@
has Minimum Value of 5000
ansible.builtin.replace:
path: /etc/login.defs
- regexp: (^\s*SHA_CRYPT_MAX_ROUNDS\s+)(?!(?:[5-9]\d{3,}|\d{5,}))\S*(\s*$)
+ regexp: (^\s*SHA_CRYPT_MAX_ROUNDS\s+)(?:\d+)(.*$)
replace: \g<1>{{ var_password_hashing_min_rounds_login_defs }}\g<2>
backup: false
- when: etc_login_defs_sha_crypt_max_rounds | length > 0 and etc_login_defs_sha_crypt_max_rounds
- | first | int < var_password_hashing_min_rounds_login_defs | int
+ when: etc_login_defs_sha_crypt_max_rounds is defined and etc_login_defs_sha_crypt_max_rounds
+ | length > 0 and etc_login_defs_sha_crypt_max_rounds | first | int < var_password_hashing_min_rounds_login_defs
+ | int
tags:
- CCE-89707-4
- DISA-STIG-RHEL-08-010130
@@ -89,7 +91,8 @@
- restrict_strategy
- set_password_hashing_min_rounds_logindefs
-- name: '{{ rule_title }} - SHA_CRYPT_MIN_ROUNDS add configuration if not found'
+- name: Set Password Hashing Rounds in /etc/login.defs - SHA_CRYPT_MIN_ROUNDS add
+ configuration if not found
ansible.builtin.lineinfile:
line: SHA_CRYPT_MIN_ROUNDS {{ var_password_hashing_min_rounds_login_defs }}
path: /etc/login.defs
@@ -105,7 +108,8 @@
- restrict_strategy
- set_password_hashing_min_rounds_logindefs
-- name: '{{ rule_title }} - SHA_CRYPT_MAX_ROUNDS add configuration if not found'
+- name: Set Password Hashing Rounds in /etc/login.defs - SHA_CRYPT_MAX_ROUNDS add
+ configuration if not found
ansible.builtin.lineinfile:
line: SHA_CRYPT_MAX_ROUNDS {{ var_password_hashing_min_rounds_login_defs }}
path: /etc/login.defs |
Mab879
approved these changes
Feb 7, 2025
Waving Automatus tests as they are only failing due missing tests. |
Mab879
merged commit Feb 7, 2025
6a3228c
into
ComplianceAsCode:stabilization-v0.1.76
93 of 96 checks passed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Ansible
Ansible remediation update.
backported-into-stabilization
PRs which were cherry-picked during stabilization process.
bugfix
Fixes to reported bugs.
RHEL8
Red Hat Enterprise Linux 8 product related.
STIG
STIG Benchmark related.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
Rationale:
Review Hints: