password generation utility was still python2 master
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Fri, 28 Feb 2020 07:34:07 +0000 (08:34 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Fri, 28 Feb 2020 07:34:07 +0000 (08:34 +0100)
build.sh

index 3f2c65e..a051700 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -342,16 +342,15 @@ EOF
     if [ -z "$ROOT_PASSWORD" ] ; then
         # Generate an encrypted password with crypt() if not defined
         # in a static configuration.
-        ROOT_PASSWORD=$(python <<EOF
-import crypt, random, string
-salt = [random.choice(string.letters + string.digits + "./") for i in range(0,8)]
-print crypt.crypt('$PLC_ROOT_PASSWORD', '\$1\$' + "".join(salt) + '\$')
+        ROOT_PASSWORD=$(python3 << EOF
+import crypt
+print(crypt.crypt('$PLC_ROOT_PASSWORD', crypt.METHOD_SHA256))
 EOF
 )
     fi
 
     # build/passwd copied out by prep.sh
-    sed -e "s@^root:[^:]*:\(.*\)@root:$ROOT_PASSWORD:\1@" ${VARIANT}/passwd >$OVERLAY/etc/passwd
+    sed -e "s@^root:[^:]*:\(.*\)@root:$ROOT_PASSWORD:\1@" ${VARIANT}/passwd > $OVERLAY/etc/passwd
 
 # this is more harmful than helpful
 # idea being, since we start a full-featured fedora system now, it would