"Fossies" - the Fresh Open Source Software Archive

Member "dovecot-2.3.17/doc/wiki/Plugins.Lazyexpunge.txt" (19 Jun 2019, 6686 Bytes) of package /linux/misc/dovecot-2.3.17.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 Lazy expunge
    2 ============
    3 
    4 The idea behind this plugin is that expunged mails and deleted mailboxes stay
    5 around for a while, so that user can undelete them without assistance from
    6 sysadmin. The expunged mails won't be counted in user's quota. The plugin
    7 itself doesn't clean up the expunged messages, you'll have to do it some other
    8 way (see below).
    9 
   10 The plugin is configured by defining namespaces where the mails are moved. You
   11 can decide if you want the namespaces to be visible to clients, or if you want
   12 to show them only via some special webmail interface.
   13 
   14 1 mailbox (v2.2.24+)
   15 --------------------
   16 
   17 You create a single mailbox. All messages that are expunged from all the
   18 mailboxes are moved there. This is the simplest configuration. The mailbox is
   19 created automatically. You probably also want to hide it with an ACL.
   20 
   21 ---%<-------------------------------------------------------------------------
   22 mail_plugins = $mail_plugins lazy_expunge acl
   23 plugin {
   24   lazy_expunge = .EXPUNGED
   25   acl = vfile:/etc/dovecot/dovecot.acl
   26 
   27   # Expunged messages most likely don't want to be included in quota:
   28   quota_rule2 = .EXPUNGED:ignore
   29 }
   30 ---%<-------------------------------------------------------------------------
   31 
   32 Where '/etc/dovecot/dovecot.acl' contains:
   33 
   34 ---%<-------------------------------------------------------------------------
   35 .EXPUNGED owner rwstipekxa
   36 ---%<-------------------------------------------------------------------------
   37 
   38 You could also leave the permissions empty if you don't want to allow clients
   39 to access it at all.
   40 
   41 1 namespace
   42 -----------
   43 
   44 You create only a single namespace. When a message is expunged from mailbox
   45 /<name>/, it's moved to a mailbox /<name>/ in the expunge namespace. When an
   46 entire mailbox /<name>/ is deleted, it's also moved to this namespace as
   47 /<name>/. If it already exists, their contents are merged.
   48 
   49 Example configuration:
   50 
   51 ---%<-------------------------------------------------------------------------
   52 # the default namespace
   53 namespace {
   54   prefix =
   55   separator = /
   56   inbox = yes
   57 }
   58 
   59 # namespace for lazy_expunge plugin:
   60 namespace {
   61   prefix = .EXPUNGED/
   62   hidden = yes
   63   list = no
   64   separator = /
   65   location = maildir:~/Maildir/expunged
   66 }
   67 
   68 mail_plugins = $mail_plugins lazy_expunge
   69 plugin {
   70   lazy_expunge = .EXPUNGED/
   71 }
   72 ---%<-------------------------------------------------------------------------
   73 
   74 3 namespaces (obsolete, v2.0 only)
   75 ----------------------------------
   76 
   77 The namespaces are:
   78 
   79  1. Expunged messages namespace. Whenever a message is expunged in mailbox
   80     /<name>/, it's moved to a mailbox /<name>/ in this namespace. The mailboxes
   81     are created automatically as needed.
   82  2. Deleted mailboxes namespace. Whenever a mailbox /<name>/ is deleted, it's
   83     moved here with name /<name>-YYYMMDD-hhmmss/. The timestamp is there so
   84     that the mailbox can be deleted multiple times. If the mailbox is deleted
   85     multiple times within a second, random 16bit hex value is appended to it.
   86  3. Expunged messages in a deleted mailbox namespace. When a mailbox is deleted
   87     and it has messages in its expunged namespace, the mailbox is moved from
   88     the expunged namespace to this namespace. The destination mailbox name is
   89     the same as in the 2nd namespace (ie. contains the same timestamp).
   90 
   91 Example configuration:
   92 
   93 ---%<-------------------------------------------------------------------------
   94 # the default namespace
   95 namespace {
   96   prefix =
   97   separator = /
   98   inbox = yes
   99 }
  100 
  101 # namespaces for lazy_expunge plugin:
  102 namespace {
  103   prefix = .EXPUNGED/
  104   separator = /
  105   location = maildir:~/Maildir/expunged
  106 }
  107 namespace {
  108   prefix = .DELETED/
  109   separator = /
  110   location = maildir:~/Maildir/deleted
  111 }
  112 namespace {
  113   prefix = .DELETED/.EXPUNGED/
  114   separator = /
  115   location = maildir:~/Maildir/deleted/expunged
  116 }
  117 
  118 mail_plugins = $mail_plugins lazy_expunge
  119 plugin {
  120   lazy_expunge = .EXPUNGED/ .DELETED/ .DELETED/.EXPUNGED/
  121 }
  122 ---%<-------------------------------------------------------------------------
  123 
  124 Multi-dbox
  125 ----------
  126 
  127 With multi-dbox use different MAILBOXDIRs (so copying between namespaces works
  128 quickly within the same storage), but otherwise exactly the same paths (index,
  129 control):
  130 
  131 ---%<-------------------------------------------------------------------------
  132 # the default namespace
  133 namespace {
  134   prefix =
  135   inbox = yes
  136   location = mdbox:~/mdbox:INDEX=/var/index/%d/%n
  137 }
  138 
  139 # lazy_expunge namespace(s):
  140 namespace {
  141   prefix = .EXPUNGED/
  142   hidden = yes
  143   list = no
  144   subscriptions = no
  145 
  146   location = mdbox:~/mdbox:INDEX=/var/index/%d/%n:MAILBOXDIR=expunged
  147   # If mailbox_list_index=yes is enabled, it needs a separate index file
  148 (v2.2.28+):
  149   #location =
  150 mdbox:~/mdbox:INDEX=/var/index/%d/%n:MAILBOXDIR=expunged:LISTINDEX=expunged.list.index
  151 }
  152 ---%<-------------------------------------------------------------------------
  153 
  154 Copy only the last instance (v2.2+)
  155 -----------------------------------
  156 
  157 If mail has multiple copies (via IMAP COPY), each copy is normally moved to
  158 lazy expunge namespace when it's expunged. With v2.2+ you can set 'plugin {
  159 lazy_expunge_only_last_instance = yes }' to copy only the last instance and
  160 immediately expunge the others. This may be useful if you want to provide a
  161 flat list of all expunged mails without duplicates in your webmail. With many
  162 clients this means that the last instance is always in the Trash mailbox.
  163 
  164 Cleaning up
  165 -----------
  166 
  167 doveadm
  168 -------
  169 
  170 ---%<-------------------------------------------------------------------------
  171 doveadm expunge mailbox 'deleted/*' savedsince 1d
  172 ---%<-------------------------------------------------------------------------
  173 
  174 cronjob
  175 -------
  176 
  177 Run something like this for each user every night (not actually tested if it
  178 works, and vulnerable to TOCTTOU if the user can place symlinks in any of the
  179 directories find is traversing):
  180 
  181 ---%<-------------------------------------------------------------------------
  182 # delete a day old mails
  183 find Maildir/expunged Maildir/deleted Maildir/deleted/expunged \
  184   -type f ! -cmin 1440 -print0 | xargs -0 rm
  185 ---%<-------------------------------------------------------------------------
  186 
  187 Trash plugin
  188 ------------
  189 
  190 <Trash plugin> [Plugins.Trash.txt] with some help from <Quota plugin>
  191 [Quota.txt] could probably be used to keep the expunged and deleted mailboxes
  192 under a specified size (not tested).
  193 
  194 Expire plugin
  195 -------------
  196 
  197 <Expire plugin> [Plugins.Expire.txt] was created to keep track of mails in
  198 specific mailboxes, and expunge them when they've been there for a specified
  199 amount of time. It keeps an internal database (e.g. SQL) of all such mailboxes,
  200 so it doesn't have to go through all the mailboxes for all the users.
  201 
  202 (This file was created from the wiki on 2019-06-19 12:42)