8000 Fix set_password_hashing_min_rounds_logindefs by vojtapolasek · Pull Request #13004 · ComplianceAsCode/content · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix set_password_hashing_min_rounds_logindefs #13004

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,29 @@
- name: "{{{ rule_title }}} - Ensure SHA_CRYPT_MIN_ROUNDS 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: no
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

- name: "{{{ rule_title }}} - Ensure SHA_CRYPT_MAX_ROUNDS 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: no
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

- name: "{{ rule_title }} - SHA_CRYPT_MIN_ROUNDS add configuration if not found"
- name: "{{{ rule_title }}} - 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
state: present
when: etc_login_defs_sha_crypt_min_rounds | length == 0

- name: "{{ rule_title }} - SHA_CRYPT_MAX_ROUNDS add configuration if not found"
- name: "{{{ rule_title }}} - 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
state: present
when: etc_login_defs_sha_crypt_max_rounds | length == 0

2 changes: 1 addition & 1 deletion products/rhel8/profiles/stig.profile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ selections:
- var_password_pam_remember_control_flag=requisite_or_required
- var_selinux_state=enforcing
- var_selinux_policy_name=targeted
- var_password_pam_unix_rounds=5000
- var_password_hashing_min_rounds_login_defs=100000
- var_password_pam_minlen=15
- var_password_pam_ocredit=1
- var_password_pam_dcredit=1
Expand Down
2 changes: 1 addition & 1 deletion tests/data/profile_stability/rhel8/stig.profile
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ selections:
- var_password_pam_remember_control_flag=requisite_or_required
- var_selinux_state=enforcing
- var_selinux_policy_name=targeted
- var_password_pam_unix_rounds=5000
- var_password_hashing_min_rounds_login_defs=100000
- var_password_pam_minlen=15
- var_password_pam_ocredit=1
- var_password_pam_dcredit=1
Expand Down
2 changes: 1 addition & 1 deletion tests/data/profile_stability/rhel8/stig_gui.profile
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ selections:
- var_password_pam_remember_control_flag=requisite_or_required
- var_selinux_state=enforcing
- var_selinux_policy_name=targeted
- var_password_pam_unix_rounds=5000
- var_password_hashing_min_rounds_login_defs=100000
- var_password_pam_minlen=15
- var_password_pam_ocredit=1
- var_password_pam_dcredit=1
Expand Down
Loading
0