1

Topic: Dovecot expire plugin doesn't work

configured the dovecont.conf to enable plugin
configured the dovecot-dict-expire.conf
created the expires table in vmail mysql database

/usr/sbin/dovecot --exec-mail ext /usr/lib/dovecot/expire-tool.sh

Error: stat(//root/Maildir/.Drafts/tmp) failed: Permission denied (euid=1001(vmail) egid=1001(vmail) missing +x perm: //root)
Error: stat(//root/Maildir/.Junk/tmp) failed: Permission denied (euid=1001(vmail) egid=1001(vmail) missing +x perm: //root)
Error: lstat(//root/Maildir/subscriptions.lock) failed: Permission denied
Error: lstat(//root/Maildir/subscriptions.lock) failed: Permission denied
Error: lstat(//root/Maildir/subscriptions.lock) failed: Permission denied
Error: lstat(//root/Maildir/subscriptions.lock) failed: Permission denied
Error: lstat(//root/Maildir/subscriptions.lock) failed: Permission denied
Error: stat(//root/Maildir/.Trash/tmp) failed: Permission denied (euid=1001(vmail) egid=1001(vmail) missing +x perm: //root)
Error: ctucker@maineplastics.com: Opening mailbox Trash failed: Internal error occurred. Refer to server log for more information. [2012-04-20 12:59:23]
Error: stat(//root/Maildir) failed: Permission denied

Any ideas ??

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Dovecot expire plugin doesn't work

Please show us necessary info to help troubleshoot:

1) What's your iRedMail version?
2) What's the Dovecot version? You can get it with command 'dovecot -n | head -2'.
3) Clearly explain how you did below steps, and paste whole config file here.

configured the dovecont.conf to enable plugin
configured the dovecot-dict-expire.conf
created the expires table in vmail mysql database

3

Re: Dovecot expire plugin doesn't work

iRedmail 0.74 upgraded from 0.73

nm2:~# dovecot -n | head -2
# 1.2.15: /etc/dovecot/dovecot.conf
# OS: Linux 2.6.32-5-686 i686 Debian 6.0.3

Followed instructions from http://wiki.dovecot.org/Plugins/Expire

cat /etc/dovecot/dovecot-dict-expire.conf
connect = host=127.0.0.1 dbname=vmail user=vmail password=**************************

map {
  pattern = shared/expire/$user/$mailbox
  table = expires
  value_field = expire_stamp

  fields {
    username = $user
    mailbox = $mailbox
  }
}

Dovecot.conf
#
# File generated by iRedMail (2011.11.15.14.09.05):
#
# Version:  0.7.3
# Project:  http://www.iredmail.org/
#
# Community: http://www.iredmail.org/forum/
#

# Provided services.
protocols = pop3 pop3s imap imaps managesieve

# Listen addresses. for Dovecot-1.1.x.
# ipv4: *
# ipv6: [::]
#listen = *, [::]
listen = *

# mail uid/gid.
mail_uid = 1001
mail_gid = 1001
first_valid_uid = 1001
last_valid_uid = 1001

#
# Debug options.
#
#mail_debug = yes
#auth_verbose = yes
#auth_debug = yes
#auth_debug_passwords = yes

#
# Log file.
#
#log_timestamp = "%Y-%m-%d %H:%M:%S "
log_path = /var/log/dovecot.log

#login_processes_count = 3
#login_max_processes_count = 128
#login_max_connections = 256

# Maximum number of running mail processes. Default is 512.
# When this limit is reached, new users aren't allowed to log in.
#max_mail_processes = 512

# Set max process size in megabytes. Default is 256.
# Most of the memory goes to mmap()ing files, so it shouldn't harm
# much even if this limit is set pretty high.
#
# Note:
# Some user reported that if mailbox is too large (e.g. 80GB), dovecot
# will disconnect the client with error:
# "pool_system_malloc(100248): Out of memory".
mail_process_size = 1024

disable_plaintext_auth = no

# Performance Tuning. Reference:
#   http://wiki.dovecot.org/LoginProcess
#
#
# High-Security mode. Dovecot default setting.
#
# It works by using a new imap-login or pop3-login process for each
# incoming connection. Since the processes run in a highly restricted
# chroot, running each connection in a separate process means that in
# case there is a security hole in Dovecot's pre-authentication code
# or in the SSL library, the attacker can't see other users'
# connections and can't really do anything destructive.
login_process_per_connection=yes

#
# High-Performance mode.
#
# It works by using a number of long running login processes,
# each handling a number of connections. This loses much of
# the security benefits of the login process design, because
# in case of a security hole the attacker is now able to see
# other users logging in and steal their passwords.
#login_process_per_connection = no

# Default realm/domain to use if none was specified.
# This is used for both SASL realms and appending '@domain.ltd' to username in plaintext logins.
auth_default_realm = thedarktimes.us

# ---- NFS storage ----
# Set to 'no' For NFSv2. Default is 'yes'.
#dotlock_use_excl = yes

#mail_nfs_storage = yes # v1.1+ only

# If indexes are on NFS.
#mail_nfs_index = yes # v1.1+ only
# ----

plugin {
    # Quota warning.
    #
    # You can find sample script from Dovecot wiki:
    # http://wiki.dovecot.org/Quota/1.1#head- … b45bec1734
    #
    # If user suddenly receives a huge mail and the quota jumps from
    # 85% to 95%, only the 95% script is executed.
    #
    quota_warning = storage=85%% /usr/local/bin/dovecot-quota-warning.sh 85
    quota_warning2 = storage=90%% /usr/local/bin/dovecot-quota-warning.sh 90
    quota_warning3 = storage=95%% /usr/local/bin/dovecot-quota-warning.sh 95
}

# SSL support.
ssl = yes
verbose_ssl = no
# ssl_key_file = /etc/ssl/private/iRedMail.key
# ssl_cert_file = /etc/ssl/certs/iRedMail_CA.pem
# ssl_ca_file = /etc/ssl/certs/iRedMail_CA.pem
ssl_key_file = /etc/ssl/private/nm2.key
ssl_cert_file = /etc/ssl/certs/nm2.abgnetwork.net.crt
ssl_ca_file = /etc/ssl/certs/gd_bundle.crt

# Maildir format and location.
mail_location = maildir:/%Lh/Maildir/:INDEX=/%Lh/Maildir/

plugin {
    # Quota, stored in file 'maildirsize' under user mailbox.
    # Dict quota. Used to store realtime quota in SQL.
    # Dict quota is recalculated only if the quota goes below zero. For example:
    #
    #   mysql> UPDATE mailbox SET bytes=-1,messages=-1 WHERE username='user@domain.ltd';
    #
    quota = dict:user::proxy::quotadict
    # Quota rules. Reference: http://wiki.dovecot.org/Quota/1.1
    # The following limit names are supported:
    #   - storage: Quota limit in kilobytes, 0 means unlimited.
    #   - bytes: Quota limit in bytes, 0 means unlimited.
    #   - messages: Quota limit in number of messages, 0 means unlimited. This probably isn't very useful.
    #   - backend: Quota backend-specific limit configuration.
    #   - ignore: Don't include the specified mailbox in quota at all (v1.1.rc5+).
    quota_rule = *:storage=0
    #quota_rule2 = *:messages=0
    #quota_rule3 = Trash:storage=1G
    #quota_rule4 = Junk:ignore
}

dict {
    # NOTE: dict process currently runs as root, so this file will be owned as root.
#    expire = db:/var/lib/dovecot/expire/expire.db
    expire = mysql:/etc/dovecot/dovecot-dict-expire.conf
}

plugin {
    # ---- Expire plugin ----
    # Expire plugin. Mails are expunged from mailboxes after being there the
    # configurable time. The first expiration date for each mailbox is stored in
    # a dictionary so it can be quickly determined which mailboxes contain
    # expired mails. The actual expunging is done in a nightly cronjob, which
    # you must set up:
    #
    #   1   3   *   *   *   /usr/sbin/dovecot --exec-mail ext /usr/libexec/dovecot/expire-tool
    #
    # Trash: 7 days
    # Trash's children directories: 7 days
    # Junk: 30 days
    expire = Trash 7 Trash/* 7 Junk 30 Sent 30
    expire_dict = proxy::expire

    # If you have a non-default path to auth-master, set also:
    auth_socket_path = /var/run/dovecot/auth-master
}

# Per-user sieve mail filter.
plugin {
    # For maildir format.
    sieve = /var/vmail/sieve/%Ld/%Ln/dovecot.sieve
}
# LDA: Local Deliver Agent
protocol lda {
    postmaster_address = root
    auth_socket_path = /var/run/dovecot/auth-master
    mail_plugins = quota sieve autocreate expire
    sieve_global_path = /var/vmail/sieve/dovecot.sieve
    log_path = /var/log/sieve.log
}
# IMAP configuration
protocol imap {
    mail_plugins = quota imap_quota autocreate expire

    imap_client_workarounds = tb-extra-mailbox-sep

    # number of connections per-user per-IP
    #mail_max_userip_connections = 10
}

# POP3 configuration
protocol pop3 {
    mail_plugins = quota expire
    pop3_uidl_format = %08Xu%08Xv
    pop3_client_workarounds = outlook-no-nuls oe-ns-eoh

    # number of connections per-user per-IP
    #mail_max_userip_connections = 10
}

auth default {
    mechanisms = plain login
    user = vmail
    passdb sql {
        args = /etc/dovecot/dovecot-mysql.conf
    }
    userdb sql {
        args = /etc/dovecot/dovecot-mysql.conf
    }
    socket listen {
        master {
            path = /var/run/dovecot/auth-master
            mode = 0666
            user = vmail
            group = vmail
        }
        client {
            path = /var/spool/postfix/dovecot-auth
            mode = 0666
            user = postfix
            group = postfix
        }
    }
}
plugin {
    autocreate = INBOX
    autocreate2 = Sent
    autocreate3 = Trash
    autocreate4 = Drafts
    autocreate5 = Junk

    autosubscribe = INBOX
    autosubscribe2 = Sent
    autosubscribe3 = Trash
    autosubscribe4 = Drafts
    autosubscribe5 = Junk
}
dict {
    # Dict quota. Used to store realtime quota in SQL.
    quotadict = mysql:/etc/dovecot/dovecot-used-quota.conf
}
namespace private {
    separator = /
    prefix =
    #location defaults to mail_location.
    inbox = yes
}

namespace shared {
    separator = /
    prefix = Shared/%%u/
    location = maildir:/%%Lh/Maildir/:INDEX=/%%Lh/Maildir/Shared/%%u
    # this namespace should handle its own subscriptions or not.
    subscriptions = yes
    list = children
}

plugin {
    acl = vfile
    acl_shared_dict = proxy::acl
}
dict {
    acl = mysql:/etc/dovecot/dovecot-share-folder.conf
}
# ManageSieve service. http://wiki.dovecot.org/ManageSieve
protocol managesieve {
    # IP or host address where to listen in for connections.
    listen = 127.0.0.1:4190

    # Login executable location.
    #login_executable = /usr/local/libexec/dovecot/managesieve-login

    # ManageSieve executable location. See IMAP's mail_executable above for
    # examples how this could be changed.
    #mail_executable = /usr/local/libexec/dovecot/managesieve

    # Maximum ManageSieve command line length in bytes. This setting is
    # directly borrowed from IMAP. But, since long command lines are very
    # unlikely with ManageSieve, changing this will not be very useful.
    #managesieve_max_line_length = 65536

    # ManageSieve logout format string:
    #  %i - total number of bytes read from client
    #  %o - total number of bytes sent to client
    #managesieve_logout_format = bytes=%i/%o

    # If, for some inobvious reason, the sieve_storage remains unset, the
    # ManageSieve daemon uses the specification of the mail_location to find out
    # where to store the sieve files (see explaination in README.managesieve).
    # The example below, when uncommented, overrides any global mail_location
    # specification and stores all the scripts in '~/mail/sieve' if sieve_storage
    # is unset. However, you should always use the sieve_storage setting.
    # mail_location = mbox:~/mail

    # To fool ManageSieve clients that are focused on timesieved you can
    # specify the IMPLEMENTATION capability that the dovecot reports to clients
    # (default: "dovecot").
    #managesieve_implementation_string = dovecot
}

# sieve plugin. http://wiki.dovecot.org/LDA/Sieve
plugin {
    # If the user has no personal active script (i.e. if the file
    # indicated in sieve= does not exist), use this one:
    #sieve_global_path = /var/vmail/sieve/dovecot.sieve

    # The include extension fetches the :global scripts from this
    # directory.
    #sieve_global_dir =

    # Path to a script file or a directory containing script files
    # that need to be executed before the user's script. If the path
    # points to a directory, all the Sieve scripts contained therein
    # (with the proper .sieve extension) are executed. The order of
    # execution is determined by the file names, using a normal 8bit
    # per-character comparison.
    #sieve_before = /var/vmail/sieve/dovecot.sieve

    # Identical to sieve_before, only the specified scripts are
    # executed after the user's script (only when keep is still in
    # effect!).
    #sieve_after = /var/vmail/sieve/dovecot.sieve

    # Location of the active script. When ManageSieve is used this is actually
    # a symlink pointing to the active script in the sieve storage directory.
    sieve = /var/vmail/sieve/%Ld/%Ln/dovecot.sieve

    # The path to the directory where the personal Sieve scripts are stored. For
    # ManageSieve this is where the uploaded scripts are stored.
    sieve_dir = /var/vmail/sieve/%Ld/%Ln
}

4

Re: Dovecot expire plugin doesn't work

Expire plugin in Dovecot-1.x is buggy, i'm afraid you have to upgrade to Dovecot-2.0.x to get a working expire plugin. sad