我只是设置了一个Postfix实例,并在/etc/aliases添加了一些名字。 例如,拿这个:
root: toor, nobody foo: root, [email protected] foo2: foo, [email protected]
我成功地运行了newaliases ,现在每当我从同一个域中的任何电子邮件地址发送一封电子邮件到foo2 (比如说bar.bar ),它就会被正确地发送。 每次有人发邮件给[email protected]它都会以Recipient address rejected: Access deniedpopupRecipient 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 - nn - - local virtual unix - nn - - virtual lmtp unix - - - - - lmtp anvil unix - - - - 1 anvil scache unix - - - - 1 scache maildrop unix - nn - - pipe flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient} uucp unix - nn - - pipe flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient) ifmail unix - nn - - pipe flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient) bsmtp unix - nn - - pipe flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient scalemail-backend unix - nn - 2 pipe flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension} mailman unix - nn - - pipe flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user}
我也碰巧知道, relay.bar.bar完美的作品并没有造成问题。 任何帮助?
在master.cf 提交行中,用此行覆盖参数smtpd_recipient_restrictions
-o smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,reject
这意味着,您只能通过您的networking或SASLauthentication客户端提交的电子邮件获得电子邮件。
在您的第一个日志(成功案例)上,您的客户成功通过了SASLauthentication。
Mar 31 18:50:22 foo postfix/submission/smtpd[18213]: 6DBFFFFFF5: client=unknown[1.2.3.4], sasl_method=PLAIN, sasl_username=user
所以,它会允许通过后缀。
在您的第二个日志(失败的案例)上,您的客户端未通过身份validation。 这就是为什么电子邮件被拒绝。