LDA

From QmailToaster
Revision as of 14:02, 20 October 2024 by Ebroch (talk | contribs)
Jump to navigation Jump to search

Back

# qmailctl stop
# cd /home/vpopmail/domains/domain.tld
# cp -p .qmail-default .qmail-default.bak
# cat > .qmail-default << __EOF__
| /usr/bin/dspam --user \$EXT@\$HOST --deliver=stdout --feature=no,wh \
| /usr/bin/rspamc --mime  \
| /var/qmail/bin/preline -f /usr/libexec/dovecot/deliver -d \$EXT@\$USER
__EOF__
# setfacl -m  u:vpopmail:rw,g:vchkpw:rw  /var/run/dovecot/stats-writer
# mkdir /var/log/dovecot-lda
# chmod 770 /var/log/dovecot-lda
# chown vpopmail:vchkpw /var/log/dovecot-lda
# touch /etc/logrotate.d/dovecot-lda
# cp /etc/dovecot/dovecot.conf /etc/dovecot/dovecot.conf.bak
# cat >> /etc/dovecot/dovecot.conf << __EOF__
protocol lda {
   deliver_log_format = From:<%f>-<%e> :: Subject:<%s> :: Status:<%$> :: MsgID:<%m> :: Size<%p> :: vSize<%w>
   log_path = /var/log/dovecot-lda/dovecot-lda-errors.log
   info_log_path = /var/log/dovecot-lda/dovecot-lda.log
}
__EOF__


# yum -y install dovecot-pigeonhole
Add to /etc/dovecot/dovecot.conf
 mail_location = maildir:~/Maildir
 protocols = $protocols imap pop3 sieve
 plugin {
     sieve = ~/.dovecot.sieve
     sieve_dir = ~/.sieve
 }
 service managesieve-login {
     inet_listener sieve {
     port = 4190
     }
 }
 protocol lda {
     mail_plugins = $mail_plugins sieve
     .
     .
     .
 }
# cd /home/vpopmail/domains/domain.tld/user
# mkdir .sieve
# touch .sieve/user.sieve
# ln -s .sieve/user.sieve .dovecot.sieve
# chown -R vpopmail:vchkpw .sieve
# chown vpopmail:vchkpw .dovecot.sieve
# chmod 700 .sieve
Add Sieve rules to .sieve/user.sieve
Enable Dovecot LDA formatted logging
Add to /etc/dovecot/dovecot.conf
 protocol lda {
        deliver_log_format = From:<%f>-<%e> :: Subject:<%s> :: Status:<%$> :: MsgID:<%m> :: Size<%p> :: vSize<%w>
        log_path = /var/log/dovecot-lda/dovecot-lda-errors.log
        info_log_path = /var/log/dovecot-lda/dovecot-lda.log
 }
# mkdir /var/log/dovecot-lda
# chmod 770 /var/log/dovecot-lda
# chown vpopmail:vchkpw /var/log/dovecot-lda
# touch /etc/logrotate.d/dovecot-lda
Enable Dovecot LDA for QMT
# Edit /home/vpopmail/domains/yourdomain.tld/.qmail-default
  Remove '|/home/vpopmail/bin/vdelivermail  bounce-no-mailbox'
  Add '|/var/qmail/bin/preline -f /usr/libexec/dovecot/deliver -d $EXT@$USER -o postmaster_address=postmaster@yourdomain.tld'
# systemctl restart dovecot