Mit global.sieve ein Mail in eine public Mailbox schieben

Jakobus Schürz wertstoffe at nurfuerspam.de
Do Dez 27 02:21:23 CET 2018


Hi Leute!

Ich möchte gerne mit einem global.sieve-Script ein Mail in eine Public
Mailbox schieben. Und zwar, wenn das Email an eine bestimmte Adresse
geht (public at mydomain.example), dann soll dieses Mail in den Public
Imap-Folder /All/Public geschoben werden.

Ich habe dazu das File /etc/dovecot/sieve/global.sieve mit folgendem Inhalt:

require["fileinto","mailbox"];
if address :domain :matches ["from", "to"] ["aldebaran.duckdns.org",
"localhost", "local", "mydomain.example", "aldebaran",
"myotherdomain.example" ]
{
    if anyof (
            header :matches "subject" "Mail delivery failed:",
            address :localpart :matches "from" "Mailer-Daemon",
            address :localpart :matches "from" "FETCHMAIL-DAEMON"
        )
        { fileinto :create "INBOX/SYSTEM/Zustellfehler"; stop; }
    elsif allof (
        address :localpart :is ["From", "To", "Cc"] "Debian-exim",
        address :localpart :is ["From", "To", "Cc"] "postmaster",
        header :matches "subject" "Getmail-LDAP Error"
        )
        { fileinto :create "INBOX/SYSTEM/Getmail-LDAP-Errors"; stop;}

    elsif header :matches "subject" "Samhain-Bericht"
        { fileinto :create "INBOX/SYSTEM/samhain"; stop; }

    elsif anyof (
        address :localpart :is ["From", "To", "Cc"] "root",
        address :localpart :is ["From", "To", "Cc"] "postmaster",
        address :localpart :is ["From", "To", "Cc"] "listmaster",
        address :localpart :is ["From", "To", "Cc"] "Debian-exim",
        address :matches "To" ["root at localhost", "root at aldebaran"],
        header :matches "subject" "*** SECURITY information for
localhost ***",
        address :all :is "from" "FETCHMAIL-DAEMON at localhost"
        )
        { fileinto :create "INBOX/SYSTEM"; stop; }
    elsif anyof (
        address :localpart :is ["From", "To", "Cc"] "public",
        address :localpart :is ["From", "To", "Cc"] "public.wien",
        address :localpart :is ["From", "To", "Cc"] "public.all"
        )
        { fileinto :create "All/Public"; stop;}
}

Dieses Sievescript ist natürlich mit sievec compilliert und liegt im
selben Verzeichnis.

Sende ich nun ein Email von einer externen Adresse an
public.all at mydomain.example, dann landet es in der Mailbox meines Users
für den diese Email-Adresse ein Alias ist. Ändere ich hingegen die Zeile

{ fileinto :create "All/Public"; stop;} in

{ fileinto :create "INBOX/BLA/Public"; stop;}

Dann wird diese Mailbox unter INBOX erzeugt und das Email landet dort.
Der Sieve-Filter greift also, kann aber das Mail nicht in die
Public-Mailbox zustellen.

Diese Public-Mailbox ist aber für alle User in Thunderbird sichtbar, und
jeder User kann dort Mail hinverschieben, jeder User hat eigene "Seen-Flags"

Das spannende ist, bei einem User werden All und All/Public mit doveadm
mailbox list -u user.name angezeigt, beim anderen User hingegen nicht.


Ich steh mit meinem Latein am Ende. Hat vielleicht von euch jemand eine
Idee?


lg jakob

PS: Hier noch meine Dovecot-config


