I'm trying to solve problem with some blackscatter-like attacks, when spammer send email with real person From or Reply-To address to an account with quota exceeded.
This situation previously generated bounce message from Dovecot, being send to that person (and occasionally marked as SPAM) so I implemented dovecot as a policy service (check_policy_service
) which checks if account in "To" field has some free space for messages, otherwise it returns 550 during SMTP connection.
Unfortunately it doesn't work when there is an alias in "To" field, which may forward message to one or more real accounts. So first check returns OK but then after message was queued, when it goes to real account which quota is full, there is bounce message generated again.
I can write an SQL checking if any of alias destinations has quota exceeded, but it could cause revoking connection to alias which is connected to many accounts but only one with quota exceeded.
Is there any good solution to this?