Rahul Dhesi: > I would like to write an smtpd policy server[1] that will cause incoming > mail to be rejected during smtp if a local recipient (a Linux user in my > case) is exceeding his filesystem storage quota. > > Postfix supplies the envelope recipient but not the local recipient to the > smtpd policy server.
Your best shot is to implement aliasing in one place (virtual_alias_maps) as much as possible, and to query that from the policy server. > I cannot find a practical way of programmatically determining the local > recipient given the envelope recipient. Postfix is a pipeline of processes; some processes transform addresses before a message is queued (canonical_maps, virtual_alias_maps), and some transform addresses in the delivery agent (alias_maps, $HOME/.forward files). It is not practical for an SMTP daeamon to predict what all those transformations will do without gaping security holes like opensmtpd. Nor was it practical to release Postfix without support for sendmail-style alias_maps and $HOME/.forward. Postfix could store the result of transformations in a cache, but that would add complexity, especially with 1-to--many aliases, and it would require a store that supports concurrent reads and writes. At this time only LMDB can do that. Wietse > Numerous searches have turned up nothing. > > Looking for suggestions and ideas. > > Rahul > > [1] See: http://www.postfix.org/SMTPD_POLICY_README.html. >