Debian – Postifx Dovecot lmtp, sieve not working

debiandovecotemailpostfixsieve

My mail server has a problem. I want to install sieve, but the rules do not work.
As far as I found out, I think the handover at lmtp to dovecot does not work.
e-mails can be received and sent, but the rules do not work.
If I stop dovecot the mail is still stored in /var/vmail

Where is the mistake?

Debian 9.5
Postfix 3.1.8
Dovecot 2.2.27

Mail log when an email is received

Aug 30 22:46:09 vps582284 postfix/smtpd[28317]: connect from mx09lb.world4you.com[81.19.149.119]
Aug 30 22:46:09 vps582284 postfix/smtpd[28317]: 856843F6A9: client=mx09lb.world4you.com[81.19.149.119]
Aug 30 22:46:09 vps582284 postfix/cleanup[28323]: 856843F6A9: message-id=<00bd01d440a2$76dcabc0$64960340$@source-domain.com>
Aug 30 22:46:09 vps582284 postfix/qmgr[28309]: 856843F6A9: from=<daniel@source-domain.com>, size=1923, nrcpt=1 (queue active)
Aug 30 22:46:09 vps582284 postfix/virtual[28324]: 856843F6A9: to=<test@dest-domain.com>, relay=virtual, delay=0.17, delays=0.15/0.01/0/0.01, dsn=2.0.0, status=sent (delivered to maildir)
Aug 30 22:46:09 vps582284 postfix/qmgr[28309]: 856843F6A9: removed
Aug 30 22:46:09 vps582284 postfix/smtpd[28317]: disconnect from mx09lb.world4you.com[81.19.149.119] ehlo=2 starttls=1 mail=1 rcpt=1 data=1 quit=1 commands=7

doveconf -n

# 2.2.27 (c0f36b0): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.16 (fed8554)
doveconf: Warning: NOTE: You can get a new clean config file with: doveconf -n > dovecot-new.conf
doveconf: Warning: Obsolete setting in /etc/dovecot/dovecot.conf:150: listen=..:port has been replaced by service { inet_listener { port } }
doveconf: Warning: Obsolete setting in /etc/dovecot/dovecot.conf:150: protocol { listen } has been replaced by service { inet_listener { address } }
doveconf: Warning: NOTE: You can get a new clean config file with: doveconf -n > dovecot-new.conf
doveconf: Warning: Obsolete setting in /etc/dovecot/dovecot.conf:150: listen=..:port has been replaced by service { inet_listener { port } }
doveconf: Warning: Obsolete setting in /etc/dovecot/dovecot.conf:150: protocol { listen } has been replaced by service { inet_listener { address } }
# OS: Linux 4.9.0-7-amd64 x86_64 Debian 9.5
auth_mechanisms = plain login
disable_plaintext_auth = no
mail_debug = yes
mail_location = mbox:~/mail:INBOX=/var/mail/%u
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext
namespace inbox {
  inbox = yes
  location =
  mailbox Archive {
    auto = subscribe
    special_use = \Archive
  }
  mailbox Drafts {
    auto = subscribe
    special_use = \Drafts
  }
  mailbox Junk {
    auto = subscribe
    special_use = \Junk
  }
  mailbox Sent {
    auto = subscribe
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    special_use = \Sent
  }
  mailbox Trash {
    auto = subscribe
    special_use = \Trash
  }
  prefix =
  separator = /
}
passdb {
  args = /etc/dovecot/dovecot-sql.conf
  driver = sql
}
plugin {
  mail_debug = yes
  sieve = /var/vmail/%d/%n/sieve
  sieve_dir = /var/vmail/%d/%n/sieve-scripts
  sieve_storage = /var/vmail/%d/%n/sieve-scripts
}
protocols = imap lmtp sieve
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0660
    user = postfix
  }
}
service imap-login {
  inet_listener imaps {
    port = 993
    ssl = yes
  }
}
service lmtp {
  unix_listener lmtp {
    group = postfix
    mode = 0600
    user = postfix
  }
}
ssl = required
ssl_cert = </etc/letsencrypt/live/dest-domain.com/fullchain.pem
ssl_cipher_list = EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA256:EECDH:+CAMELLIA128:+AES128:+SSLv3:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!DSS:!RC4:!SEED:!IDEA:!ECDSA:kEDH:CAMELLIA128-SHA:AES128-SHA
ssl_dh_parameters_length = 2048
ssl_key =  # hidden, use -P to show it
ssl_prefer_server_ciphers = yes
userdb {
  args = /etc/dovecot/dovecot-sql.conf
  driver = sql
}
protocol lmtp {
  mail_plugins = " sieve"
  postmaster_address = daniel@source-domain.com
}

postconf -n

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
compatibility_level = 2
inet_interfaces = all
inet_protocols = all
local_transport = virtual
mailbox_size_limit = 0
mydestination = $myhostname, localhost dest-domain.com
myhostname = mail.dest-domain.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_ciphers = high
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_recipient_restrictions = reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_sender_domain, reject_unknown_recipient_domain, permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination, reject_rbl_client zen.spamhaus.org, reject_rbl_client ix.dnsbl.manitu.net, reject_unverified_recipient, permit
smtpd_relay_restrictions =
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/letsencrypt/live/dest-domain.com/fullchain.pem
smtpd_tls_ciphers = high
smtpd_tls_dh1024_param_file = /etc/letsencrypt/live/dest-domain.com/dh.pem
smtpd_tls_key_file = /etc/letsencrypt/live/dest-domain.com/privkey.pem
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
tls_high_cipherlist = EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA256:EECDH:+CAMELLIA128:+AES128:+SSLv3:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!DSS:!RC4:!SEED:!IDEA:!ECDSA:kEDH:CAMELLIA128-SHA:AES128-SHA
virtual_alias_maps = proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf
virtual_gid_maps = static:5000
virtual_mailbox_base = /var/vmail
virtual_mailbox_maps = proxy:mysql:/etc/postfix/sql/mysql_virtual_mailbox_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp
virtual_uid_maps = static:5000
postconf: warning: /etc/postfix/main.cf: unused parameter: dovecot_destination_recipient_limit=1

thank you,

daniel

Best Answer

Dovecot's sieve is invoked on local delivery performed by deliver utility bundled with dovecot. Your setup do not used the deliver and perform LDA by postfix that isn't related to the sieve. You have to change the postfix configuration the way described here: https://wiki.dovecot.org/LDA/Postfix