Question

Is it possible to use a second content filter with Amavis?

I have a standard postfix+Amavis Ubuntu setup, but after spam filtering, I am wanting to run it through a second one to encrypt the message body - this bit works fine, however, I cant see a way of setting up Postfix to use multiple content filters, or a way for Amavis to then push it through a second filter.

The second filter uses a pipe:

emailcrypt unix - n n - - pipe flags= user=cryptuser argv=/usr/local/bin/emailcrypt.py

which then bounces back in here:

127.0.0.1:10099 inet n - n - 10 smtpd -o content_filter= -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks -o smtpd_helo_restrictions= -o smtpd_client_restrictions= -o smtpd_sender_restrictions= -o smtpd_recipient_restrictions=permit_mynetworks,reject -o mynetworks=127.0.0.0/8 -o smtpd_authorized_xforward_hosts=127.0.0.0/8

So, I guess I am being dumb or something.. :)

If someone could help me out I would appreciate it! :)

Was it helpful?

Solution

You can specify the first content_filter (i.e amavis ) in your main.cf file

#/etc/postfix/main.cf
#...
content_filter = smtp:[localhost]:10097
#...

or master.cf file.

#/etc/postfix/master.cf
smtp      inet  n       -       n       -       -       smtpd
    -o content_filter=smtp:[localhost]:10097

You will anyway define another smtpd server to receive the email from amavis. Specify your second content_filter there like

#/etc/postfix/master.cf
127.0.0.1:10098     inet    n   -   n   -    10      smtpd 
      -o content_filter=emailcrypt:dummy
# other options if any

Now the second filter can inject the mail back to the smtpd server listening on 10099. Hope that helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top