如上所述,当我尝试连接 Thunderbird 时,Dovecot 身份验证失败。收发邮件均正常。
我使用例如本教程(以及更多)作为参考:https://serverfault.com/questions/ask。这应该没问题,因为它适用于 Ubuntu 12.04。(不幸的是,我们无法升级,直到一些遗留的东西迁移到 LXC 容器)。
我测试了身份验证:
root@mail ~ # doveadm auth prta
Password:
passdb: prta auth succeeded
extra fields:
user=prta
SMTP:
root@mail ~ # telnet localhost 25
Trying 127.0.0.1...
Connected to mail.prteamwork.com.
Escape character is '^]'.
220 mail.prteamwork.com ESMTP Postfix
ehlo localhost
250-mail.prteamwork.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
提交:
root@mail ~ # telnet localhost 587
Trying 127.0.0.1...
Connected to mail.prteamwork.com.
Escape character is '^]'.
220 mail.prteamwork.com ESMTP Postfix
ehlo localhost
250-mail.prteamwork.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
IMAP:
root@mail ~ # telnet localhost 143
Trying 127.0.0.1...
Connected to mail.prteamwork.com.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE
IDLE STARTTLS AUTH=PLAIN AUTH=LOGIN] Dovecot ready.
似乎有效...
但是,当我尝试连接 Thunderbird(IMAP:153 STARTTLS 和 SMTP:587 STARTTLS)时,身份验证失败,在 mail.log 中:
Jun 22 19:59:03 mail postfix/submission/smtpd[10100]: connect from
78-27-114-110.bb.dnainternet.fi[78.27.114.110]
Jun 22 19:59:03 mail dovecot: imap-login: Aborted login (no auth
attempts): rip=78.27.114.110, lip=188.40.118.13
Jun 22 19:59:03 mail postfix/submission/smtpd[10100]: improper command
pipelining after EHLO from
78-27-114-110.bb.dnainternet.fi[78.27.114.110]: QUIT\r\n
Jun 22 19:59:03 mail postfix/submission/smtpd[10100]: disconnect from
78-27-114-110.bb.dnainternet.fi[78.27.114.110]
Jun 22 19:59:25 mail dovecot: imap-login: Disconnected (auth failed, 3
attempts): user=<prta>, method=PLAIN, rip=78.27.114.110,
lip=188.40.118.13, TLS
Jun 22 19:59:45 mail dovecot: imap-login: Disconnected (auth failed, 3
attempts): user=<[email protected]>, method=PLAIN, rip=78.27.114.110,
lip=188.40.118.13, TLS
Jun 22 19:59:50 mail postfix/submission/smtpd[10100]: connect from
78-27-114-110.bb.dnainternet.fi[78.27.114.110]
Jun 22 19:59:50 mail postfix/submission/smtpd[10317]: connect from
78-27-114-110.bb.dnainternet.fi[78.27.114.110]
Jun 22 19:59:50 mail postfix/submission/smtpd[10321]: connect from
78-27-114-110.bb.dnainternet.fi[78.27.114.110]
Jun 22 19:59:50 mail postfix/submission/smtpd[10322]: connect from
78-27-114-110.bb.dnainternet.fi[78.27.114.110]
Jun 22 19:59:50 mail dovecot: imap-login: Aborted login (no auth
attempts): rip=78.27.114.110, lip=188.40.118.13
Jun 22 19:59:50 mail dovecot: imap-login: Aborted login (no auth
attempts): rip=78.27.114.110, lip=188.40.118.13
这是 dovecot.conf:
disable_plaintext_auth = no
mail_privileged_group = mail
mail_location = mbox:~/mail:INBOX=/var/mail/%u
userdb {
driver = passwd
}
passdb {
args = %s
driver = pam
}
protocols = " imap"
protocol imap {
mail_plugins = " autocreate"
}
plugin {
autocreate = Trash
autocreate2 = Sent
autosubscribe = Trash
autosubscribe2 = Sent
}
service auth {
unix_listener /var/spool/postfix/private/auth {
#group = postfix
mode = 0660
#user = postfix
}
}
auth_mechanisms = plain login
ssl=required
ssl_cert = </etc/ssl/certs/mail.prteamwork.pem
ssl_key = </etc/ssl/private/mail.prteamwork.key
这是 Postix main.cfg:
#Base config
myhostname = mail.prteamwork.com
myorigin = /etc/mailname
mydestination = $myhostname, $mydomain, localhost, localhost.$mydomain
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
relay_domains = $mydestination
syslog_name=postfix/submission
#Aliases / Recipients
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
local_recipient_maps = proxy:unix:passwd.byname $alias_maps
#SSL/TLS
smtpd_tls_cert_file=/etc/ssl/certs/mail.prteamwork.pem
smtpd_tls_key_file=/etc/ssl/private/mail.prteamwork.key
smtpd_use_tls=yes
smtpd_tls_auth_only = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_tls_security_level=may
smtp_tls_security_level=may
smtpd_tls_protocols = !SSLv2, !SSLv3
smtpd_tls_wrappermode=no
smtpd_sasl_type=dovecot
smtpd_sasl_path=private/auth
smtpd_sasl_auth_enable=yes
milter_macro_daemon_name=ORIGINATING
#Security and Anti-Spam cinfig
policy-spf_time_limit = 3600s
smtpd_helo_required = yes
smtpd_recipient_restrictions = reject_non_fqdn_recipient
reject_unknown_recipient_domain permit
_mynetworks permit_sasl_authenticated reject_unauth_destination
check_policy_service unix:private/policy-spf check_policy_service
inet:127.0.0.1:10023
smtpd_helo_restrictions = permit_mynetworks reject_non_fqdn_helo_hostname
reject_invalid_helo_hostname
smtpd_client_restrictions = permit_mynetworks permit_sasl_authenticated
reject_unknown_client_hostname
smtpd_data_restrictions = reject_unauth_pipelining
#DKIM
milter_default_action = accept
milter_protocol = 6
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
并且在 Postix master.cf 中 SMTP 和提交已启用 + SPF 已添加:
...
smtp inet n - - - - smtpd
#smtp inet n - - - 1 postscreen
#smtpd pass - - - - - smtpd
#dnsblog unix - - - - 0 dnsblog
#tlsproxy unix - - - - 0 tlsproxy
submission inet n - - - - smtpd
# -o syslog_name=postfix/submission
# -o smtpd_tls_security_level=encrypt
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
...
policy-spf unix - n n - - spawn
user=nobody argv=/usr/sbin/postfix-policyd-spf-perl
我真的很感激一些 gru 的帮助,我完全被这个困住了 :/
最诚挚的问候,
特梅克斯特
答案1
所有提交的参数仍然被注释掉:
submission inet n - - - - smtpd
# -o syslog_name=postfix/submission
# -o smtpd_tls_security_level=encrypt
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
删除所有#
取消注释,您将获得smtpd_sasl_auth_enable=yes
所有其他设置。
答案2
已解决。Ubuntu 12.04。似乎需要不同的 PAM 身份验证参数。
passdb {
driver = pam
args = failure_show_msg=yes
}
不是
args = %s