Updated: 2024/05/26

Install required package:
dnf install pypolicyd-spf

Create policyd-spf user:
adduser policyd-spf --user-group --no-create-home -s /bin/false

Add to /etc/postfix/main.cf:
policyd-spf_time_limit = 3600
smtpd_recipient_restrictions =
 permit_mynetworks,
 reject_unauth_destination,
 check_policy_service unix:private/policyd-spf

Add to /etc/postfix/ master.cf:
policyd-spf  unix  -       n       n       -       0       spawn
    user=policyd-spf argv=/usr/libexec/postfix/policyd-spf

Modify /etc/python-policyd-spf/policyd-spf.conf
# Domains to reject on neutral or softfail
Reject_Not_Pass_Domains = gmail.com,hotmail.com
# Add your internal IP space
skip_addresses = 127.0.0.0/8,::ffff:127.0.0.0/104,::1,192.168.0.0/24

Restart postfix:
systemctl restart postfix


Home > Build Procedures > Postfix SMTP gateway for Exchange on Rocky 9