主题: 控制部份用户只能在内网使用邮箱
- iRedMail 版本号:0.9.2
- 使用哪个数据库存储用户帐号:MySQL
- 使用的 Linux/BSD 发行版名称及版本号:centos 6.7
- 与您的问题相关的日志信息:
已经按照文档说明将个别用户的allow_nets字段设置了内网地址,但是内网无法登录,重新置为NULL就可以,感觉是查询没有获取到正常的IP地址。
dovecot-mysql.conf 是默认配置,没有改动过。
[root@mail /]# cat /etc/dovecot/dovecot-mysql.conf
driver = mysql
default_pass_scheme = CRYPT
connect = host=127.0.0.1 dbname=vmail user=vmail password=2b5P52KP2is8665OZhpJbCSx3WNwVi
# Required by 'doveadm mailbox ...'.
iterate_query = SELECT username AS user FROM mailbox
password_query = SELECT password, allow_nets FROM mailbox WHERE username='%u' AND enable%Ls%Lc=1 AND active=1
user_query = SELECT \
'%u' AS master_user, \
CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS home, \
CONCAT('*:bytes=', mailbox.quota*1048576) AS quota_rule \
FROM mailbox,domain \
WHERE mailbox.username='%u' \
AND mailbox.domain='%d' \
AND mailbox.`enable%Ls%Lc`=1 \
AND mailbox.domain=domain.domain \
AND domain.backupmx=0 \
AND domain.active=1 \
AND mailbox.active=1
登录失败后查询的dovecot 日志:
Nov 23 14:05:51 imap-login: Info: Disconnected (auth failed, 1 attempts in 2 secs): user=<dongjianfeng@iagnosis.cn>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured, session=<3oNTBC8l1AB/AAAB>