On Tue, Sep 27, 2016 at 03:22:54PM -0400, Wietse Venema wrote:
> > If at least one of the MX resource records of a mail domain contains a
> > .onion-TLD, any non-.onion MX-RRs MUST be ignored to avoid sending the
> > email over the clearnet instead of TOR.
> >
> > Is it possible to configure Postfix for that kind of filtering or is
> > there any kind of hook for a filtering script?
>
> It's appropriately named: smtp_dns_reply_filter.
>
> http://www.postfix.org/postconf.5.html#smtp_dns_reply_filter
Note however, that this will not suffice for the OP's request.
The filtering of DNS records is (as with header and body checks)
performed one record at a time, with no means to perform actions
that consider multiple records in combination.
Perhaps the "python" support in "unbound" is a better means to do
this, there you can likely apply custom logic to entire RRsets.
--
Viktor.