我已经成功安装了具有虚拟域和 TLS 支持的 Postfix/Dovecot,如本文所述 - https://geekpeek.net/postfix-with-dovecot/...
但面临问题。我只能向我的域区域中的人员发送电子邮件(blabla
例如)。这意味着我可以从 发送电子邮件[email protected]
至[email protected]
。但是当我尝试从我的谷歌帐户发送电子邮件到此地址时,我收到以下错误:
postfix/smtpd[19211]: connect from mail-wi0-f172.google.com[209.85.212.172]
Sep 10 18:23:17 amazon-ws.fs.local postfix/smtpd[19211]: NOQUEUE: reject: RCPT from mail-wi0-f172.google.com[209.85.212.172]: 554 5.7.1 <[email protected]>: Recipient address rejected: Access denied; from=<{myaccount}@gmail.com> to=<[email protected]> proto=ESMTP helo=<mail-wi0-f172.google.com>
Sep 10 18:23:17 amazon-ws.fs.local postfix/smtpd[19211]: disconnect from mail-wi0-f172.google.com[209.85.212.172]
收件人地址被拒绝:访问被拒绝;
我所能理解的是我的 postfix 服务器拒绝了这封邮件,但不明白为什么。 Postfix 配置(main.cf
)附如下:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
default_process_limit = 100
html_directory = no
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
message_size_limit = 10485760
mydestination = $myhostname, localhost.$mydomain, localhost
myhostname = amazon-ws.fs.local
mynetworks = 172.31.0.0/20, 127.0.0.0/8
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
queue_minfree = 20971520
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
sample_directory = /usr/share/doc/postfix-2.10.1/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_client_connection_count_limit = 10
smtpd_client_connection_rate_limit = 30
smtpd_recipient_limit = 1000
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/postfix/cert/postfix.pem
smtpd_tls_key_file = /etc/postfix/cert/private/postfix.pem
smtpd_tls_loglevel = 0
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/virtual
virtual_gid_maps = static:2000
virtual_mailbox_base = /var/mail/virtmailbox
virtual_mailbox_domains = /etc/postfix/virtdomains
virtual_mailbox_maps = hash:/etc/postfix/virtmail_maps
virtual_minimum_uid = 2000
virtual_uid_maps = static:2000
操作系统:RHEL7.1、Postfix 版本 2.10.1
哪里有问题?
答案1
master.cf
正如@alexkowalski提到的,文件中有一个短参数(-o)的问题不在`main.cf 文件中。
因为 -o 选项可以覆盖基于每个服务master.cf
写入的选项,所以参数值是从文件中获取的。main.cf
smtpd_recipient_restrictions
master.cf
注意smtpd_recipient_restrictions
参数:
smtps inet n - y - - smtpd
-o syslog_name=postfix/smtps
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
-o smtpd_reject_unlisted_recipient=no
-o smtpd_client_restrictions=$mua_client_restrictions
-o smtpd_helo_restrictions=$mua_helo_restrictions
-o smtpd_sender_restrictions=$mua_sender_restrictions
-o smtpd_recipient_restrictions=
-o smtpd_relay_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
-------> -o smtpd_recipient_restrictions=permit_sasl_authenticated, reject
通过注释该行和我不想要的所有其他 -o 行,文件中写入的值main.cf
就是采用的值。
答案2
终于,我发现了一个问题!master.cf
文件中有一个短参数。
我有:
-o smtpd_recipient_restrictions=permit_sasl_authenticated, reject
必须是:
-o smtpd_recipient_restrictions=permit_sasl_authenticated, reject_unauth_destination
需要将参数reject
更改为,reject_unauth_destination
因为 smtpd 在 sasl 身份验证开始之前拒绝所有传入连接。