LDA: Difference between revisions

From QmailToaster
Jump to navigation Jump to search
(Created page with "Install Dovecot Pigeonhole with Sieve protocol enabled Local Delivery Agent (LDA), enable ManageSieve server, specify Sieve rule locations, create Sieve files and set permissions, and restart Dovecot # yum install dovecot-pigeonhole # vi /etc/dovecot/local.conf (Add) mail_location = maildir:~/Maildir protocols = $protocols sieve plugin { sieve = ~/.dovecot.sieve sieve_dir = ~/.sieve } service managesieve-login { inet_listener sieve { port = 4190...")
 
 
(48 intermediate revisions by the same user not shown)
Line 1: Line 1:
Install Dovecot Pigeonhole with Sieve protocol enabled Local Delivery Agent (LDA),
[[Dovecot|Back]]<br><br>
enable ManageSieve server, specify Sieve rule locations, create Sieve files and set
==Dovecot LDA==
permissions, and restart Dovecot
# qmailctl stop
# yum install dovecot-pigeonhole
# cd /home/vpopmail/domains/domain.tld
# vi /etc/dovecot/local.conf (Add)
# cp -p .qmail-default .qmail-default.bak
mail_location = maildir:~/Maildir
# cat > .qmail-default << __EOF__
protocols = $protocols sieve
| /usr/bin/dspam --user \$EXT@\$HOST --deliver=stdout --feature=no,wh \
plugin {
| /usr/bin/rspamc --mime  \
      sieve = ~/.dovecot.sieve
| /var/qmail/bin/preline -f /usr/libexec/dovecot/deliver -d \$EXT@\$USER
      sieve_dir = ~/.sieve
__EOF__
}
# mkdir /var/log/dovecot-lda && chmod 770 /var/log/dovecot-lda && chown vpopmail:vchkpw /var/log/dovecot-lda
service managesieve-login {
# touch /etc/logrotate.d/dovecot-lda
      inet_listener sieve {
# cp /etc/dovecot/dovecot.conf /etc/dovecot/dovecot.conf.orig
      port = 4190
# cat >> /etc/dovecot/dovecot.conf << __EOF__
      }
#
}
# LDA
protocol lda {
protocol lda {
      mail_plugins = $mail_plugins sieve
    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
      .
}
}
service stats {
# cd /home/vpopmail/domains/domain.tld/user
    unix_listener stats-writer {
# mkdir .sieve
      group = vchkpw
# touch .sieve/user.sieve
    }
# ln -s .sieve/user.sieve .dovecot.sieve
}
# chown -R vpopmail:vchkpw .sieve
__EOF__
# chown vpopmail:vchkpw .dovecot.sieve
# systemctl restart dovecot
# chmod 700 .sieve
# qmailctl start
Add Sieve rules to .sieve/user.sieve
 
Enable Dovecot LDA formatted logging
==Dovecot Sieve==
# vi /etc/dovecot/local.conf (Add)
# cp -p /etc/dovecot/dovecot.conf /etc/dovecot/dovecot.conf.lda.orig
      protocol lda {
# yum -y install dovecot-pigeonhole
        deliver_log_format = From:<%f>-<%e> :: Subject:<%s> :: Status:<%$> :: MsgID:<%m> :: Size<%p> :: vSize<%w>
# mkdir /var/lib/dovecot/sieve
        log_path = /var/log/dovecot-lda/dovecot-lda-errors.log
# cat >> /etc/dovecot/dovecot.conf << __EOF__
        info_log_path = /var/log/dovecot-lda/dovecot-lda.log
#
      }
