This caused the play to fail in my Packer job on Azure
In Azure the root password should be locked or else it is removed in the build process.
How to lock the root password?
passwd -l root will not lock the password, only a delete followed by a lock will:
passwd -d root;passwd -l root
man 5 shadow
encrypted password
Refer to crypt(3) for details on how this string is interpreted.
If the password field contains some string that is not a valid result of crypt(3), for instance ! or *, the user will not be able to use a unix password to log in (but the user may log in the system by other means).
This field may be empty, in which case no passwords are required to authenticate as the specified login name. However, some applications which read the /etc/shadow file may decide not to permit any access at all if the password field is empty.
A password field which starts with an exclamation mark means that the password is locked. The remaining characters on the line represent the password field before the password was locked.
A new assert was introduced in tasks/main.yml, but the .
https://github.com/ansible-lockdown/RHEL8-CIS/blob/6d850c594ba7917ce6c9dfff940c705fd34034f7/tasks/main.yml#L56
No root password
With
*
in the second field of the shadow file, as the shadow manual page says, the commandpasswd -S root
yields:(not
Password locked
)This caused the play to fail in my Packer job on Azure
In Azure the root password should be locked or else it is removed in the build process.
How to lock the root password?
passwd -l root
will not lock the password, only a delete followed by a lock will:man 5 shadow