From 751284fa595c4caaba01413c90f7ea7f35675833 Mon Sep 17 00:00:00 2001 From: Ing Date: Wed, 6 Nov 2024 20:33:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20menu.sh=EF=BC=8C=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=E5=AF=86=E7=A0=81=E5=93=88=E5=B8=8C=E7=AE=97=E6=B3=95?= =?UTF-8?q?=E4=B8=BA=20openssl=EF=BC=8C=E4=BB=A5=E5=A2=9E=E5=BC=BA?= =?UTF-8?q?=E5=AE=89=E5=85=A8=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- files/initrd/opt/rr/menu.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/files/initrd/opt/rr/menu.sh b/files/initrd/opt/rr/menu.sh index 6b9f3c95..ef73295d 100755 --- a/files/initrd/opt/rr/menu.sh +++ b/files/initrd/opt/rr/menu.sh @@ -1772,7 +1772,8 @@ function resetDSMPassword() { DIALOG --title "$(TEXT "Advanced")" \ --msgbox "$(TEXT "Invalid password")" 0 0 done - NEWPASSWD="$(python -c "from passlib.hash import sha512_crypt;pw=\"${VALUE}\";print(sha512_crypt.using(rounds=5000).hash(pw))")" + #NEWPASSWD="$(python -c "from passlib.hash import sha512_crypt;pw=\"${VALUE}\";print(sha512_crypt.using(rounds=5000).hash(pw))")" + NEWPASSWD="$(openssl passwd -6 -salt $(openssl rand -hex 8) "${VALUE}")" ( mkdir -p "${TMP_PATH}/mdX" for I in ${DSMROOTS}; do @@ -2618,7 +2619,8 @@ function changePassword() { [ $? -ne 0 ] && continue STRPASSWD="$(cat "${TMP_PATH}/resp")" # set password - NEWPASSWD="$(python -c "from passlib.hash import sha512_crypt;pw=\"${STRPASSWD:-rr}\";print(sha512_crypt.using(rounds=5000).hash(pw))")" + #NEWPASSWD="$(python -c "from passlib.hash import sha512_crypt;pw=\"${STRPASSWD:-rr}\";print(sha512_crypt.using(rounds=5000).hash(pw))")" + NEWPASSWD="$(openssl passwd -6 -salt $(openssl rand -hex 8) "${STRPASSWD:-rr}")" cp -p /etc/shadow /etc/shadow- sed -i "s|^root:[^:]*|root:${NEWPASSWD}|" /etc/shadow # save to rru