Hi there,

I’m at the moment in the concept stage for the implementation of custom
policies which will be attached to several postfix instances.

A brief description of what i have now:

I have three postgres tables: mail_filter, mail_filter_rule and
mail_filter_action

a filter (mail_filter entry) can have one or many rules (mail_filter_rule
entries) as well as actions (mail_filter_action entries)

For example,

Filter 1, could be something like, mail from: f...@bar.org and rcpt to:
b...@foo.org and in this time frame 14:00-19:00 could be (and now come the
actions in to play), "blocked"

Filter 2, could be something like, mail from: domainX.com and rcpt to:
b...@foo.org and in this time frame 10:00-13:00 could be "remove attachments
of mime type Y and notify someone"

I developed a small policy server [1] in rust, and at the moment the
concept is working fine for actions like accepting, rejecting or even bcc
at the SMTP protocol stage (i am using in at smtpd_recipient_restrictions).
Normal, is how [1] works, you have to return only one action. But there are
some other rules which must be checked in another stage, i would say with a
after-queue content filter [2].

Rules are very flexible, but maybe most of them will have only one action
reject or accept, that's why, i find better to do it at the SMTP protocol
stage. Then, only If a rule contains some content filtering related action,
i could return a "FILTER" action as stated here[3] and then a custom
content filter will finish the job.

I hope i am on the right way, if someone have some other thoughts i would
be glad to read them. :)

Best regards,
Manuel Mely

1- http://www.postfix.org/SMTPD_POLICY_README.html
2- http://www.postfix.org/FILTER_README.html
3- http://www.postfix.org/access.5.html

Reply via email to