mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-03-31 14:41:55 -07:00
addon/proftpd: conver password generation to openssl
Signed-off-by: Ian Leonard <antonlacon@gmail.com>
This commit is contained in:
@@ -99,18 +99,18 @@ chmod 700 /var/config/proftpd.passwd
|
||||
|
||||
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})
|
||||
USERPASS=$(eval echo \$Userpass${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
|
||||
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
|
||||
mkdir -p "$USERPATH"
|
||||
chmod 777 "$USERPATH"
|
||||
|
||||
Reference in New Issue
Block a user