[Dovecot] 1.0.10 / Quota postlogin / Deliver - Not working according to the wiki?
Hello....
I load quotas from users homefolders using postlogin like this:
#!/bin/sh
# Read users quota
if [ -f ~/quota ]; then
export QUOTA=cat ~/quota
fi
# Start IMAP session exec /usr/lib/dovecot/imap
User without a quota-file in their homedirs get a quota set in dovecot.conf.
Im using LDA. According to the wiki this should not work:
http://wiki.dovecot.org/Quota?highlight=quota : This post-login trick unfortunately doesn't work with deliver http://wiki.dovecot.org/LDA. If you need it, you're pretty much out of luck for now. v1.1 *quota* http://wiki.dovecot.org/Quota/New makes this possible.
According to my tests it does indeed work. What is not supposed to work?
Tobias
On Fri, 2008-02-15 at 15:40 +0100, Tobias Balle-Petersen wrote:
#!/bin/sh
# Read users quota if [ -f ~/quota ]; then export QUOTA=
cat ~/quota
fi# Start IMAP session exec /usr/lib/dovecot/imap
User without a quota-file in their homedirs get a quota set in dovecot.conf.
Sure this works for IMAP.
Im using LDA. According to the wiki this should not work:
Because the script is run only when logging in with IMAP, not when delivering new mails, so deliver runs with the default quota limit.
According to my tests it does indeed work. What is not supposed to work?
The script is definitely not run by deliver, but maybe you've managed to make it work some other way (or you misunderstood something). One possibility would be to set $QUOTA before running deliver and making sure deliver doesn't override it.
Timo Sirainen wrote:
Because the script is run only when logging in with IMAP, not when delivering new mails, so deliver runs with the default quota limit.
OK. I was confused because a user over limit (from personal quota-file) indeed gets his messages deleted when new mail comes in. I see now however, that new mail keeps comming in to the user when is Trash is empty AND he is over quota. Thanks for clearing this up.
The script is definitely not run by deliver, but maybe you've managed to make it work some other way (or you misunderstood something).
Seems to be the issue here ;)
One possibility would be to set $QUOTA before running deliver and making sure deliver doesn't override it.
Can you tell me more about my options in this direction? You mean the user would load his quota whem logging in, and this quota would stay loaded and visible to deliver even after he logs out?
Thanks, Tobias
On Feb 15, 2008, at 4:56 PM, Tobias Balle-Petersen wrote:
One possibility would be to set $QUOTA before running deliver and
making sure deliver doesn't override it.Can you tell me more about my options in this direction? You mean
the user would load his quota whem logging in, and this quota would
stay loaded and visible to deliver even after he logs out?
What you describe sounds like the maildirsize file's header which
includes the quota information. You can have Dovecot use this is you
specify "quota = maildir" i.e. without specifying any limits. Some
possibilities to do this:
a) Move plugin {} section before protocol lda {} and specify the
quota=maildir in protocol lda {}. I think this makes deliver use the
one in lda for deliver and the one in plugin for imap.
b) Specify quota=maildir in plugin {} and override it in the imap's
post-login script.
Anyway I didn't mean this, although this is probably a better idea. I
was talking about doing some kind of a pre-deliver script:
#!/bin/sh
QUOTA=cat ~/quota
exec /usr/local/libexec/dovecot/deliver
But this also requires that quota isn't defined anywhere in
dovecot.conf or it gets overridden. Also v1.1 requires using an extra
command line parameter or it drops all environment variables. And this
of course requires that you know the user's home dir before deliver is
run.
Hello Timo.
I'm not sure that I have correctly understood your suggestions, but this is what I have tried to do in order to control users' quota from the file maildirsize.
- Put "quota = maildir" in section "plugin {"
- Put "quota = maildir" in section "protocol lda {"
- Move section "protocol lda {" to the end of dovecot.conf
This gives me the correct quota when logging in with imap, but mails sent to the user are not rejected even though the user is over quota. Any ideas?
Thanks, Tobias
Timo Sirainen wrote:
a) Move plugin {} section before protocol lda {} and specify the quota=maildir in protocol lda {}. I think this makes deliver use the one in lda for deliver and the one in plugin for imap.
Hello...
Here is the result of dovecot -n: # 1.0.10: /etc/dovecot/dovecot.conf log_timestamp: %Y-%m-%d %H:%M:%S protocols: imaps imap listen: localhost:143 ssl_listen: *:993 ssl_cert_file: /etc/ssl/certs/imap.kontrapunkt.com.crt ssl_key_file: /etc/ssl/private/imap.kontrapunkt.com.key ssl_key_password: XXXXXXXXXXXXXX disable_plaintext_auth: no login_dir: /var/run/dovecot/login login_executable: /usr/lib/dovecot/imap-login login_greeting: System ready. login_process_per_connection: no valid_chroot_dirs: /home/vmail mail_extra_groups: mail mail_location: maildir:/home/vmail/%n/mail:INDEX=/var/indexes/%n maildir_copy_with_hardlinks: yes mail_plugins: quota imap_quota trash imap_client_workarounds: delay-newmail auth default: username_format: %n debug: yes passdb: driver: ldap args: /etc/dovecot/dovecot-ldap.conf userdb: driver: passwd userdb: driver: static args: uid=vmail gid=vmail home=/home/vmail/%n allow_all_users=yes userdb: driver: ldap args: /etc/dovecot/dovecot-ldap.conf socket: type: listen client: path: /var/spool/postfix/private/auth-client mode: 432 user: postfix group: vmail master: path: /var/run/dovecot/auth-master mode: 432 user: vmail group: mail plugin: quota: maildir trash: /etc/dovecot/dovecot-trash.conf sieve: /home/vmail/%n/.dovecot.sieve
Tobias Balle-Petersen wrote:
Hello Timo.
I'm not sure that I have correctly understood your suggestions, but this is what I have tried to do in order to control users' quota from the file maildirsize.
- Put "quota = maildir" in section "plugin {"
- Put "quota = maildir" in section "protocol lda {"
- Move section "protocol lda {" to the end of dovecot.conf
This gives me the correct quota when logging in with imap, but mails sent to the user are not rejected even though the user is over quota. Any ideas?
participants (2)
-
Timo Sirainen
-
Tobias Balle-Petersen