On Saturday 12 January 2019 17:38:23 Viktor Dukhovni wrote:
> > On Jan 12, 2019, at 5:31 PM, Pali Rohár <pali.ro...@gmail.com> wrote:
> > 
> > If you mean external content filters, I wanted to avoid using them.
> 
> Sometimes you need to bring out the sledgehammer.
> 
> > And it is really possible for milter to get unix user who invoked
> > postdrop or sendmail wrapper? If yes, how? Because I thought that milter
> > operates on SMTP where is no unix user anymore...
> 
> Postfix supports non-SMTP milters.  The user's UID is recorded by
> pickup(8) in the topmost "Received" header.
> 
>    http://www.postfix.org/MILTER_README.html#non-smtp-milters

Ok. So milter needs to parse Received header and find UID, then convert
UID to unix user and implement postfix "map" logic (either hashmap or
external database lookup)...

Seems like too complicated.

Is there already such milter which can do that?


Meanwhile I decoded postdrop protocol and come up with more easier
solution:

I renamed postdrop binary to postdrop.real and implemented simple
postdrop wrapper which reads stdin, injects "R" command and pass it to
postdrop.real binary.

And email address for injected "R" command comes from:
postmap -q `id -un` 'regexp:/my/file'
(so my file is in postfix regexp format, like other postix configs)

I do not know how stable or documented is that binary postdrop protocol,
but seems that my wrapper is working fine and is really fast. Is there
anything which could be broken by usage of wrappers around postfix
binaries?


Would not you consider implementing this unix user bcc map for postdrop?
I think this could benefit and simplify implementation of feature "put
into my mailbox copy of every email which I sent". Because if you specify
different (envelope or email) sender, then it is hard (without above
content/milter filter) to check who really sent email.

-- 
Pali Rohár
pali.ro...@gmail.com

Attachment: signature.asc
Description: PGP signature

Reply via email to