邮件服务器 Dovecot+Postfix/-Admin 身份验证失败

邮件服务器 Dovecot+Postfix/-Admin 身份验证失败

大家好。我这几天一直在寻找这个错误。

当我想通过 Imap/Smtp 将 Webmail 与电子邮件服务器连接时,我收到此错误:“身份验证失败”。如果您需要更多信息,请询问。你们能找到我的配置问题吗?

亲切的问候。

错误信息:

Nov 19 19:00:43 mail dovecot: imap-login: Aborted login (no auth attempts in 0 secs): user=<>, rip=145.eineip, lip=188nocheineip, session=<mSW4Swh71NCR/idK>
Nov 19 19:01:03 mail dovecot: imap-login: Disconnected (auth failed, 3 attempts in 14 secs): user=<test>, method=PLAIN, rip=145.eineip, lip=188.eineip, session=<omsPTAh71tCR/idK>
Nov 19 19:01:29 mail dovecot: imap-login: Disconnected (auth failed, 3 attempts in 26 secs): user=<[email protected]>, method=PLAIN, rip=145.weitereip, lip=188.nochip, session=<wq7fTAh719CR/idK>

Dovecot 配置:

###Dovecot service
##################
service imap-login {
 inet_listener imap {
 port = 143
}
inet_listener imaps {
 port = 993
 ssl = yes
 }
}

# Change this to where your mail root is, this needs to match whatever structure postfix expects....
# See also: https://wiki.dovecot.org/MailLocation - %d domain, %u full username, %n user part (%u with no domain)
mail_location = maildir:/var/mail/vmail/%u/

namespace inbox {
inbox = yes
location = 
mailbox Drafts {
special_use = \Drafts
}
mailbox Junk {
special_use = \Junk
}
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox Trash {
special_use = \Trash
}
prefix = 
}

protocols = "imap pop3"
# change to 'no' if you don't have ssl cert/keys, and comment out ssl_cert/ssl_key
ssl = no
#ssl_cert = </etc/letsencrypt/live/mail.domain.eu/cert.pem
#ssl_key = </etc/letsencrypt/live/mail.domain.eu/privkey.pem

# login is for outlook express smtpd auth
auth_mechanisms = plain login

# If you're having trouble, try uncommenting these :
#auth_debug = yes
#auth_debug_passwords = yes

userdb { 
driver = sql
args = /etc/dovecot/dovecot-sql.conf 
}

passdb { 
driver = sql
args = /etc/dovecot/dovecot-sql.conf 
}

# Uncomment this if you want Postfix to be able to do smtpd auth through dovecot
# At a minimum Postfix probably needs : smtpd_sasl_type = dovecot 
# And additionally: smtpd_sasl_path = private/auth
service auth {
unix_listener /var/spool/postfix/private/auth {
    mode = 0660
    user = postfix
    group = postfix
}
}

# Needs to match Postfix virtual_uid_maps
first_valid_uid = 1001 

# allow plaintext auth (change to 'yes' to block plaintext passwords)
disable_plaintext_auth = no

Postfix 配置:

# 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 = $domain 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 = no

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2

# TLS parameters
#smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
#smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=no
#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.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mail
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = mail.domain.eu, localhost.domain.eu, localhost
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.0.0/24
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all

#######
virtual_mailbox_domains = proxy:mysql:/etc/postfix/sql/mysql_virtual_domains_maps.cf
virtual_alias_maps =
proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_maps.cf,
proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf,
proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf
virtual_mailbox_maps =
proxy:mysql:/etc/postfix/sql/mysql_virtual_mailbox_maps.cf,
proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf
# if you let postfix store your mails directly (without using maildrop, dovecot deliver etc.)
#virtual_mailbox_base = /var/mail/vmail
# Additional for quota support
virtual_create_maildirsize = yes
virtual_mailbox_extended = yes
#virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix /sql/mysql_virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = Sorry, the user's maildir has overdrawn his diskspace quota, please try again later.
virtual_overquota_bounce = yes

Dovecot SQL

connect = host=localhost dbname=name user=name password=psw
# Use either 
driver = mysql
# Or 
# driver = pgsql

# Default password scheme - change to match your Postfixadmin setting.
# depends on your $CONF['encrypt'] setting:
# md5crypt  -> MD5-CRYPT
# md5       -> PLAIN-MD5
# cleartext -> PLAIN
default_pass_scheme = MD5-CRYPT

# Query to retrieve password. user can be used to retrieve username in other
# formats also.

password_query = SELECT username AS user,password FROM mailbox WHERE username = '%u' AND active='1'

# Query to retrieve user information, note uid matches dovecot.conf AND         Postfix virtual_uid_maps parameter.
user_query = SELECT maildir, 1001 AS uid, 1001 AS gid FROM mailbox WHERE username = '%u' AND active='1'


# MYSQL :
user_query = SELECT CONCAT('/var/mail/vmail/', maildir) AS home, 1001 AS uid, 1001 AS gid, CONCAT('*:bytes=', quota) AS quota_rule FROM mailbox WHERE         username = '%u' AND active='1'
# PostgreSQL : (no Quota though) :
# user_query = SELECT '/var/vmail/mail/' || maildir AS home, 1001 as uid, 1001 as gid FROM mailbox WHERE username = '%u' AND active = '1'

答案1

有几件事 - 您登录网络邮件的能力与 Postfix 或 SMTP 无关(这可能与实际发送电子邮件有关,与其他无关)

您似乎假设 webmail 使用 IMAP 身份验证(这是一个合理但不保证的假设)您应该让 IMAP 工作,并使用普通邮件客户端(如 thunderbird 或 outlook)进行检查。(或者使用 telnet 和 IMAP 命令,但这相当高级)检查 IMAP 是否正常工作。

您当前的 dovecot 配置似乎仅使用 SQL 数据库来验证用户您要么需要更改此行为,要么将管理员添加到 SQL 数据库。(您可以看到此行为,因为配置中检查用户和密码的驱动程序是 SQL)。您没有提供 SQL 配置文件 /etc/dovecot/dovecot-sql.conf,但该文件应该会告诉您需要使用哪个数据库和字段。

或者,更改驱动程序以使用系统数据库 https://wiki.dovecot.org/PasswordDatabase/PAM- 请注意,这可能会降低您的系统安全性。您还需要更改配置以允许纯文本作者进行此操作。

相关内容