vmail .my.cnf

This commit is contained in:
Matthew Saunders Brown 2021-03-31 09:59:35 -07:00
parent 089a429193
commit 3f9d2e31f3
2 changed files with 10 additions and 2 deletions

View File

@ -6,9 +6,8 @@ if [ "$USER" != "vmail" ]; then
fi
# constants
readonly MYSQL_CONNECTION_INFO_FILE=/usr/local/etc/vmail-db-info.conf
readonly VMAIL_DIR=/var/vmail
readonly VMAIL_DB=vmail
readonly MYSQL_CONNECTION_INFO_FILE=$VMAIL_DIR/.my.cnf
# check that MYSQL_CONNECTION_INFO_FILE exists and is readable
if [ ! -f "$MYSQL_CONNECTION_INFO_FILE" ]; then

View File

@ -77,6 +77,15 @@ apt -y install exim4-daemon-heavy spf-tools-perl spamassassin libclass-dbi-mysql
usermod -a -G ssl-cert Debian-exim
useradd --create-home --home-dir /var/vmail --shell /usr/sbin/nologin --system --user-group vmail
# configure vmail user .my.cnf for db access
install --owner=vmail --group=vmail --mode=640 /dev/null /var/vmail/.my.cnf
echo "[client]" > /var/vmail/.my.cnf
echo "host = localhost" >> /var/vmail/.my.cnf
echo "database = vmail" >> /var/vmail/.my.cnf
echo "user = vmail" >> /var/vmail/.my.cnf
echo "password = $VMAILPASS" >> /var/vmail/.my.cnf
echo "socket = /var/run/mysqld/mysqld.sock" >> /var/vmail/.my.cnf
# configure vmail dirs
chmod 750 /var/vmail/
if [ ! -d "/etc/ssl/dkim" ]; then