mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 10:37:42 -07:00
fix for md5 hashes
This commit is contained in:
parent
5a4ba74d1b
commit
ea24113610
1 changed files with 10 additions and 2 deletions
|
@ -49,7 +49,15 @@ fi
|
|||
#----------------------------------------------------------#
|
||||
|
||||
# Parsing user's salt
|
||||
salt=$(grep "^$user:" /etc/shadow |cut -f 3 -d \$)
|
||||
shadow=$(grep "^$user:" /etc/shadow)
|
||||
salt=$(echo "$shadow" |cut -f 3 -d \$)
|
||||
method=$(echo "$shadow" |cut -f 2 -d \$)
|
||||
if [ "$method" -eq '1' ]; then
|
||||
method='md5'
|
||||
else
|
||||
method='sha-512'
|
||||
fi
|
||||
|
||||
if [[ -z "$salt" ]] || [[ "${#salt}" -gt 12 ]]; then
|
||||
echo "Error: password missmatch"
|
||||
echo "$DATE $user $ip failed to login" >> $VESTA/log/auth.log
|
||||
|
@ -57,7 +65,7 @@ if [[ -z "$salt" ]] || [[ "${#salt}" -gt 12 ]]; then
|
|||
fi
|
||||
|
||||
# Generating SHA-512
|
||||
hash=$($BIN/v-generate-password-hash sha-512 $salt <<< $password)
|
||||
hash=$($BIN/v-generate-password-hash $method $salt <<< $password)
|
||||
if [[ -z "$hash" ]]; then
|
||||
echo "Error: password missmatch"
|
||||
echo "$DATE $user $ip failed to login" >> $VESTA/log/auth.log
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue