vmail user access to 'doveadm pw' command

This commit is contained in:
Matthew Saunders Brown 2021-04-26 16:56:16 -07:00
parent 6d35652773
commit 14d63e41e1
3 changed files with 4 additions and 1 deletions

View File

@ -85,7 +85,7 @@ rowcount=`mysql --defaults-extra-file=$MYSQL_CONNECTION_INFO_FILE -s -r -N -e "S
if [ "$rowcount" -eq '0' ] ; then
# mbox does not exist, build SQL
# first encrypt password
passwd=`doveadm pw -s sha512-crypt -p "$passwd"|sed 's|^{SHA512-CRYPT}||'`
passwd=`doveadm -o stats_writer_socket_path= pw -s sha512-crypt -p "$passwd"|sed 's|^{SHA512-CRYPT}||'`
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 [ "$status" == 0 ] || [ "$status" == 1 ]; then

View File

@ -116,6 +116,7 @@ cp -a etc/dovecot/* /etc/dovecot/
chgrp dovecot /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
chown -R vmail /etc/dovecot/conf.d/
if ! [ -d "/usr/local/libexec" ]; then
mkdir /usr/local/libexec
fi

View File

@ -58,6 +58,8 @@ for etc_config in "${etc_configs_array[@]}"; do
echo
fi
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
if ! diff -q libexec/vmail-quota-warning.sh /usr/local/libexec/vmail-quota-warning.sh ; then