Postfix: combine check_client_access and check_sender_access for Relayaccess

postfixsmtp-authwhitelist

We have a mailserver running on Postfix.
Only authenticated users are allowed to send emails.

One client has a multifunction printer, which is configured to send scanned documents to an email recipient.
Unfortunately that printer is an older model and doesn't support smtp-auth.

I know I can use check_client_access to allow the static IP of this client for unauthenticated mail.
The following configuration would do that:

smtpd_sender_restrictions =
  check_client_access hash:/etc/postfix/allow_relay,
  permit_sasl_authenticated,
  permit_mynetworks,
  reject_non_fqdn_sender,
  reject_unknown_sender_domain,
  reject_unauth_pipelining

What I would like to do is to only accept unauthenticated email if the IP and the sender match with a list.

Just adding a check_sender_access to the sender restrictions would result in allowing Mail from the specified IP or the specified sender.

So how could I configure Postfix to combine those two, if possible at all?

Best Answer

By configuring a restriction class that checks the client IFF the sender matches $foo, or vice versa.