Fix openssl passwd args for initial password change

This commit fixes the incompatible --crypt option for older
releases of openssl. We also add the -quiet option to suppress
the warning message if a password is longer than 8 characters.

Test Plan:
PASS: Run this script with --initial-password option in centos
      environment where openssl version is:
      OpenSSL 1.0.2k-fips  26 Jan 2017
PASS: Run this script with --initial-password option in debian
      environment where openssl version is:
      OpenSSL 1.1.1n  15 Mar 2022

Closes-Bug: 2028787

Signed-off-by: Kyle MacLeod <kyle.macleod@windriver.com>
Change-Id: I2e87a6e8c1fa9fe4d3c1dc8982995a09f997f47b
This commit is contained in:
Kyle MacLeod 2023-07-26 10:58:56 -04:00
parent 40e18a57eb
commit f098b44d5f

@ -435,7 +435,7 @@ fi
if [ -n "${INITIAL_PASSWORD}" ]; then
ilog "Patching kickstart.cfg for custom default password"
sed -i.bak 's@sudo --password 4SuW8cnXFyxsk@sudo --password 4SuW8cnXFyxsk; echo "sysadmin:'"$(openssl passwd --crypt "$INITIAL_PASSWORD")"'" | chpasswd -e@' "${BUILDDIR}/kickstart/kickstart.cfg"
sed -i.bak 's@sudo --password 4SuW8cnXFyxsk@sudo --password 4SuW8cnXFyxsk; echo "sysadmin:'"$(openssl passwd -quiet -crypt "$INITIAL_PASSWORD")"'" | chpasswd -e@' "${BUILDDIR}/kickstart/kickstart.cfg"
fi
unmount_efiboot_img