change password encryption from doveadm to openssl, avoids potential permissions issues with doveadm
This commit is contained in:
parent
b9628f921a
commit
f1f2fd9e9a
|
@ -51,7 +51,8 @@ rowcount=`mysql --defaults-extra-file=$MYSQL_CONNECTION_INFO_FILE -s -r -N -e "S
|
||||||
if [ "$rowcount" -eq '0' ] ; then
|
if [ "$rowcount" -eq '0' ] ; then
|
||||||
# mbox does not exist, build SQL
|
# mbox does not exist, build SQL
|
||||||
# first encrypt password
|
# first encrypt password
|
||||||
passwd=`doveadm -o stats_writer_socket_path= pw -s sha512-crypt -p "$password"`
|
passwd=`/usr/bin/openssl passwd -6 "$password"`
|
||||||
|
passwd="{SHA512-CRYPT}$passwd"
|
||||||
dbcmd="mysql --defaults-extra-file=$MYSQL_CONNECTION_INFO_FILE -e 'INSERT INTO vm_mboxes SET domain_id=\"$domain_id\", mbox=\"$mbox\", passwd=\"$passwd\""
|
dbcmd="mysql --defaults-extra-file=$MYSQL_CONNECTION_INFO_FILE -e 'INSERT INTO vm_mboxes SET domain_id=\"$domain_id\", mbox=\"$mbox\", passwd=\"$passwd\""
|
||||||
if [[ -n $status ]] ; then
|
if [[ -n $status ]] ; then
|
||||||
dbcmd="$dbcmd, status=\"$status\""
|
dbcmd="$dbcmd, status=\"$status\""
|
||||||
|
|
|
@ -71,7 +71,8 @@ fi
|
||||||
|
|
||||||
# check for password update
|
# check for password update
|
||||||
if [ ! -z "$password" ]; then
|
if [ ! -z "$password" ]; then
|
||||||
passwd=`doveadm -o stats_writer_socket_path= pw -s sha512-crypt -p "$password"`
|
passwd=`/usr/bin/openssl passwd -6 "$password"`
|
||||||
|
passwd="{SHA512-CRYPT}$passwd"
|
||||||
if [ ! -z "$dbset" ]; then
|
if [ ! -z "$dbset" ]; then
|
||||||
dbset="$dbset,"
|
dbset="$dbset,"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -131,7 +131,6 @@ cp -a etc/dovecot/* /etc/dovecot/
|
||||||
chgrp dovecot /etc/dovecot/dovecot-sql.conf.ext
|
chgrp dovecot /etc/dovecot/dovecot-sql.conf.ext
|
||||||
chmod 640 /etc/dovecot/dovecot-sql.conf.ext
|
chmod 640 /etc/dovecot/dovecot-sql.conf.ext
|
||||||
sed -i "s|password=password|password=$VMAILPASS|g" /etc/dovecot/dovecot-sql.conf.ext
|
sed -i "s|password=password|password=$VMAILPASS|g" /etc/dovecot/dovecot-sql.conf.ext
|
||||||
chown -R vmail /etc/dovecot/conf.d/
|
|
||||||
if ! [ -d "/usr/local/libexec" ]; then
|
if ! [ -d "/usr/local/libexec" ]; then
|
||||||
mkdir /usr/local/libexec
|
mkdir /usr/local/libexec
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -58,8 +58,6 @@ for etc_config in "${etc_configs_array[@]}"; do
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
# make sure /etc/dovecot/conf.d/ is readable by vmail (needed for encrypting passwords with 'doveadm pw')
|
|
||||||
chown -R vmail /etc/dovecot/conf.d/
|
|
||||||
|
|
||||||
# update libexec script
|
# update libexec script
|
||||||
if ! diff -q libexec/vmail-quota-warning.sh /usr/local/libexec/vmail-quota-warning.sh ; then
|
if ! diff -q libexec/vmail-quota-warning.sh /usr/local/libexec/vmail-quota-warning.sh ; then
|
||||||
|
|
Loading…
Reference in New Issue
Block a user