# 2.3.4 (0ecbaf23d): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.4 (60b0f48d)
# OS: Linux 4.9.0-8-amd64 x86_64 Debian 9.6 ext4
# Hostname: mail.vpn
auth_mechanisms = plain login cram-md5 digest-md5
auth_socket_path = /var/run/dovecot/auth-userdb
disable_plaintext_auth = no
first_valid_uid = 1000
imap_capability = +XDOVECOT +SPECIAL-USE
imap_client_workarounds = tb-extra-mailbox-sep
lda_mailbox_autocreate = yes
lda_mailbox_autosubscribe = yes
listen = *, ::1
login_trusted_networks = 127.0.0.1/8 192.168.0.0/24 192.168.1.0/24
172.17.0.0/24 172.18.0.0/24
mail_debug = yes
mail_gid = vmail
mail_home =  /var/mail/%u
mail_location =
maildir:/var/mail/%u/Maildir:LAYOUT=fs:INDEX=/var/lib/dovecot/db/indexes/Maildir/%u:CONTROL=/var/lib/dovecot/db/control/Maildir/%u
mail_plugins = zlib quota acl listescape mail_log notify virtual fts
fts_lucene
mail_privileged_group = vmail
mail_server_admin = mailto:jakob at mydomain.example
mail_shared_explicit_inbox = yes
mail_uid = vmail
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 imapsieve vnd.dovecot.imapsieve
namespace Archiv {
  hidden = no
  inbox = no
  list = children
  location =
maildir:/var/mail/archiv/%u/:LAYOUT=fs:INDEX=/var/lib/dovecot/db/indexes/archiv/%u:CONTROL=/var/lib/dovecot/db/control/archiv/%u
  mailbox Archiv {
    auto = subscribe
    special_use = \Archive
  }
  mailbox Archive/Archiv {
    auto = no
    special_use = \Archive
  }
  mailbox Archives/Archiv {
    auto = no
    special_use = \Archive
  }
  mailbox "Gesamtes Archiv" {
    auto = no
    special_use = \Archive
  }
  prefix = Archiv/
  separator = /
  subscriptions = no
  type = private
}
namespace Geteilt {
  hidden = no
  inbox = no
  list = children
  location =
maildir:/var/mail/%%u/Maildir:LAYOUT=fs:INDEXPVT=/var/lib/dovecot/db/indexes/shared/%u/%%u:INDEX=/var/lib/dovecot/db/indexes/shared/%u/%%u
  prefix = Geteilt/%%n/
  separator = /
  subscriptions = no
  type = shared
}
namespace Synoptic {
  hidden = no
  ignore_on_failure = no
  list = children
  location =
virtual:/var/mail/virtual/synoptic:INDEX=/var/lib/dovecot/db/indexes/virtual/synoptic/%u
  mailbox AKTUELL {
    auto = subscribe
  }
  mailbox Markierte {
    auto = subscribe
  }
  mailbox Neue {
    auto = subscribe
  }
  mailbox Rechnungen {
    auto = subscribe
  }
  mailbox WICHTIG {
    auto = subscribe
  }
  prefix = Synoptic/
  separator = /
  subscriptions = no
}
namespace All {
  list = children
  location =
maildir:/var/mail/public/all/:LAYOUT=fs:INDEX=/var/lib/dovecot/db/indexes/public/all/%u:INDEXPVT=/var/lib/dovecot/db/indexes/public/all/%u
  mailbox Public {
    auto = subscribe
  }
  mailbox Versicherungen {
    auto = subscribe
  }
  mailbox something {
    auto = subscribe
  }
  prefix = All/
  separator = /
  subscriptions = no
  type = public
}
namespace inbox {
  hidden = no
  inbox = yes
  location =
  mailbox "Deleted Messages" {
    auto = no
    autoexpunge = 30 days
    special_use = \Trash
  }
  mailbox Drafts {
    auto = no
    special_use = \Drafts
  }
  mailbox Entwürfe {
    auto = no
    special_use = \Drafts
  }
  mailbox "Gelöschte Elemente" {
    auto = no
    autoexpunge = 30 days
    special_use = \Trash
  }
  mailbox "Gelöschte Objekte" {
    auto = no
    autoexpunge = 30 days
    special_use = \Trash
  }
  mailbox Gesendet {
    auto = no
    special_use = \Sent
  }
  mailbox "Gesendete Elemente" {
    auto = no
    special_use = \Sent
  }
  mailbox "Gesendete Objekte" {
    auto = no
    special_use = \Sent
  }
  mailbox Junk {
    auto = subscribe
    autoexpunge = 30 days
    special_use = \Junk
  }
  mailbox Mistkübel {
    auto = no
    autoexpunge = 30 days
    special_use = \Trash
  }
  mailbox Papierkorb {
    auto = no
    autoexpunge = 30 days
    special_use = \Trash
  }
  mailbox Sent {
    auto = subscribe
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    auto = no
    special_use = \Sent
  }
  mailbox Spam {
    auto = no
    autoexpunge = 30 days
    special_use = \Junk
  }
  mailbox Trash {
    auto = no
    autoexpunge = 30 days
    special_use = \Trash
  }
  prefix = INBOX/
  separator = /
  subscriptions = no
  type = private
}
namespace subscriptions {
  hidden = yes
  list = no
  location =
  prefix =
  subscriptions = yes
}
passdb {
  args = /etc/dovecot/dovecot-ldap-passdb-user.conf.ext
  driver = ldap
  name = user
}
passdb {
  args = /etc/dovecot/dovecot-ldap-passdb-admin.conf.ext
  driver = ldap
  name = admin
}
plugin {
  acl = vfile:/etc/dovecot/dovecot-acl:cache_secs=300
  acl_shared_dict = file:/var/lib/dovecot/db/shared-mailboxes.db
  fts = lucene
  fts_autoindex = yes
  fts_autoindex_max_recent_msgs = 80
  fts_index_timeout = 90
  fts_lucene = whitespace_chars=@. normalize no_snowball
  imapsieve_mailbox1_before = file:/etc/dovecot/sieve/report-spam.sieve
  imapsieve_mailbox1_causes = COPY
  imapsieve_mailbox1_name = INBOX/Junk
  imapsieve_mailbox2_before = file:/etc/dovecot/sieve/report-ham.sieve
  imapsieve_mailbox2_causes = COPY
  imapsieve_mailbox2_from = INBOX/Junk
  imapsieve_mailbox2_name = *
  mail_home =  /var/mail/%u
  mail_log_events = delete undelete expunge copy mailbox_delete
mailbox_rename
  mail_log_fields = uid box msgid subject from flags
  setting_name = sieve, managedsieve
  sieve = file:/var/mail/%u/sieve/;active=/var/mail/%u/sieve/%u.sieve
  sieve_after = /etc/dovecot/sieve/after.d/
  sieve_before = /etc/dovecot/sieve/global.sieve
  sieve_global_dir = /etc/dovecot/sieve/
  sieve_global_extensions = +vnd.dovecot.pipe
  sieve_pipe_bin_dir = /etc/dovecot/sieve
  sieve_plugins = sieve_imapsieve sieve_extprograms
  sieve_trace_dir = /var/log/dovecot/sieve/trace
  sieve_trace_level = matching
}
postmaster_address = postmaster at localhost
protocols = " imap lmtp lmtp sieve pop3 sieve"
service anvil {
  client_limit = 199999
  unix_listener anvil-auth-penalty {
    mode = 0700
  }
}
service auth {
  unix_listener auth-client {
    group = vmail
    mode = 0666
    user = Debian-exim
  }
  unix_listener auth-userdb {
    group = vmail
    mode = 0666
    user = vmail
  }
}
service imap-login {
  inet_listener imap {
    port = 143
  }
  inet_listener imaps {
    port = 993
    ssl = yes
  }
  process_min_avail = 1
  service_count = 1
}
service imap-postlogin {
  executable = script-login -d /etc/dovecot/posix_groups.sh
"/etc/dovecot/acl_groups.py %u"
}
service imap {
  executable = imap postlogin
  process_limit = 1024
  vsz_limit = 400 M
}
service lmtp {
  user = Debian-exim
  vsz_limit = 400 M
}
service postlogin {
  executable = script-login -d /etc/dovecot/acl_groups.py
  unix_listener postlogin {
    group = vmail
    user = vmail
  }
}
service stats {
  unix_listener stats-writer {
    group = vmail
    mode = 0600
    user = vmail
  }
}
ssl = required
ssl_cert = </etc/dovecot/ssl/certs/dovecot.crt
ssl_cipher_list = ALL:!ADH:!LOW:!SSLv2:!SSLv3:!EXP:!aNULL:+HIGH:+MEDIUM
ssl_dh = # hidden, use -P to show it
ssl_key = # hidden, use -P to show it
userdb {
  args = /etc/dovecot/dovecot-ldap-userdb.conf.ext
  default_fields = home=/var/mail/%u uid=vmail gid=vmail
  driver = ldap
}
verbose_proctitle = yes
protocol lmtp {
  auth_username_format = %Ln
  mail_plugins = zlib quota acl listescape mail_log notify virtual fts
fts_lucene quota sieve acl
}
protocol lda {
  info_log_path =
  log_path =
  mail_plugins = zlib quota acl listescape mail_log notify virtual fts
fts_lucene quota sieve acl
}
protocol imap {
  mail_max_userip_connections = 30
  mail_plugins = zlib quota acl listescape mail_log notify virtual fts
fts_lucene imap_quota imap_acl imap_sieve
}



Mehr Informationen über die Mailingliste Dovecot