我尝试通过在 MySQL 密码查询中添加“allow_nets”选项来保护 Dovecot。当我这样做时,我可以正常查看邮件。
但是,发送到邮箱的任何邮件都会失败,并出现以下情况:
Apr 1 09:38:59 localhost dovecot: deliver(brian@*****.com): userdb lookup(brian@*****.com) failed: Internal failure
dovecot-mysql.conf 包含:
connect = host=localhost dbname=*** user=*** password=***
default_pass_scheme = CRYPT
password_query = SELECT password, allow_nets FROM mailbox WHERE username = '%u'
user_query = SELECT maildir, 5003 AS uid, 5003 AS gid FROM mailbox WHERE username = '%u'
如果我从 password_query 中删除“allow_nets”,一切又会恢复正常。在 MySQL DB 中,“allow_nets”字段包含:127.0.0.1、Postfix IP、我的 IP 地址。
知道我遗漏了什么吗?
编辑:我升级到了 Dovecot 2.2.16,现在在将“allow_nets”添加到 password_query 时收到此错误消息。
dovecot: lda(brian@*****.com): Error: user brian@*****.com: Auth USER lookup failed
Dovecot 配置:
auth_mechanisms = plain digest-md5 login
first_valid_gid = 5000
first_valid_uid = 5000
info_log_path = /dev/null
listen = 127.0.0.1
mail_location = maildir:/opt/virtual/%d/%n
mmap_disable = yes
passdb {
args = /dovecot/dovecot-mysql.conf
driver = sql
}
protocols = imap pop3
service auth {
unix_listener /var/spool/postfix/private/auth {
mode = 0666
}
unix_listener auth-master {
group = virtual
mode = 0600
user = virtual
}
}
service imap-login {
chroot = login
inet_listener imaps {
address = 12.34.56.78
}
process_min_avail = 1
service_count = 0
user = dovecot
vsz_limit = 64 M
}
service imap {
drop_priv_before_exec = yes
vsz_limit = 768 M
}
service pop3-login {
chroot = login
inet_listener pop3 {
port = 0
}
inet_listener pop3s {
address = 12.34.56.78
}
process_min_avail = 1
service_count = 0
user = dovecot
vsz_limit = 64 M
}
service pop3 {
drop_priv_before_exec = yes
vsz_limit = 768 M
}
ssl_cert = </etc/ssl/cert.crt
ssl_key = </etc/ssl/key.key
userdb {
args = uid=5003 gid=5003 home=/var/virtual/%d/%n
driver = static
}
verbose_proctitle = yes
protocol pop3 {
pop3_uidl_format = %08Xu%08Xv
}
protocol lda {
hostname = example.com
postmaster_address = [email protected]
sendmail_path = /usr/sbin/sendmail
}