sha-512 passwords func

This commit is contained in:
Serghey Rodin 2015-04-04 16:49:10 +03:00
commit 8a3f8592cc
4 changed files with 44 additions and 22 deletions

View file

@ -48,12 +48,11 @@ is_password_valid
# Action #
#----------------------------------------------------------#
if [ -x '/usr/bin/doveadm' ]; then
md5=$(/usr/bin/doveadm pw -s md5 -p "$password")
else
md5=$(/usr/sbin/dovecotpw -s md5 -p "$password")
fi
# Generating hashed password
salt=$(gen_password "$PW_MATRIX" "8")
md5="{MD5}$($BIN/v-generate-password-hash md5 $salt <<<$password)"
# Adding account info into password file
if [[ "$MAIL_SYSTEM" =~ exim ]]; then
str="$account:$md5:$user:mail::$HOMEDIR/$user:$quota"
echo $str >> $HOMEDIR/$user/conf/mail/$domain/passwd