Although I have found two answers to this, I can't work out how to actually implement them, and at least one of them doesn't actually answer the question. So if anyone has any experience to share I'd be very grateful.
I have a server (Ubuntu 18.04) running Postfix. I'm already rate limiting SASL senders using postfwd, and using and other things to scan outgoing mail from the local machine/network (eg from web servers) using Amavis. That's all OK, and looks like this in main.cf:
smtpd_sender_restrictions =
check_client_access cidr:/etc/postfix/internal_clients_filter,
permit_mynetworks,
reject_unknown_sender_domain
and in master.cf
senderCheck unix - n n - 15 spawn
user=nobody argv=/opt/policyd/src/policyd.pl max_idle=30 max_use=50 daemon_timeout=50
127.0.0.1:10025 inet n - n - - smtpd
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o smtpd_restriction_classes=
-o smtpd_delay_reject=no
-o smtpd_client_restrictions=
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o mynetworks=127.0.0.0/8
-o smtpd_data_restrictions=
-o smtpd_end_of_data_restrictions=
-o local_header_rewrite_clients=
-o smtpd_error_sleep_time=0
-o smtpd_soft_error_limit=1001
-o smtpd_hard_error_limit=1000
-o smtpd_client_connection_count_limit=0
-o smtpd_client_connection_rate_limit=0
-o smtpd_milters=
-o local_recipient_maps=
-o relay_recipient_maps=
-o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_address_mappings
How do I go about putting SASL senders (who are by definition not on my network) through a spam and malware scan in the same way as I am doing for local senders?