Postfix 别名仅适用于本地用户

Postfix 别名仅适用于本地用户

我刚刚设置了一个 Postfix 实例并向 添加了几个名称 /etc/aliases。例如:

root: toor, nobody
foo: root, [email protected]
foo2: foo, [email protected]

我成功运行了,现在每次我从同一域中的任何电子邮件地址(假设)newaliases发送电子邮件到时,它都会被正确送达。每次其他人发送电子邮件到时,它都会被退回。foo2bar.bar[email protected]Recipient address rejected: Access denied

输出postconf -n

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
config_directory = /etc/postfix
inet_interfaces = all
local_recipient_maps = proxy:unix:passwd.byname $alias_maps # Not sure about this
mailbox_size_limit = 0
mydestination = foo.bar.bar, bar.bar, www.bar.bar, localhost, localhost.localdomain
myhostname = foo.bar.bar
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
recipient_delimiter = +
relayhost = relay.bar.bar
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/relay.credentials.txt
smtp_sasl_security_options =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_tls_cert_file = /etc/postfix/foo.crt
smtpd_tls_key_file = /etc/postfix/foo.key
smtpd_tls_protocols = !SSLv2, !SSLv3
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes

成功时:

Mar 31 18:50:20 foo postfix/submission/smtpd[18213]: connect from unknown[1.2.3.4]
Mar 31 18:50:22 foo postfix/submission/smtpd[18213]: 6DBFFFFFF5: client=unknown[1.2.3.4], sasl_method=PLAIN, sasl_username=user
Mar 31 18:50:23 foo postfix/cleanup[18228]: 6DBFFFFFF5: message-id=<[email protected]>
Mar 31 18:50:23 foo postfix/qmgr[15467]: 6DBFFFFFF5: from=<[email protected]>, size=528, nrcpt=1 (queue active)
Mar 31 18:50:23 foo postfix/cleanup[18228]: 1B4C750013: message-id=<[email protected]>
Mar 31 18:50:23 foo postfix/local[18234]: 6DB404FFF5: to=<[email protected]>, relay=local, delay=1, delays=0.96/0.02/0/0.03, dsn=2.0.0, status=sent (forwarded as 1B4C750013)
Mar 31 18:50:23 foo postfix/qmgr[15467]: 1B4C750013: from=<[email protected]>, size=659, nrcpt=3 (queue active)
Mar 31 18:50:23 foo postfix/qmgr[15467]: 6DB404FFF5: removed
Mar 31 18:50:23 foo postfix/smtp[18235]: 1B4C750013: to=<[email protected]>, orig_to=<[email protected]>, relay=relay.bar.bar[2.4.6.8]:587, delay=0.56, delays=0.03/0.02/0.4/0.1, dsn=2.0.0, status=sent (250 Delivery in progress)
[...] More deliveries locally [...]

失败时:

Mar 31 18:57:52 foo postfix/submission/smtpd[20657]: connect from unknown[3.6.9.12]
Mar 31 18:57:52 foo postfix/submission/smtpd[20657]: NOQUEUE: reject: RCPT from unknown[3.6.9.12]: 554 5.7.1 <[email protected]>: Recipient address rejected: Access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<external.server.gmail.com>
Mar 31 18:57:52 foo postfix/submission/smtpd[20657]: disconnect from unknown[3.6.9.12]

的内容master.cf

smtp       inet  n       -       -       -       -       smtpd
submission inet  n       -       -       -       -       smtpd
    -o syslog_name=postfix/submission
    -o smtpd_tls_wrappermode=no
    -o smtpd_tls_security_level=encrypt
    -o smtpd_sasl_auth_enable=yes -o
    smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,reject
    -o milter_macro_daemon_name=ORIGINATING -o smtpd_sasl_type=dovecot -o
    smtpd_sasl_path=private/auth
pickup     fifo  n       -       -       60      1       pickup
cleanup    unix  n       -       -       -       0       cleanup
qmgr       fifo  n       -       n       300     1       qmgr
tlsmgr     unix  -       -       -       1000?   1       tlsmgr
rewrite    unix  -       -       -       -       -       trivial-rewrite
bounce     unix  -       -       -       -       0       bounce
defer      unix  -       -       -       -       0       bounce
trace      unix  -       -       -       -       0       bounce
verify     unix  -       -       -       -       1       verify
flush      unix  n       -       -       1000?   0       flush
proxymap   unix  -       -       n       -       -       proxymap
proxywrite unix  -       -       n       -       1       proxymap
smtp       unix  -       -       -       -       -       smtp
relay      unix  -       -       -       -       -       smtp
showq      unix  n       -       -       -       -       showq
error      unix  -       -       -       -       -       error
retry      unix  -       -       -       -       -       error
discard    unix  -       -       -       -       -       discard
local      unix  -       n       n       -       -       local
virtual    unix  -       n       n       -       -       virtual
lmtp       unix  -       -       -       -       -       lmtp
anvil      unix  -       -       -       -       1       anvil
scache     unix  -       -       -       -       1       scache
maildrop   unix  -       n       n       -       -       pipe
    flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
uucp       unix  -       n       n       -       -       pipe
    flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail
    ($recipient)
ifmail     unix  -       n       n       -       -       pipe
    flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp      unix  -       n       n       -       -       pipe
    flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender
    $recipient
scalemail-backend unix - n       n       -       2       pipe
    flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store
    ${nexthop} ${user} ${extension}
mailman    unix  -       n       n       -       -       pipe
    flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
    ${nexthop} ${user}

我也碰巧知道事实上它relay.bar.bar运行良好并且不会引起问题。有什么帮助吗?

答案1

提交master.cf,您已smtpd_recipient_restrictions使用此行覆盖参数

-o smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,reject

这意味着,您只被允许接收来自您的网络的电子邮件或由 SASL 认证的客户端提交的电子邮件。

在您的第一次日志(成功案例)中,您的客户端已成功通过 SASL 身份验证。

Mar 31 18:50:22 foo postfix/submission/smtpd[18213]: 6DBFFFFFF5: client=unknown[1.2.3.4], sasl_method=PLAIN, sasl_username=user

因此,它将被后缀允许。

在您的第二份日志(失败案例)中,您的客户端未通过身份验证。这就是电子邮件被拒绝的原因。

相关内容