Discussion:
Querying mail addresses known by Postfix
Andre Nathan
2012-08-03 12:22:24 UTC
Permalink
Hello

I'm writing an SPF milter application with SRS support, making use of
milter's CHGFROM to rewrite the MAIL FROM address.

The application has to handle SRS in outgoing messages in 3 situations:

1) An MTA user sends a message (no redirect);
2) The MTA receives a message whose destination is translated via
virtual_alias_maps to a non-local email address;
3) The MTA receives a message that is delivered locally, but the
user sets up a redirection (eg. using Sieve) to a non-local address.

Case 3 can be dealt with by using a separate MTA and configuring SRS to
use a pre-configured domain for the rewriting, or, say, using the "j"
milter macro. This is also what should be done for case 2 too, but in
that situation it's not easy to differentiate it from outgoing messages
from case 1.

In case 1, I would like to use SRS with the same domain as the original
sender. In this case, the idea is not to change the domain to make SPF
work, since this is not a redirect, but to have a signed MAIL FROM which
can be reversed in case of bounces; that way I would be able to reject
fake bounce messages sent by spammers.

Differentiating between cases 1 and 2 would require a list of domains
known to the MTA, which of course I could keep in a file or a database,
but Postfix already has this information, and I would like to avoid
"duplicating" it.

So (finally) my question is: is there a standard way to query Postfix
about this information from an external program (for exemple, by
communicating via one of the sockets in the "private" directory)? Or
would the best solution be to basically incorporate the "postmap" code
in my application?

Other solutions and ideas are welcome.

Thanks,
Andre
Wietse Venema
2012-08-03 13:35:51 UTC
Permalink
Post by Andre Nathan
Differentiating between cases 1 and 2 would require a list of domains
known to the MTA, which of course I could keep in a file or a database,
but Postfix already has this information, and I would like to avoid
"duplicating" it.
Why not query the same database?

Postfix's database proxy service is not designed for use by non-Postfix
programs. Programs that use this are unsupported, meaning they will
whenever this internal protocol is changed.

Wietse
Andre Nathan
2012-08-03 14:15:34 UTC
Permalink
Hi Wietse
Post by Wietse Venema
Why not query the same database?
Postfix's database proxy service is not designed for use by non-Postfix
programs. Programs that use this are unsupported, meaning they will
whenever this internal protocol is changed.
Postfix supports a lot of different databases, and it would be nice if
my application could work with any postfix setup.

Thanks,
Andre

Loading...