mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 13:46:49 +00:00
addon/proftpd: conver password generation to openssl
Signed-off-by: Ian Leonard <antonlacon@gmail.com>
This commit is contained in:
parent
79a4a5dd8c
commit
f8636d1e2d
@ -99,18 +99,18 @@ chmod 700 /var/config/proftpd.passwd
|
|||||||
|
|
||||||
for NUM in $(seq 1 100); do
|
for NUM in $(seq 1 100); do
|
||||||
|
|
||||||
case "$CryptoHash" in
|
|
||||||
"0") password_salt=$(python -c "import crypt; print(crypt.mksalt(crypt.METHOD_SHA512))");;
|
|
||||||
"1") password_salt=$(python -c "import crypt; print(crypt.mksalt(crypt.METHOD_SHA256))");;
|
|
||||||
"2") password_salt=$(python -c "import crypt; print(crypt.mksalt(crypt.METHOD_MD5))");;
|
|
||||||
esac
|
|
||||||
|
|
||||||
USERNAME=$(eval echo \$Username${NUM})
|
USERNAME=$(eval echo \$Username${NUM})
|
||||||
USERPASS=$(eval echo \$Userpass${NUM})
|
USERPASS=$(eval echo \$Userpass${NUM})
|
||||||
USERPATH=$(eval echo \$Userpath${NUM})
|
USERPATH=$(eval echo \$Userpath${NUM})
|
||||||
|
|
||||||
|
case "$CryptoHash" in
|
||||||
|
"0") password_entry=$(openssl passwd -6 "${USERPASS}");;
|
||||||
|
"1") password_entry=$(openssl passwd -5 "${USERPASS}");;
|
||||||
|
"2") password_entry=$(openssl passwd -1 "${USERPASS}");;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ -n "$USERNAME" ]; then
|
if [ -n "$USERNAME" ]; then
|
||||||
echo $USERNAME:$(python -c "import crypt; print(crypt.crypt('${USERPASS}', '${password_salt}'))"):10:10::$USERPATH:/bin/false >> /var/config/proftpd.passwd
|
echo $USERNAME:$password_entry:10:10::$USERPATH:/bin/false >> /var/config/proftpd.passwd
|
||||||
# user writes with different user/group
|
# user writes with different user/group
|
||||||
mkdir -p "$USERPATH"
|
mkdir -p "$USERPATH"
|
||||||
chmod 777 "$USERPATH"
|
chmod 777 "$USERPATH"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user