mirror of
https://github.com/RROrg/rr.git
synced 2025-06-21 05:51:05 +08:00
更新 menu.sh,替换密码哈希算法为 openssl,以增强安全性
This commit is contained in:
parent
197ed21c8e
commit
751284fa59
@ -1772,7 +1772,8 @@ function resetDSMPassword() {
|
|||||||
DIALOG --title "$(TEXT "Advanced")" \
|
DIALOG --title "$(TEXT "Advanced")" \
|
||||||
--msgbox "$(TEXT "Invalid password")" 0 0
|
--msgbox "$(TEXT "Invalid password")" 0 0
|
||||||
done
|
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"
|
mkdir -p "${TMP_PATH}/mdX"
|
||||||
for I in ${DSMROOTS}; do
|
for I in ${DSMROOTS}; do
|
||||||
@ -2618,7 +2619,8 @@ function changePassword() {
|
|||||||
[ $? -ne 0 ] && continue
|
[ $? -ne 0 ] && continue
|
||||||
STRPASSWD="$(cat "${TMP_PATH}/resp")"
|
STRPASSWD="$(cat "${TMP_PATH}/resp")"
|
||||||
# set password
|
# 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-
|
cp -p /etc/shadow /etc/shadow-
|
||||||
sed -i "s|^root:[^:]*|root:${NEWPASSWD}|" /etc/shadow
|
sed -i "s|^root:[^:]*|root:${NEWPASSWD}|" /etc/shadow
|
||||||
# save to rru
|
# save to rru
|
||||||
|
Loading…
x
Reference in New Issue
Block a user