Python stuff for cyrus imapd
[sasl module]
- Saslmodule for sasl 1.x - Version 0.3
- Saslmodule for sasl 2.x - Version 0.4
To compile saslmodule for 1.x [deprecated]:
make -f Makefile.pre.in boot && make
saslmodule for 2.x is python native
Usage:
from Sasl import createuser, deleteuser, setpass (for sasl 1.x) or from Sasl2 import createuser, deleteuser, setpass (for sasl 2.x) createuser(user, password) deleteuser(user) setpass(user, password) Sasl2 only: getuser(user) getuserlist()
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:
skiplist.py corrupted.seen > seen.txt /usr/sbin/cvt_cyrusdb _full_path_/seen.txt flat _full_path_/repaired.seen skiplist
[cyruslib]
cyruslib is wrapped interface for imaplib.py, it adds support for cyrus specific commands. Function naming is the same of cyradm
Note: you can find an updated fork here http://python-cyrus.sourceforge.net/
Usage:
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 imaplib.py plus: 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: login/logout 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: m.cm("user", "sherpya") m.lm() m.sq("user", "sherpya", 10000) m.lq("user", "sherpya") m.sam("user","sherpya", "cyrus", "c") # needed to delete a mailbox m.dm("user", "sherpya")