On Thu, Feb 10, 2022 at 01:50:36PM -0600, Edward Sandberg wrote:

> I am attempting to configure content filtering by following this guide:
> 
> http://www.postfix.org/FILTER_README.html
> 
> I have added the filter service and modified the smtp service in master.cf:
> 
> filter    unix  -       n       n       -       10      pipe
>       flags=Rq user=filter null_sender=
>       argv=/home/filter/filter.sh -f ${sender} -- ${recipient}
> smtp      inet  n       -       y       -       -       smtpd
>       -o content_filter=filter:dummy

This enables content-filtering of email that arrives from *outside*
via SMTP!

> smtp      unix  -       -       y       -       -       smtp
>       -o content_filter=filter:dummy

This has no effect

> relay     unix  -       -       y       -       -       smtp
>          -o syslog_name=postfix/$service_name
>       -o content_filter=filter:dummy

Nor this.  Delivery agents don't run content filters, which
are assigned on input to preëmpt normal transport resolution.

> echo  "body of your email" |
>    mail -s "This is a subject too" \
>       -a "From:redac...@redacted.com" redac...@redacted.com
> 
> This is the syslog outout I see:
> 
> Feb 10 19:39:03 postfix postfix/pickup[13850]: 7D1D0E0E6F: uid=0 
>   from=<redac...@redacted.com>
> Feb 10 19:39:03 postfix postfix/cleanup[13903]: 7D1D0E0E6F: 
>   message-id=<20220210193903.7d1d0e0...@postfix.redacted.net>
> Feb 10 19:39:03 postfix postfix/qmgr[13849]: 7D1D0E0E6F: 
>   from=<redac...@redacted.com>, size=393, nrcpt=1 (queue active)
> Feb 10 19:39:04 postfix postfix/smtp[13905]: 7D1D0E0E6F: 
>   to=<redac...@redacted.com>, relay=ASPMX.L.GOOGLE.com[173.194.219.26]:25, 
>   delay=0.61, delays=0.03/0.03/0.24/0.31, dsn=2.0.0, status=sent (250 
>   2.0.0 OK  1644521944 i1si9676536ybt.537 - gsmtp)
> Feb 10 19:39:04 postfix postfix/qmgr[13849]: 7D1D0E0E6F: removed
> 
> What am I missing?

The message was injected locally via sendmail -> postdrop -> pickup(8),
not via SMTP, so was not subjected to SMTP input specific filter
settings.

--
    Viktor.

Reply via email to