Potential mail loss when server is over quota but user is not

When a virtual server has exceeded its quota (group quota) and incoming mail delivery is started for a user of that server with no quota (or a quota higher than the group quota) the mail will neither be delivered nor a DSN will be sent back to the sender of the message.

I am pretty sure that the affected configuration is stock virtualmin pro when it comes to mail delivery.

The following seems to happen here for local delivery:

  1. /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME is invoked by MTA (postfix)
  2. procmail-wrapper sets the user to the user being delivered for
  3. /usr/bin/procmail -o -a $DOMAIN -d $LOGNAME is invoked by procmail-wrapper
  4. /etc/webmin/virtual-server/lookup-domain.pl $LOGNAME is invoked a specified in /etc/procmailrc (see attachements)
  5. lookup-domain.pl exits with exit code 0
  6. Delivery is tried to $HOME/Maildir/
  7. Delivery fails because group quota is exceeded
  8. procmail exits with exit code 255
  9. procmail-wrapper exits with exit code 0
  10. MTA considers mail as successfully finished

In my book procmail-wrapper should never tamper with procmail exit codes.

As a workaround I will remove any virtual server quota until fixed.

Status: 
Closed (fixed)

Comments

Actually, in step 5 the lookup-domain command is supposed to exit with code 73, indicating that the user is at or near his disk quota. This should then be passed back to Postfix, which interprets code 73 as meaning that the user is over quota, and defers the mail. This is done intentionally to prevent a user's quota from being completely filled up, which then breaks Dovecot and prevents deletion of mail.

But if this is failing for you, it may be because the lookup-domain-daemon process is not running on your system. The lookup-domain command talks to lookup-domain-daemon to get quota information..

When the user is at his disk quota (user quota) lookup-domain returns 73 alright. But this does not happen if the virtual server is at its disk quota (group quota), lookup-domain returns 0 in this case.

Sorry, I missed the part about the domain being over quota. That is indeed a bug, which I will fix in the 3.96 Virtualmin release.

Automatically closed -- issue fixed for 2 weeks with no activity.