quota-status for outgoing mail (Dovecot/Postfix)
[Dovecot version 2.3.11.3 (502c39af9)]
Hi all,
I’m using Dovecot’s quota-status service to let Postfix check the recipient’s quota before accepting emails following the guide here: https://blog.sys4.de/postfix-dovecot-mailbox-quota-en.html https://blog.sys4.de/postfix-dovecot-mailbox-quota-en.html. This works well for inbound emails.
I would like to set up something similar for outbound email, i.e. if a user is over quota, they should not be allowed to send new emails. At the moment, the setup is in a bit of an inconsistent state: Users that have exceeded their quota are still able to send outbound emails but saving them in their Sent folder will fail leaving them without a copy.
I have tried using Dovecot’s quota-status in Postfix’s smtpd_send_restrictions but didn’t get this to work. A quick look at the Dovecot source code seems to suggest that the quota-status plugin is only checking the recipient address: https://github.com/dovecot/core/blob/master/src/plugins/quota/quota-status.c... https://github.com/dovecot/core/blob/master/src/plugins/quota/quota-status.c... and https://github.com/dovecot/core/blob/master/src/plugins/quota/quota-status.c... https://github.com/dovecot/core/blob/master/src/plugins/quota/quota-status.c....
I suspect it’s not possible to use the quota-status service to control outbound email but thought I’d ask to confirm. I’m wondering if there’s a different way to achieve this?
Thanks Peter
If you are not restricted to using dovecot and postfix only, I suggest having a look at policyd "cluebringer" - from https://wiki.policyd.org/
Works great to set quotas per user or per domain.
On 06.12.20 21:13, Peter Folta wrote:
[Dovecot version 2.3.11.3 (502c39af9)]
Hi all,
I’m using Dovecot’s quota-status service to let Postfix check the recipient’s quota before accepting emails following the guide here: https://blog.sys4.de/postfix-dovecot-mailbox-quota-en.html https://blog.sys4.de/postfix-dovecot-mailbox-quota-en.html. This works well for inbound emails.
I would like to set up something similar for outbound email, i.e. if a user is over quota, they should not be allowed to send new emails. At the moment, the setup is in a bit of an inconsistent state: Users that have exceeded their quota are still able to send outbound emails but saving them in their Sent folder will fail leaving them without a copy.
I have tried using Dovecot’s quota-status in Postfix’s smtpd_send_restrictions but didn’t get this to work. A quick look at the Dovecot source code seems to suggest that the quota-status plugin is only checking the recipient address: https://github.com/dovecot/core/blob/master/src/plugins/quota/quota-status.c... https://github.com/dovecot/core/blob/master/src/plugins/quota/quota-status.c... and https://github.com/dovecot/core/blob/master/src/plugins/quota/quota-status.c... https://github.com/dovecot/core/blob/master/src/plugins/quota/quota-status.c....
I suspect it’s not possible to use the quota-status service to control outbound email but thought I’d ask to confirm. I’m wondering if there’s a different way to achieve this?
Thanks Peter
On 06/12/2020 21:13, Peter Folta wrote:
[Dovecot version 2.3.11.3 (502c39af9)]
Hi all,
I’m using Dovecot’s quota-status service to let Postfix check the recipient’s quota before accepting emails following the guide here: https://blog.sys4.de/postfix-dovecot-mailbox-quota-en.html https://blog.sys4.de/postfix-dovecot-mailbox-quota-en.html. This works well for inbound emails.
I would like to set up something similar for outbound email, i.e. if a user is over quota, they should not be allowed to send new emails. At the moment, the setup is in a bit of an inconsistent state: Users that have exceeded their quota are still able to send outbound emails but saving them in their Sent folder will fail leaving them without a copy.
I have tried using Dovecot’s quota-status in Postfix’s smtpd_send_restrictions but didn’t get this to work. A quick look at the Dovecot source code seems to suggest that the quota-status plugin is only checking the recipient address: https://github.com/dovecot/core/blob/master/src/plugins/quota/quota-status.c... https://github.com/dovecot/core/blob/master/src/plugins/quota/quota-status.c... and https://github.com/dovecot/core/blob/master/src/plugins/quota/quota-status.c... https://github.com/dovecot/core/blob/master/src/plugins/quota/quota-status.c....
I suspect it’s not possible to use the quota-status service to control outbound email but thought I’d ask to confirm. I’m wondering if there’s a different way to achieve this?
Thanks Peter
Peter
The dovecot quota-status service only checks the recipient address. In order to achieve this with the quota-status service, you'd need to change the source code introducing the capability to check the sender address. You'd also need a way to differentiate when to use the existing capability to check recipient and when to use the new capability to check sender. One way of doing that would be to use the policy_context attribute available in Postfix 3.1 and later in order to differentiate whether you are calling quota-status for inbound or outbound email, example:
policy_context=submission
http://www.postfix.org/SMTPD_POLICY_README.html
John
participants (3)
-
infoomatic
-
John Fawcett
-
Peter Folta