[Dovecot] Override quota rules based on mail's content
Hi, I've a mail server with Postfix and Dovecot, using a LDAP backend to get the users. I've also configure quota rules, and I'm able to get the quota from LDAP. But I need the mails that come from the local domain to bypass the quota rule and be delivered to the users' inbox. Is there any way to do that?
Information required by Dovecot's mailing list rules:
+++ dovecot.conf +++ # 1.1.11: /etc/dovecot/dovecot.conf # OS: Linux 2.6.28-15-server x86_64 Ubuntu 9.04 ext4 log_timestamp: %Y-%m-%d %H:%M:%S protocols: imap disable_plaintext_auth: no login_dir: /var/run/dovecot/login login_executable: /usr/lib/dovecot/imap-login login_user: postfix valid_chroot_dirs: /var/spool/dovecot first_valid_uid: 1000 first_valid_gid: 512 mail_privileged_group: mail mail_location: maildir:/var/spool/dovecot/%n/ mail_plugins: quota imap_quota imap_client_workarounds: delay-newmail outlook-idle netscape-eoh tb-extra-mailbox-sep auth default: mechanisms: plain login default_realm: esci.es username_format: %Lu passdb: driver: pam passdb: driver: ldap args: /etc/dovecot/dovecot-ldap.conf userdb: driver: prefetch userdb: driver: passwd userdb: driver: ldap args: /etc/dovecot/dovecot-ldap-userdb.conf socket: type: listen client: path: /var/spool/postfix/private/auth mode: 432 user: postfix group: postfix master: path: /var/run/dovecot/auth-master mode: 384 user: mail group: mail plugin: quota: maildir:User quota quota_rule: *:storage=50M quota_rule2: Trash:ignore
+++ dovecot-ldap.conf +++ hosts = ldap.esci.es auth_bind = yes ldap_version = 3 base = ou=Users, dc=esci, dc=es scope = subtree user_attrs = homeDirectory=home,uidNumber=uid,gidNumber=gid,mailQuota=quota_rule=*:storage=%$M user_filter = (&(objectClass=posixAccount)(|(mail=%u)(uid=%u)(uid=%n))) pass_attrs = uid=user,userPassword=password,\
homeDirectory=userdb_home,uidNumber=userdb_uid,gidNumber=userdb_gid,mailQuota=userdb_quota_rule=*:storage=%$M pass_filter = (&(objectClass=posixAccount)(|(mail=%u)(uid=%u))) default_pass_scheme = SSHA
Thanks.
Andreas Calvo Gómez <andreas.calvo@admi.esci.es> Dept. Informàtica ESCI Pg. Pujades, 1 08003 Barcelona tel. (34) 932954710 ext.233 fax. (34) 932954720 http://www.esci.es
On Thu, 2009-09-10 at 13:13 +0200, Andreas Calvo Gómez wrote:
But I need the mails that come from the local domain to bypass the quota rule and be delivered to the users' inbox. Is there any way to do that?
Create a copy of dovecot.conf that doesn't use quota and use it with deliver -c /etc/dovecot-noquota.conf
While we're on this subject, Having to maintain two copies of the config file isn't a very elegant solution. Is there a possiblity of perhaps introducing a flag to deliver to instruct it to ignore quote rules?
On Thu, 2009-09-10 at 13:13 +0200, Andreas Calvo Gómez wrote:
But I need the mails that come from the local domain to bypass the quota rule and be delivered to the users' inbox. Is there any way to do that?
Create a copy of dovecot.conf that doesn't use quota and use it with deliver -c /etc/dovecot-noquota.conf
well, you could also do:
/etc/dovecot-noquota.conf:
!include /etc/dovecot.conf mail_plugins =
With v1.2+ you could do it a bit more cleanly by overriding quota instead of mail_plugins:
plugin { quota = maildir:User quota:noenforcing }
On Thu, 2009-09-10 at 12:53 -0700, Marty Anstey wrote:
While we're on this subject, Having to maintain two copies of the config file isn't a very elegant solution. Is there a possiblity of perhaps introducing a flag to deliver to instruct it to ignore quote rules?
On Thu, 2009-09-10 at 13:13 +0200, Andreas Calvo Gómez wrote:
But I need the mails that come from the local domain to bypass the quota rule and be delivered to the users' inbox. Is there any way to do that?
Create a copy of dovecot.conf that doesn't use quota and use it with deliver -c /etc/dovecot-noquota.conf
Actually I just tried this and it doesn't appear to work:
Fatal: Error in config file /etc/dovecot-noquota.conf: deliver doesn't support !include directive
I checked deliver.c in both 1.1.8 and 1.2.4 and it doesn't look like it's supported in either.
well, you could also do:
/etc/dovecot-noquota.conf:
!include /etc/dovecot.conf mail_plugins =
With v1.2+ you could do it a bit more cleanly by overriding quota instead of mail_plugins:
plugin { quota = maildir:User quota:noenforcing }
On Thu, 2009-09-10 at 14:25 -0700, Marty Anstey wrote:
Actually I just tried this and it doesn't appear to work:
Fatal: Error in config file /etc/dovecot-noquota.conf: deliver doesn't support !include directive
I checked deliver.c in both 1.1.8 and 1.2.4 and it doesn't look like it's supported in either.
Oh. You can do the same thing manually though. /etc/dovecot-noquota.conf.in contains the mail_plugins setting and then have some script that does cat /etc/dovecot.conf /etc/dovecot-noquota.conf.in
/etc/dovecot-quota.conf and try to remember to run it whenever dovecot.conf is updated. :) Or make it automatic by running some deliver.sh that checks if it has to be done.
This is anyway also fixed entirely in upcoming Dovecot v2.0.
No problem; 'grep -Ev "^\s*quota_warning.*$" /etc/dovecot.conf > /etc/dovecot-noquota.conf' solved it for now...
Just out of curiosity, how has this been addressed in 2.0?
Actually I just tried this and it doesn't appear to work:
Fatal: Error in config file /etc/dovecot-noquota.conf: deliver doesn't support !include directive
I checked deliver.c in both 1.1.8 and 1.2.4 and it doesn't look like it's supported in either.
Oh. You can do the same thing manually though. /etc/dovecot-noquota.conf.in contains the mail_plugins setting and then have some script that does cat /etc/dovecot.conf /etc/dovecot-noquota.conf.in
/etc/dovecot-quota.conf and try to remember to run it whenever
dovecot.conf is updated. :) Or make it automatic by running some deliver.sh that checks if it has to be done.
This is anyway also fixed entirely in upcoming Dovecot v2.0.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Thu, 10 Sep 2009, Marty Anstey wrote:
Actually I just tried this and it doesn't appear to work:
Fatal: Error in config file /etc/dovecot-noquota.conf: deliver doesn't support !include directive
I manage multiple copies of conf's using make and:
a) patch / apply a diff each time b) use a preprocessor, such as GNU m4
m4 is pretty easy, if one understands the illogic ` ' quoting :) Actually, "m4" is superceeding patch and sed nowadays.
Bye,
Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux)
iQEVAwUBSrc5d3WSIuGy1ktrAQImjAgAkPUXjYx5AaI+/68PBGGcctbY2b83sLvI 5UL65Sl/tURsKkfyqHldlumJTz7VaO5BuqMnd4AlR0clb+XoSmNHu/MU1EOOADS2 oE+xr+yCg3R0uRv9dYkPsVP4Ahcxej51CCvGLSv6VJNLNnlNlTd4KxD5C7uIxLfj eF+Kwcm3abclNxPH/5X08PNKb1d1rr0rJhTigd2y3jFI1j23Z+F4A8IUnye05ZOH 5E4rRnROI+ulGysExeVzVVDFfdMH9eeJvnXG/34LeAMKujZtI4fuD0NrkdfqpQNN 7k0P6QFJcrYKEYXGjFuBrxhTx+9Gbvz/bkK7JbDT+sycLqJTGlAmUg== =SyTc -----END PGP SIGNATURE-----
Hi, thanks for your quick answer. But, where can I filter the sender and allow the mail to be delivered to the user mailbox?
Thanks.
Andreas Calvo Gómez <andreas.calvo@admi.esci.es> Dept. Informàtica ESCI Pg. Pujades, 1 08003 Barcelona tel. (34) 932954710 ext.233 fax. (34) 932954720 http://www.esci.es
El jue, 10-09-2009 a las 13:47 -0400, Timo Sirainen escribió:
On Thu, 2009-09-10 at 13:13 +0200, Andreas Calvo Gómez wrote:
But I need the mails that come from the local domain to bypass the quota rule and be delivered to the users' inbox. Is there any way to do that?
Create a copy of dovecot.conf that doesn't use quota and use it with deliver -c /etc/dovecot-noquota.conf
participants (4)
-
Andreas Calvo Gómez
-
Marty Anstey
-
Steffen Kaiser
-
Timo Sirainen