postfix skip spam checks for authorized SMTP

Is there any way to configure postfix to skip spam/antivirus checks for those smtp connections that are SMTP-AUTH'ed? I would like to keep all the standard checks for external smtp traffic, but for my local users sending emails I would like to skip the antispam/antivirus checks.

My configuration has Postfix + Amavisd + SpamAssassin + clamav in pretty much standard configuration.

Thanks in advance. MR


Solution 1:

In the main.cf, set

smtpd_data_restrictions = reject_unauth_pipelining,permit_sasl_authenticated,check_sender_access pcre:/etc/postfix/content_filter.pcre

Do not set content_filter= in main.cf!

/etc/postfix/content_filter.pcre should be something like:

/^/ FILTER smtp-amavis:[127.0.0.1]:10024

Do not forget to run

postmap /etc/postfix/content_filter.pcre

master.cf should be something like:

127.0.0.1:10025 inet n  -   n -   -  smtpd
    -o content_filter=
    -o local_recipient_maps=
    -o relay_recipient_maps=
    -o smtpd_data_restrictions=
    -o smtpd_restriction_classes=
    -o smtpd_client_restrictions=
    -o smtpd_helo_restrictions=
    -o smtpd_sender_restrictions=
    -o smtpd_recipient_restrictions=permit_mynetworks,reject
    -o mynetworks=127.0.0.0/8
    -o smtpd_error_sleep_time=0
    -o smtpd_soft_error_limit=1001
    -o smtpd_hard_error_limit=1000
smtp-amavis unix -      -       n       -       16       lmtp
    -o lmtp_data_done_timeout=1200
    -o lmtp_send_vforward_command=yes
    -o disable_dns_lookups=yes

Hope this helps. See http://www.postfix.org/postconf.5.html for further info.