Restrict relay with postfix to certain domain from single IP

Solution 1:

You can use postfwd to restrict the domains a specific IP address can send email to (regardless of relay):

action=REJECT; client_address=192.168.1.9; recipient_domain!~/dom1\.com|dom2\.com/

Easy installation on Ubutu server is as follows:

$ apt install postfwd
$ vi /etc/postfix/main.cf
  smtpd_recipient_restrictions = check_policy_service inet:127.0.0.1:10040
$ vi /etc/postfix/postfwd.cf
  action=REJECT; client_address=192.168.1.9; recipient_domain!~/dom1\.com|dom2\.com/
$ systemctl restart postfwd postfix