当通过 gmail 从外部弹出邮箱检索邮件时,我有一个明显经常发生但未解决的 gmail 问题。查看错误详细信息,它说:
服务器响应:“身份验证失败”。
这个邮件服务器是我自己的服务器,当我从终端连接时:
~$ telnet mail.mydomain.com:995
我得到以下信息:
Trying xx.xx.xxx.xx...
Connected to mail.mydomain.com.
Escape character is '^]'.
然后在尝试登录时:
user myuser
Connection closed by foreign host.
在我的邮件日志中:
Mar 26 18:22:42 www dovecot: auth: Debug: Loading modules from directory: /usr/lib/dovecot/modules/auth
Mar 26 18:22:42 www dovecot: auth: Debug: Module loaded: /usr/lib/dovecot/modules/auth/libdriver_mysql.so
Mar 26 18:22:42 www dovecot: auth: Debug: auth client connected (pid=6554)
Mar 26 18:23:20 www dovecot: pop3-login: Disconnected (no auth attempts): rip=xx.xx.xxx.xx, lip=xx.xx.xxx.xx, TLS handshaking: SSL_accept() failed: error:140760FC:SSL
routines:SSL23_GET_CLIENT_HELLO:unknown protocol
测试 ssl 时:
~$ openssl s_client -connect mail.mydomain.com:995
我可以连接,但是使用这条线(我购买了一个 godaddy 证书):
Verify return code: 19 (self signed certificate in certificate chain)
我做错了什么?这是我的配置文件:
# 2.0.13: /etc/dovecot/dovecot.conf
# OS: Linux 3.0.0-13-server x86_64 Ubuntu 11.10 ext4
log_timestamp = "%Y-%m-%d %H:%M:%S "
mail_location = maildir:/home/vmail/%d/%n/Maildir
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date
namespace {
inbox = yes
location =
prefix = INBOX.
separator = .
type = private
}
passdb {
args = /etc/dovecot/dovecot-sql.conf
driver = sql
}
protocols = imap pop3
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0660
user = postfix
}
unix_listener auth-userdb {
group = vmail
mode = 0600
user = vmail
}
unix_listener auth-master {
mode = 0600
user = vmail
}
user = root
}
ssl = required
ssl_cert = </etc/ssl/certs/mail.mydomain.com_combined.crt
ssl_key = </etc/ssl/private/mail.mydomain.key
userdb {
args = uid=5000 gid=5000 home=/home/vmail/%d/%n allow_all_users=yes
driver = static
}
protocol lda {
auth_socket_path = /var/run/dovecot/auth-master
log_path = /home/vmail/dovecot-deliver.log
mail_plugins = sieve
postmaster_address = [email protected]
}
protocol pop3 {
pop3_uidl_format = %08Xu%08Xv
}
disable_plaintext_auth = no
auth_verbose = yes
auth_debug = yes
后缀:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = /usr/share/doc/postfix
# TLS parameters
smtpd_tls_cert_file = /etc/ssl/certs/mail.mydomain.com_combined.crt
smtpd_tls_key_file = /etc/ssl/private/mail.mydomain.com.key
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = mail.mydomain.com
mydomain = mydomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination =
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
html_directory = /usr/share/doc/postfix/html
message_size_limit = 30720000
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /home/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
# see under Spam smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
# Spam
disable_vrfy_command = yes
smtpd_delay_reject = yes
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks,
check_helo_access hash:/etc/postfix/helo_access,
reject_non_fqdn_hostname,
reject_invalid_hostname,
permit
smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination,
reject_invalid_hostname,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unknown_sender_domain,
reject_unknown_recipient_domain,
reject_non_fqdn_hostname,
reject_rbl_client sbl.spamhaus.org,
reject_rbl_client zen.spamhaus.org,
reject_rbl_client cbl.abuseat.org,
reject_rbl_client bl.spamcop.net,
permit
smtpd_error_sleep_time = 1s
smtpd_soft_error_limit = 10
smtpd_hard_error_limit = 20
没有什么是错的。您向我们展示的所有内容都与运行在端口 995 上的 POP/S(SSL 安全)服务器一致。您的
openssl s_client
会话可能在抱怨,因为它的证书包中没有正确的 CA。为什么谷歌无法从您的服务器获取电子邮件是一个合理的问题,但您发布的任何内容都无法说明该失败。如果你能抓住谷歌从你的服务器检索邮件的行为,并发布那些dovecot 日志,那么我们可能会开始阐明这个问题。
编辑:
Connection closed by foreign host
发生的原因是,除非您个人可以说流利的 SSL 并非常快速地输入奇怪的字符,否则您不能使用 telnet 连接到 SSL 安全服务(注意:这对于 TLS 安全服务而言并非如此,但这是'语气)。您输入的“user myuser”不是有效的 SSL 握手,导致了SSL23_GET_CLIENT_HELLO:unknown protocol
错误。很抱歉它“看起来不错”,但它完全正确。如果您尝试从
openssl s_client
会话登录,您可能会更幸运;自签名证书警告对会话来说是信息性的,而不是致命的。我想也许这个线程是旧的,但我会尝试并做出贡献,其他人可能会发现它有用谷歌在连接到邮件服务器时非常特别,除非邮件服务器使用由公认的权威机构颁发的真正的 ssl 证书,例如如“Starssl”等,Google 甚至不会与您的服务器对话。
几个月前我遇到了类似的问题,当我最终使用非自签名证书时,我开始收到来自“雅虎、谷歌等”的电子邮件。从公认的权威机构颁发证书,但它仍然无法正常工作检查您是否已正确处理所有内容。注意任何可能搞砸的最小细节。但首当其冲的罪魁祸首是 CA。祝你好运,我希望这些信息可以帮助其他人。