Postfix中的“发件人地址被拒绝:不归用户所有”

Vor*_*ico 8 postfix

当我尝试通过经过身份验证的 SMTP 服务器从家用计算机上的客户端向receiver@gmail.com.

Oct 17 09:21:40 debian postfix/smtpd[1643]: NOQUEUE: reject: RCPT from
unknown[x.x.x.x]: 553 5.7.1 <sender@example.com>: Sender address rejected:
not owned by user sender@example.com; from=<sender@example.com>
to=<receiver@gmail.com> proto=ESMTP helo=<[192.168.1.5]>
Run Code Online (Sandbox Code Playgroud)

我最终正在寻找修复该错误的方法,但我目前想知道哪些配置参数main.cf能够修复它。例如,我应该摆弄smtpd_sender_restrictions, smtpd_relay_restrictions, 还是smtpd_recipient_restrictions? 我无法通过使任何先前的参数尽可能宽松来消除错误。

编辑:这是我当前配置的相关部分,尽管我主要是在寻找可能导致地址被拒绝的几个可能的 Postfix 参数。

relay_domains = *

smtpd_sender_restrictions =
    permit_mynetworks,
    permit_sasl_authenticated

smtpd_relay_restrictions =
    permit_mynetworks,
    permit_sasl_authenticated,
    reject_unauth_destination

smtpd_recipient_restrictions =
    permit_mynetworks,
    permit_sasl_authenticated,
    reject_unauth_destination,
    reject_rbl_client zen.spamhaus.org,
    reject_rhsbl_reverse_client dbl.spamhaus.org,
    reject_rhsbl_helo dbl.spamhaus.org,
    reject_rhsbl_sender dbl.spamhaus.org,

smtpd_data_restrictions = reject_unauth_pipelining
Run Code Online (Sandbox Code Playgroud)

并在master.cf

submission inet n       -       -       -       -       smtpd
    -o smtpd_tls_security_level=encrypt
    -o smtpd_sasl_security_options=noanonymous
    -o smtpd_client_restrictions=permit_sasl_authenticated
    -o smtpd_sender_restrictions=reject_sender_login_mismatch
Run Code Online (Sandbox Code Playgroud)

Ond*_*mek 12

根据手册smtpd_sender_login_maps需要设置。将其设置为与virtual_mailbox_maps对我有用的值相同。例如:

virtual_mailbox_maps    = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
smtpd_sender_login_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
Run Code Online (Sandbox Code Playgroud)

此外,如果您的地图存在于数据库中,请记住您需要实际选择一个字段,而不是像某些 howto 建议的那样仅选择“1”。

# good
query = SELECT email FROM postfix_mailbox_maps where email = '%s';

# bad
query = SELECT 1 FROM postfix_mailbox_maps where email = '%s';
Run Code Online (Sandbox Code Playgroud)


小智 1

试试这个,这就是我的服务器的配置方式(如果您的域不是“虚拟”,请找到相应的选项)\xc2\xa0:

\n\n

保留您最初问题中的现有选项,我认为它们不是问题。

\n\n

在 main.cf\xc2\xa0 中添加以下内容:

\n\n
virtual_alias_maps = hash:/etc/postfix/virtual\nvirtual_mailbox_domains = hash:/etc/postfix/virtual-mailbox-domains\nvirtual_mailbox_maps = hash:/etc/postfix/virtual-mailbox-users\n
Run Code Online (Sandbox Code Playgroud)\n\n

/etc/postfix/virtual(可能与您无关)\xc2\xa0:

\n\n
sender@exemple.com    sender@exemple.com\nother@exemple.com     other@exemple.com\nalias@exemple.com     sender@exemple.com\n
Run Code Online (Sandbox Code Playgroud)\n\n

/etc/postfix/虚拟邮箱域

\n\n
exemple.com    OK\n
Run Code Online (Sandbox Code Playgroud)\n\n

/etc/postfix/virtual-mailbox-users(这是重要部分)

\n\n
sender@exemple.com    sender@exemple.com\nother@exemple.com     other@exemple.com\n
Run Code Online (Sandbox Code Playgroud)\n