我有一个邮件服务器(mail.mydomain.com),其中继设置如下:
/etc/postfix/main.cf:
# Smarthost
relayhost = [smtpcorp.com]:2525
smtp_sasl_password_maps = hash:/etc/postfix/smtpcorp_passwd
因此,任何使用mail.mydomain.com
SMTP 服务器的用户基本上都会使用自己的用户名和密码进行身份验证(与 dovecot 使用的用户名和密码相同),然后他们会被转发到smtpcorp.com
他们从未见过的用户名/密码。这很好用。
但是,当mail.mydomain.com
运行 cron 脚本并尝试向 root 发送电子邮件(该邮件别名为我的电子邮件地址)时,它会失败,因为没有进行身份验证。
Jul 27 08:34:06 mail postfix/smtp[5058]: D37641FA98: to=<[email protected]>, relay=smtpcorp.com[207.58.147.66]:2525, delay=0.96, delays=0/0/0.86/0.1, dsn=5.0.0, status=bounced (host smtpcorp.com[207.58.147.66] said: 550 Relay denied for unauthenticated sender (in reply to RCPT TO command))
我如何才能免除以下任一义localhost
务mail.mydomain.com
:
- 必须使用 SMTP 智能中继
- 或者根本不需要使用 SASL 身份验证来使用智能中继
/etc/别名:
mailer-daemon: postmaster
postmaster: root
root: [email protected]
如果我删除根别名,邮件传递仍能正常工作,但我希望保留别名以便它能够转发和传递,这样我的常规邮件客户端就可以通过 dovecot 访问它。
服务器信息:Debian 7.5,postfix 2.9.6
输出postconf -n
:
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
content_filter = amavis:[127.0.0.1]:10024
disable_vrfy_command = yes
enable_original_recipient = no
header_checks = regexp:/etc/postfix/header_checks
inet_interfaces = all
mailbox_size_limit = 0
maximal_backoff_time = 8000s
maximal_queue_lifetime = 7d
minimal_backoff_time = 1000s
mydestination = mail.myvps.com, localhost.localdomain, localhost
myhostname = mail.myvps.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mynetworks_style = host
myorigin = /etc/hostname
readme_directory = no
recipient_delimiter = +
smtp_helo_timeout = 60s
smtp_sasl_password_maps = hash:/etc/postfix/smtpcorp_passwd
smtp_tls_note_starttls_offer = yes
smtp_tls_security_level = may
smtpd_banner = $myhostname ESMTP $mail_name
smtpd_client_restrictions =
smtpd_data_restrictions = reject_unauth_pipelining
smtpd_delay_reject = yes
smtpd_hard_error_limit = 12
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks, reject_non_fqdn_helo_hostname, reject_invalid_hostname, permit
smtpd_recipient_limit = 16
smtpd_recipient_restrictions = reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, check_policy_service inet:127.0.0.1:10023, permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
smtpd_sasl_local_domain =
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unauth_pipelining, permit
smtpd_soft_error_limit = 3
smtpd_tls_CAfile = /etc/ssl/mail.myvps.com/ca-bundle
smtpd_tls_cert_file = /etc/ssl/mail.myvps.com/crt
smtpd_tls_key_file = /etc/ssl/mail.myvps.com/key
smtpd_tls_loglevel = 1
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 = 450
virtual_alias_maps = mysql:/etc/postfix/vimb/virtual_alias_maps.cf
virtual_gid_maps = static:8
virtual_mailbox_base = /var/vmail
virtual_mailbox_domains = mysql:/etc/postfix/vimb/virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/vimb/virtual_mailbox_maps.cf
virtual_transport = dovecot
virtual_uid_maps = static:150
答案1
您可以排除[电子邮件保护]通过在中设置空中继主机来使用中继主机transport_maps
#main.cf
transport_maps = hash:/etc/postfix/transport
#/etc/postfix/transport
[email protected] smtp: