Python stuff for cyrus imapd

[sasl module]

To compile saslmodule for 1.x [deprecated]:

make -f boot && make

saslmodule for 2.x is python native


from Sasl import createuser, deleteuser, setpass (for sasl 1.x)
from Sasl2 import createuser, deleteuser, setpass (for sasl 2.x)

createuser(user, password)
setpass(user, password)

Sasl2 only:

Note since there is a bug in sasl1, I suggest you to create sasldb adding at least one entry before using this module, even saslpasswd will segfault when the first user is added.

[skiplist recovery tool]

Tool to recover corrupted cyrus imapd skiplist files by converting to flat format

Usage: corrupted.seen > seen.txt
/usr/sbin/cvt_cyrusdb _full_path_/seen.txt flat _full_path_/repaired.seen skiplist


cyruslib is wrapped interface for, it adds support for cyrus specific commands. Function naming is the same of cyradm

Note: you can find an updated fork here


import cyruslib
m = cyruslib.CYRUS()
m.login("cyrus", "mypass")

now m.m is an IMAP4 instance so you can use same method of IMAP4 from
getsep()                         - Gets mailbox separator . or /
getacl(mailbox)                  - Gets acls on a mailbox
setacl(mailbox, id, acl)         - Sets acl for id on a mailbox
getquota(mailbox)                - Gets quota value for a mailbox
setquota(mailbox, type, limit)   - Sets quota for a mailbox, type should be STORAGE and limit is the quota value

There are also some high level functions:

cm(group, username)              - Creates a mailbox
dm(group, username)              - Deletes a mailbox
lm()                             - Lists mailboxes (returns a dict with groups)
lam(group, username)             - Lists acls on a mailbox (returns a dict)
sam(group, username, id, rights) - Sets acls on a mailbox for id
lq(group, username)              - Gets quota for a mailbox
sq(group, username, limit)       - Sets quota for a mailbox

example:"user", "sherpya")
m.sq("user", "sherpya", 10000)
m.lq("user", "sherpya")
m.sam("user","sherpya", "cyrus", "c") # needed to delete a mailbox"user", "sherpya")