RACK911LABS.COM: simpler and safer hash check

This commit is contained in:
Serghey Rodin 2018-04-26 16:32:34 +03:00
parent d14b7d969c
commit 73e6656986

View file

@ -75,15 +75,15 @@ else
method='des' method='des'
fi fi
# Checking salt
if [ -z "$salt" ]; then if [ -z "$salt" ]; then
echo "Error: password missmatch" echo "Error: password missmatch"
echo "$date $time $user $ip failed to login" >> $VESTA/log/auth.log echo "$date $time $user $ip failed to login" >> $VESTA/log/auth.log
exit 9 exit 9
fi fi
# Checking hash # Comparing hashes
result=$(grep "^$user:$hash:" /etc/shadow 2>/dev/null) if [[ "$shadow" != "$hash" ]]; then
if [[ -z "$result" ]]; then
echo "Error: password missmatch" echo "Error: password missmatch"
echo "$date $time $user $ip failed to login" >> $VESTA/log/auth.log echo "$date $time $user $ip failed to login" >> $VESTA/log/auth.log
exit 9 exit 9