Yorck Koehler
2009-Nov-09 10:18 UTC
[Dovecot] Override Quota with post-login scripting problem
Hi everyone,
I do have the following dovecot-setup:
Passdb: PAM (Winbind-auth and pam_mkhomedir-session)
Userdb: passwd (NSS-winbind)
This validates/creates my users with aid of my running ActiveDirectory.
Now the problem: My global quota policy works fine, but I need to
override them for some users. I was sucessful within IMAP itself. I use
post-login scripting for that. The mail-clients displays the user-quota
correctly.
But delivery is still a problem, because I'm unable to override the
settings there with post-login scripting.
Everytime I send messages to such a user, dovecot sends it back with
"Quota exceeded (mailbox for user is full)"...
My Question: Is it possible to override the lda quota like I can do it
within imap ?
(I dont want to change my setup to MYSQL DB only for per-user Quota, if
its possible to use a simple file with names and quota)
This is the post-login script:
#quotaperuser.sh
#!/bin/sh
case "$USER" in
"ZAGH-V+username") QUOTA_RULE='*:storage=500M';;
"ZAGH-V+test") QUOTA_RULE='*:storage=5000M';;
esac
exec /usr/local/libexec/dovecot/imap $*
My Configuration:
{dovecot -n}
# 1.2.3: /usr/local/etc/dovecot.conf
# OS: Linux 2.6.16.60-0.54.5-smp i686 SUSE Linux Enterprise Server 10
(i586)
base_dir: /var/run/dovecot/
log_path: /var/log/dovecot.err
info_log_path: /var/log/dovecot.info
protocols: imap imaps pop3
ssl_listen: *
disable_plaintext_auth: no
login_dir: /var/run/dovecot//login
login_executable(default): /usr/local/libexec/dovecot/imap-login
login_executable(imap): /usr/local/libexec/dovecot/imap-login
login_executable(pop3): /usr/local/libexec/dovecot/pop3-login
mail_location: maildir:~/Maildir
mail_full_filesystem_access: yes
mail_executable(default): /usr/local/bin/quotaperuser.sh
mail_executable(imap): /usr/local/bin/quotaperuser.sh
mail_executable(pop3): /usr/local/libexec/dovecot/pop3
mail_plugins(default): quota imap_quota expire
mail_plugins(imap): quota imap_quota expire
mail_plugins(pop3): quota expire
mail_plugin_dir(default): /usr/local/lib/dovecot/imap
mail_plugin_dir(imap): /usr/local/lib/dovecot/imap
mail_plugin_dir(pop3): /usr/local/lib/dovecot/pop3
pop3_uidl_format(default): %08Xu%08Xv
pop3_uidl_format(imap): %08Xu%08Xv
pop3_uidl_format(pop3): %v.%u
lda:
postmaster_address: postmaster at zag.de
mail_plugins: sieve quota expire
mail_plugin_dir: /usr/local/lib/dovecot/lda
quota_full_tempfail: no
deliver_log_format: msgid=%m subject=%s from=%f status=%$
auth default:
username_chars:
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_ at +
username_format: zagh-v+%u
failure_delay: 0
passdb:
driver: pam
args: session=yes dovecot
userdb:
driver: passwd
plugin:
sieve: ~/.dovecot.sieve
sieve_dir: ~/sieve
quota: maildir:Quota
quota_rule: *:storage=100M
quota_rule2: Trash:storage=100M
quota_warning: storage=90%% /usr/local/bin/quota-warning.sh 90
quota_warning2: storage=75%% /usr/local/bin/quota-warning.sh 75
expire: trash 7
expire_dict: proxy::expire
Timo Sirainen
2009-Nov-10 01:31 UTC
[Dovecot] Override Quota with post-login scripting problem
On Mon, 2009-11-09 at 11:18 +0100, Yorck Koehler wrote:> But delivery is still a problem, because I'm unable to override the > settings there with post-login scripting. > > Everytime I send messages to such a user, dovecot sends it back with > "Quota exceeded (mailbox for user is full)"... > > My Question: Is it possible to override the lda quota like I can do it > within imap ?How do you call deliver? Anyway, create deliver.sh that works something like: #!/bin/sh QUOTA_RULE=... exec deliver -k -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part URL: <http://dovecot.org/pipermail/dovecot/attachments/20091109/5f5e1e68/attachment-0002.bin>
Yorck Koehler
2009-Nov-10 11:10 UTC
[Dovecot] Override Quota with post-login scripting problem
Timo Sirainen schrieb:> On Mon, 2009-11-09 at 11:18 +0100, Yorck Koehler wrote: >> But delivery is still a problem, because I'm unable to override the >> settings there with post-login scripting. >> >> Everytime I send messages to such a user, dovecot sends it back with >> "Quota exceeded (mailbox for user is full)"... >> >> My Question: Is it possible to override the lda quota like I can do it >> within imap ? > > How do you call deliver? Anyway, create deliver.sh that works something > like: > > #!/bin/sh > > QUOTA_RULE=... > exec deliver -k >I changed in my Postfix configuration from /usr/local/libexec/dovecot/deliver to /usr/local/bin/deliver.sh and created the following file (deliver.sh): #!/bin/sh QUOTA_RULE='*:storage=500M' exec /usr/local/libexec/dovecot/deliver -k ------- I'm still getting Quota exceeded messages, though 500M should be enough (Test-Mailbox is at 260M). I'm using Dovecot 1.2.7 since this morning (Nice work, btw.). I read in the source code (deliver.c) and found out that env_clean (-k) only changes the TZ/Home, if necessary. If Quota_Rule always comes from the dovecot.conf, this would explain, why defining "Quota_Rule" before calling deliver does not work. Sorry, im unable to understand the whole source code at once. Any Ideas ? sincerely yours - Yorck Koehler