On Thu, Jun 29, 2023 at 05:21:32PM +0200, Robert Senger via Postfix-users wrote:
Of course, I could write my own "sendmail" script which takes the
virtual_alias,

I was thinking about the same, just utilising postconf and postmap...

On 29.06.23 12:02, Viktor Dukhovni via Postfix-users wrote:
This is possible with care, but not ideal, better would be to find
some way to get the milter to make the relevant queries directly
(without command invocation per lookup, and risk of shell command
injection attacks, ...).

calls mysql,

This is not a good idea, if using commands, let postmap(1) do that.

...just because of these reasons.

Also note that virtual alias expansion is recursive, your script might
need to care of that too.

postmap supports multiple maps but not recursive lookups.
but I guess calling something like

postmap -q "$ADDRESS" `postconf -h virtual_alias_maps`

Could give correct result (I have tried now and looks it does)

another possibility Wietse mentioned some time ago is to use sendmail -bv to make postfix expand address further parse mail logs to see who the mail would go to. Parsing sender's mailbox for this info would work too, but both there solutions are tricky and require much more parsing (whole log file or whole mailbox).


returns sendmail compatible output to spamass-milter,

This could be a little tricky if an alias expands to multiple
users.  What does the milter do in that case?

If lookup resolves into multiple users, spamass-milter supports default fallback user. This is still good to reject at least some spam at SMTP level.

This is also good reason to have this working at milter (pre-queue) level.



It looks there is no library to access postfix code from e.g. perl to be able to call postfix routines directly, not as external "postmap" command.

Calling postmap should be fine fine to debug alias expansion as the problem we've seen this week. Not so much for expanding aliases from milter.



--
Matus UHLAR - fantomas, uh...@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Fighting for peace is like fucking for virginity...
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to