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

U2404 5414 #12636

Merged
merged 4 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 4 additions & 3 deletions controls/cis_ubuntu2404.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2052,10 +2052,11 @@ controls:
levels:
- l1_server
- l1_workstation
related_rules:
rules:
- set_password_hashing_algorithm_logindefs
status: planned
notes: TODO. Partial/incorrect implementation exists.See related rules. Analogous to ubuntu2204/5.4.4.
- var_password_hashing_algorithm=cis_ubuntu2404
status: automated
notes: Rule allows either SHA512 or YESCRYPT

- id: 5.4.1.5
title: Ensure inactive password lock is configured (Automated)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
lineinfile:
dest: /etc/login.defs
regexp: ^#?ENCRYPT_METHOD
line: ENCRYPT_METHOD {{ var_password_hashing_algorithm }}
line: ENCRYPT_METHOD {{ var_password_hashing_algorithm.split('|')[0] }}
state: present
create: yes
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# platform = multi_platform_all

{{{ bash_instantiate_variables("var_password_hashing_algorithm") }}}

# Allow multiple algorithms, but choose the first one for remediation
#
var_password_hashing_algorithm="$(echo $var_password_hashing_algorithm | cut -d \| -f 1)"

{{{ bash_replace_or_append('/etc/login.defs', '^ENCRYPT_METHOD', "$var_password_hashing_algorithm", '%s %s') }}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
# variables = var_password_hashing_algorithm=YESCRYPT

# Make sure ENCRYPT_METHOD is YESCRYPT
if grep -q "^ENCRYPT_METHOD" /etc/login.defs; then
sed -i "s/^ENCRYPT_METHOD\b.*/ENCRYPT_METHOD YESCRYPT/" /etc/login.defs
else
echo "ENCRYPT_METHOD YESCRYPT" >> /etc/login.defs
fi
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ options:
SHA512: SHA512
SHA256: SHA256
yescrypt: YESCRYPT
cis_ubuntu2404: SHA512|YESCRYPT
Loading