Skip to content

Commit

Permalink
Merge pull request #23 from downtownallday/fix-move-postfix-queue
Browse files Browse the repository at this point in the history
Fix move postfix queue
  • Loading branch information
downtownallday authored Oct 6, 2023
2 parents 7abd7b3 + 75baac8 commit 86b030b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 5 additions & 2 deletions setup/mail-users.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ source ${STORAGE_ROOT}/ldap/miab_ldap.conf # user-data specific vars
dovecot_setting() {
/usr/bin/doveconf $1 2>/dev/null | awk -F= '{gsub(/^ +/, "", $2); print $2}'
}
postfix_setting() {
/usr/sbin/postconf $1 2>/dev/null | awk -F= '{gsub(/^ +/, "", $2); print $2}'
}

# ### User Authentication

Expand Down Expand Up @@ -101,7 +104,7 @@ ln -sf /etc/dovecot/dovecot-ldap.conf.ext /etc/dovecot/dovecot-userdb-ldap.conf.
# Have Dovecot provide an authorization service that Postfix can access & use.
cat > /etc/dovecot/conf.d/99-local-auth.conf << EOF;
service auth {
unix_listener auth-postfix {
unix_listener $(postfix_setting queue_directory)/private/auth {
mode = 0660
user = dovecot
group = postfix
Expand All @@ -117,7 +120,7 @@ EOF
# submission port.
tools/editconf.py /etc/postfix/main.cf \
smtpd_sasl_type=dovecot \
smtpd_sasl_path=$(dovecot_setting base_dir)/auth-postfix \
smtpd_sasl_path=private/auth \
smtpd_sasl_auth_enable=no

# ### Sender Validation
Expand Down
9 changes: 8 additions & 1 deletion setup/mods.available/move-postfix-queue-to-user-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ change_queue_directory() {
mkdir -p "$(dirname "$where")"
mv "$cur" "$where"
/usr/sbin/postconf -e "queue_directory=$where"
systemctl start postfix

# change rsyslog so chrooted postfix services can log at the
# new location
tools/editconf.py /etc/rsyslog.d/postfix.conf -s "\$AddUnixListenSocket=$where/dev/log"
systemctl restart rsyslog

# re-run setup/mail-users.sh so the new queue_directory is used
source setup/mail-users.sh
echo "New postfix queue directory: $where (was: $cur)"
}

Expand Down

0 comments on commit 86b030b

Please sign in to comment.