# Sieve
# mkdir /var/log/dovecot-lda
plugin {
# chmod 770 /var/log/dovecot-lda
  sieve = ~/.dovecot.sieve
# chown vpopmail:vchkpw /var/log/dovecot-lda
  sieve_global_path = /var/lib/dovecot/sieve/default.sieve
# touch /etc/logrotate.d/dovecot-lda (Add settings)
  sieve_dir = ~/sieve
Enable Dovecot LDA for QMT
  sieve_global_dir = /var/lib/dovecot/sieve/
# vi /home/vpopmail/domains/yourdomain.tld/.qmail-default (Edit)
}
|/home/vpopmail/bin/vdelivermail '' bounce-no-mailbox (Remove)
protocol lda {
|/var/qmail/bin/preline -f /usr/libexec/dovecot/deliver -d $EXT@$USER -o postmaster_address=postmaster@yourdomain.tld (Add)
  mail_plugins = $mail_plugins sieve
# systemctl restart dovecot
}
__EOF__
# systemctl restart dovecot
Global permissions
# setfacl -m u:vpopmail:rwx,g:vchkpw:rx /var/lib/dovecot/sieve
# setfacl -d -m u:vpopmail:rwx,g:vchkpw:rx /var/lib/dovecot/sieve
# setfacl -m u:vpopmail:rwx,g:vchkpw:rx /var/lib/dovecot
# setfacl -d -m u:vpopmail:rwx,g:vchkpw:rx /var/lib/dovecot
User permissions
# 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
Edit global file
# cat >> /var/lib/dovecot/sieve/default.sieve << __EOF__
require "fileinto";
if header :contains "X-Spam-Flag" "YES" {
    fileinto "spam";
}
__EOF__
''sievec must be run whenever the sieve file is edited''
# sievec /var/lib/dovecot/sieve/default.sieve
 
==Manage Sieve==
# cp -p /etc/dovecot/dovecot.conf /etc/dovecot/dovecot.conf.sieve.orig
# cat >> /etc/dovecot/dovecot.conf << __EOF__
#
# Dovecot Manage Sieve
protocols = $protocols sieve
service managesieve-login {
    inet_listener sieve {
    port = 4190
    }
}
__EOF__
# systemctl restart dovecot

Latest revision as of 15:58, 20 October 2024

Back

Dovecot LDA

# 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__
# 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.orig
# cat >> /etc/dovecot/dovecot.conf << __EOF__
#
# LDA
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
}
service stats {
   unix_listener stats-writer {
      group = vchkpw
   }
}
__EOF__
# systemctl restart dovecot
# qmailctl start

Dovecot Sieve

# cp -p /etc/dovecot/dovecot.conf /etc/dovecot/dovecot.conf.lda.orig
# yum -y install dovecot-pigeonhole
# mkdir /var/lib/dovecot/sieve
# cat >> /etc/dovecot/dovecot.conf << __EOF__
#
# Sieve
plugin {
  sieve = ~/.dovecot.sieve
  sieve_global_path = /var/lib/dovecot/sieve/default.sieve
  sieve_dir = ~/sieve
  sieve_global_dir = /var/lib/dovecot/sieve/
}
protocol lda {
  mail_plugins = $mail_plugins sieve
}
__EOF__
# systemctl restart dovecot

Global permissions

# setfacl -m u:vpopmail:rwx,g:vchkpw:rx /var/lib/dovecot/sieve
# setfacl -d -m u:vpopmail:rwx,g:vchkpw:rx /var/lib/dovecot/sieve
# setfacl -m u:vpopmail:rwx,g:vchkpw:rx /var/lib/dovecot
# setfacl -d -m u:vpopmail:rwx,g:vchkpw:rx /var/lib/dovecot

User permissions

# 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

Edit global file

# cat >> /var/lib/dovecot/sieve/default.sieve << __EOF__
require "fileinto";
if header :contains "X-Spam-Flag" "YES" {
   fileinto "spam";
}
__EOF__

sievec must be run whenever the sieve file is edited

# sievec /var/lib/dovecot/sieve/default.sieve

Manage Sieve

# cp -p /etc/dovecot/dovecot.conf /etc/dovecot/dovecot.conf.sieve.orig
# cat >> /etc/dovecot/dovecot.conf << __EOF__
#
# Dovecot Manage Sieve
protocols = $protocols sieve
service managesieve-login {
   inet_listener sieve {
   port = 4190
   }
}
__EOF__
# systemctl restart dovecot