Hi, is it possible to ask Dovecot for a users quota by talking to the Dovecot server over TCP? I know about doveadm quota -u <user>, but I would like to know, if I can query for that over a network connection (on the Postfix ML they suggested writing a policy service that checks quota. Postfix is not always on the same server as Dovecot is). Does the LMTP protocol give that information somehow? I am not so familiar with LMTP. Or some Unix-Socket to query that could also be configured as inet_listener? Thanks in advance -Christian R??ner -- [*] sys4 AG http://sys4.de, +49 (89) 30 90 46 64 Franziskanerstra?e 15, 81669 M?nchen Sitz der Gesellschaft: M?nchen, Amtsgericht M?nchen: HRB 199263 Vorstand: Patrick Ben Koetter, Axel von der Ohe, Marc Schiffbauer Aufsichtsratsvorsitzender: Joerg Heidrich
Christian R??ner wrote:> is it possible to ask Dovecot for a users quota by talking to the Dovecot > server over TCP? I know about doveadm quota -u <user>, but I would like to > know, if I can query for that over a network connection (on the Postfix ML > they suggested writing a policy service that checks quota. Postfix is not > always on the same server as Dovecot is). > > Does the LMTP protocol give that information somehow? > I am not so familiar with LMTP. Or some Unix-Socket to > query that could also be configured as inet_listener?LMTP only returns an error if you're already over quota. You can query the quota of a specific mailbox via IMAP using GETQUOTAROOT: http://tools.ietf.org/rfc/rfc2087.txt Several script languages provide helper functions for this: perl: IMAP::Admin->get_quotaroot php: imap_get_quota ruby: Net::IMAP::MailboxQuota Regards Daniel -- https://plus.google.com/103021802792276734820
Hi> perl: IMAP::Admin->get_quotaroot > php: imap_get_quota > ruby: Net::IMAP::MailboxQuotapython-imaplib in my case ;) If connecting from the policy service, can I use Dovecot master password to get quota over IMAP? Thanks again Christian> > Regards > Daniel > -- > https://plus.google.com/103021802792276734820
On 4.11.2012, at 22.34, Christian R??ner wrote:> is it possible to ask Dovecot for a users quota by talking to the Dovecot server over TCP? I know about doveadm quota -u <user>, but I would like to know, if I can query for that over a network connection (on the Postfix ML they suggested writing a policy service that checks quota. Postfix is not always on the same server as Dovecot is). > > Does the LMTP protocol give that information somehow? I am not so familiar with LMTP. Or some Unix-Socket to query that could also be configured as inet_listener?You could connect to doveadm-server socket and basically ask the "doveadm quota" command via it. There's not much documentation about it though. But I'm sure I've mentioned details a couple of times in this mailing list.. I've also had some plans to make a somewhat easier socket for asking this. Maybe using doveadm-server process, or maybe a whole new quota-query binary that can talk multiple protocols.. It would be pretty easy to do, mainly I just haven't been sure what would be the cleanest way to implement this.
Christian R??ner wrote:> > perl: IMAP::Admin->get_quotaroot > > php: imap_get_quota > > ruby: Net::IMAP::MailboxQuota > > python-imaplib in my case ;) > > If connecting from the policy service, can I use Dovecot master password to get quota over IMAP?Yes, I think a master user login should work as if the user has logged in. If you store quota in a database, the policy service could query the database. Regards Daniel -- https://plus.google.com/103021802792276734820
Hi,>> If connecting from the policy service, can I use Dovecot master password to get quota over IMAP? > > Yes, I think a master user login should work as if the user has logged in. > > If you store quota in a database, the policy service could query the database.thanks a lot for your information. I have written a policy service in python for Postfix that can check "over quota" in Dovecot. Using IMAPS and the master user to check quota. If someone is interested, I can send a copy off list. -Christian R??ner -- [*] sys4 AG http://sys4.de, +49 (89) 30 90 46 64 Franziskanerstra?e 15, 81669 M?nchen Sitz der Gesellschaft: M?nchen, Amtsgericht M?nchen: HRB 199263 Vorstand: Patrick Ben Koetter, Axel von der Ohe, Marc Schiffbauer Aufsichtsratsvorsitzender: Joerg Heidrich