From 14d63e41e1e6c35d3910cdf200663134626dad69 Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Mon, 26 Apr 2021 16:56:16 -0700 Subject: [PATCH] vmail user access to 'doveadm pw' command --- bin/vmail-mboxes-add.sh | 2 +- install.sh | 1 + update.sh | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/vmail-mboxes-add.sh b/bin/vmail-mboxes-add.sh index f3e586a..e2dcca4 100755 --- a/bin/vmail-mboxes-add.sh +++ b/bin/vmail-mboxes-add.sh @@ -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 diff --git a/install.sh b/install.sh index 92b2084..33c6b36 100755 --- a/install.sh +++ b/install.sh @@ -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 diff --git a/update.sh b/update.sh index 42a1abb..025638f 100755 --- a/update.sh +++ b/update.sh @@ -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