我有一些用于从webforms发送电子邮件的postfix服务器,我希望能够从外部域发送电子邮件到我的域,从我的域到我的域,从我的域到外部域。
我不希望能够从外部域发送到外部域。
只有我的networking似乎做了一个完整的开放中继(从任何到任何),我不想要。
内部域= example.com,example.org external domain = yahoo.com
从内部到任何=允许
预期结果:
mail from: [email protected] < 2.1.0 OK rcpt to: [email protected] < 2.1.5 OK rcpt to: [email protected] < 2.1.5 OK rcpt to: [email protected] < 2.1.5 OK
实际结果:
rcpt to: [email protected] < 2.1.5 OK rcpt to: [email protected] < 2.1.5 OK rcpt to: [email protected] < 454 4.7.1 Relay Access Denied
从任何到只有内部
预期结果:
mail from: [email protected] < 2.1.0 OK rcpt to: [email protected] < 2.1.5 OK rcpt to: [email protected] < 2.1.5 OK rcpt to: [email protected] < 454 4.7.1 Relay Access Denied
实际结果:
mail from: [email protected] < 2.1.0 OK rcpt to: [email protected] < 2.1.5 OK rcpt to: [email protected] < 2.1.5 OK rcpt to: [email protected] < 454 4.7.1 Relay Access Denied
正如我所想的那样,我想到了每一个场景!
/etc/postfix/main.cf中
mynetworks = 127.0.0.0/8, 10.0.0.0/8 relay_domains = example.com, example.org smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/sender_access,reject_unknown_sender_domain,reject_unknown_recipient_domain,permit smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender_access,check_recipient_access hash:/etc/postfix/sender_access,reject_unknown_sender_domain,reject_unknown_recipient_domain,reject
/等/后缀/ sender_access
example.com OK example.org OK