diff --git a/linux_os/guide/system/accounts/accounts-restrictions/password_storage/accounts_password_last_change_is_in_past/oval/shared.xml b/linux_os/guide/system/accounts/accounts-restrictions/password_storage/accounts_password_last_change_is_in_past/oval/shared.xml index b49ac7a37bc..2e6f7960e58 100644 --- a/linux_os/guide/system/accounts/accounts-restrictions/password_storage/accounts_password_last_change_is_in_past/oval/shared.xml +++ b/linux_os/guide/system/accounts/accounts-restrictions/password_storage/accounts_password_last_change_is_in_past/oval/shared.xml @@ -13,47 +13,54 @@ ^(!|!!|!\*|\*|!locked)$ - + .* state_accounts_password_all_chage_past_has_no_password - - 86400 - - + + + + + + + 0 - - + + - - var_accounts_password_last_change_time_diff + + var_accounts_password_last_change_is_in_past_time_diff - - - 86400000 + + - + diff --git a/linux_os/guide/system/accounts/accounts-restrictions/password_storage/accounts_password_last_change_is_in_past/tests/last_change_long_time_ago.pass.sh b/linux_os/guide/system/accounts/accounts-restrictions/password_storage/accounts_password_last_change_is_in_past/tests/last_change_long_time_ago.pass.sh new file mode 100644 index 00000000000..98080f3fe07 --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-restrictions/password_storage/accounts_password_last_change_is_in_past/tests/last_change_long_time_ago.pass.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# create valid testuser entry in /etc/shadow +echo 'testuservalid:$6$exIFis0tobKRcGBk$b.UR.Z8h96FdxJ1bgA/vhdnp0Lsm488swdILNguQX/5qH5hdmClyYb5xk3TpELXWzr4JOiTlHfRkPsXSjMPjv0:10000:1:60:7:35::' >> /etc/shadow + +TODAY="$(($(date +%s)/86400))" +MANY_YEARS_AGO="$(( TODAY - 10000 ))" + +# Ensure the sp_lstchg field holds a value which represents a date in the past +awk -v newdate="$MANY_YEARS_AGO" 'BEGIN { FS=":"; OFS = ":"} + {$3=newdate; print}' /etc/shadow > /etc/shadow_new + +mv /etc/shadow_new /etc/shadow