From f098b44d5fd61834adc015a5512506714c5a8928 Mon Sep 17 00:00:00 2001
From: Kyle MacLeod <kyle.macleod@windriver.com>
Date: Wed, 26 Jul 2023 10:58:56 -0400
Subject: [PATCH] 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
---
 utilities/platform-util/scripts/update-iso.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utilities/platform-util/scripts/update-iso.sh b/utilities/platform-util/scripts/update-iso.sh
index e031581d..d4a79729 100755
--- a/utilities/platform-util/scripts/update-iso.sh
+++ b/utilities/platform-util/scripts/update-iso.sh
@@ -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