[Dovecot] Vpopmail + Expire Plugin

Oliver Lehmann lehmann at ans-netz.de
Tue Jan 4 12:46:28 EET 2011


Hi,

I've changed my running qmail/vpopmail/procmail/courier-imap/sqwebmail
installation to qmail/vpopmail/siege/dovecot/horde imp.

So far, I've got everything running. Authentification with vpopmail as
passdb is working, Mail delivery with siege into different Mail folders
is working as well.

One of the reasons why I switched to dovecot was the expire plugin and
right now I'm trying to set it up but I don't get it to run.

- I created a MySQL User as advised
- I created a database and a table and granted SELECT, INSERT, DELETE,
   UPDATE privileges for that table to user dovecot

   # mysql -udovecot -p dovecot
   Enter password:
   mysql> desc expires;
   +--------------+--------------+------+-----+---------+-------+
   | Field        | Type         | Null | Key | Default | Extra |
   +--------------+--------------+------+-----+---------+-------+
   | username     | varchar(75)  | NO   | PRI | NULL    |       |
   | mailbox      | varchar(255) | NO   | PRI | NULL    |       |
   | expire_stamp | int(11)      | NO   |     | NULL    |       |
   +--------------+--------------+------+-----+---------+-------+
   3 rows in set (0.00 sec)

   mysql> select * from expires;
   Empty set (0.00 sec)

- I added the following lines to my dovecot.conf:

   dict {
     expire = mysql:/usr/local/etc/dovecot/dovecot-dict-sql.conf.ext
   }

    plugin {
     expire = Test
     expire_dict = proxy::expire
   }

- I created the dovecot-dict-sql.conf.ext

   # cat /usr/local/etc/dovecot/dovecot-dict-sql.conf.ext
   connect = host=localhost dbname=dovecot user=dovecot password=XXXX
   map {
     pattern = shared/expire/$user/$mailbox
     table = expires
     value_field = expire_stamp

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

- When restarting dovecot I had a dict error because the socket
   was owned by root. I changed that so the socket is owned by the
   user vpopmail.
- Then I created a folder "Test" via IMAP for one of my accounts
- Then I copied via Horde IMP (so via IMAP) a message to that new
   folder
- I requeried dovecot.expires in my database and it is still empty
- I enabled logging for my MySQL DB and with that I found out, that
   no connect with the "dovecot" user is made at all so of course
   the table is empty.
- I created a siege rule to move a mail directly to that Test folder
   when a specific Subject is used. lda moves the mail on arrival but
   still no MySQL connection is made.



I've read that doveadm -A must work to get the expire plugin workinj,
but it does not:

   # doveadm search -A mailbox INBOX subject test
   doveadm(olivleh1): Error: User listing returned failure
   doveadm: Error: Failed to iterate through some users
   #

The expire plugin is loaded on startup:

   Jan 04 11:35:50 imap: Debug: Loading modules from directory:
                         /usr/local/lib/dovecot
   Jan 04 11:35:50 imap: Debug: Module loaded:
                         /usr/local/lib/dovecot/lib20_expire_plugin.so

When using doveadm I'm getting a strange error:
   # doveadm -v expire -A mailbox INBOX subject test
   doveadm(olivleh1): Fatal: Unknown command 'expire', but plugin expire
     exists. Try to set mail_plugins=expire
   Exit 89
   #

I've no idea how to get it to work. I guess I need your help guys to
get it working ;)

   # dovecot -n
   # 2.0.7: /usr/local/etc/dovecot/dovecot.conf
   # OS: FreeBSD 7.3-STABLE i386
   auth_debug = yes
   auth_verbose = yes
   debug_log_path = /var/log/dovecot/dovecot-debug.log
   dict {
     expire = mysql:/usr/local/etc/dovecot/dovecot-dict-sql.conf.ext
   }
   disable_plaintext_auth = no
   first_valid_uid = 89
   info_log_path = /var/log/dovecot/dovecot-info.log
   last_valid_uid = 89
   listen = 127.0.0.1
   log_path = /var/log/dovecot/dovecot.log
   mail_debug = yes
   mail_plugins = " expire"
   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
   passdb {
     driver = vpopmail
   }
   plugin {
     expire = Test 1
     expire_dict = proxy::expire
     sieve = ~/.dovecot.sieve
     sieve_dir = ~/sieve
   }
   protocols = imap sieve
   service auth {
     unix_listener auth-userdb {
       group = vchkpw
       mode = 0600
       user = vpopmail
     }
   }
   service dict {
     unix_listener dict {
       group = vchkpw
       mode = 0600
       user = vpopmail
     }
   }
   ssl_cert = </usr/local/etc/dovecot/ssl/certs/dovecot.pem
   ssl_key = </usr/local/etc/dovecot/ssl/private/dovecot.pem
   userdb {
     args = quota_template=quota_rule=*:backend=%q
     driver = vpopmail
   }
   protocol lda {
     debug_log_path = syslog
     info_log_path = syslog
     log_path = syslog
     mail_plugins = " sieve"
   }


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



More information about the dovecot mailing list