Dovecot 无法检测到用户

Dovecot 无法检测到用户

系统规格:Ubuntu 18.04、Postfix 3.3.0、dovecot 2.2.33.2


我跟着本 vimbadmin 指南。但是没有成功。Dovecot 没有检测到邮箱。

我运行了这个代码:

postmap -q [email protected] mysql:/etc/postfix/mysql/virtual_mailbox_maps.cf

我有:

maildir:/srv/vmail/icodeformoney.com/fandi/mail:LAYOUT=fs

但是当我跑步时:

dovecot user [email protected]

我有:

field   value
userdb lookup: user [email protected] doesn't exist

我已经进来virtual_mailbox_maps = mysql:/etc/postfix/mysql/virtual_mailbox_maps.cf /etc/postfix/main.cf

内容/etc/postfix/mysql/virtual_mailbox_maps.cf

user = vimbadmin
password = mypass
hosts = 127.0.0.1
dbname = vimbadmin
table = mailbox
select_field = maildir
where_field = username

请有人帮我调试/解决这个问题。


编辑1

我的 dovecot-sql.conf.ext

driver = mysql

connect = host=localhost user=vimbadmin password=mypass dbname=vimbadmin
default_pass_scheme = SHA512-CRYPT

password_query = SELECT username as user, password as password, \
    homedir AS userdb_home, maildir AS userdb_mail, \
    concat('*:bytes=', quota) as userdb_quota_rule, uid AS userdb_uid, gid AS userdb_gid \
  FROM mailbox \
    WHERE username = '%Lu' AND active = '1' \
    AND ( access_restriction = 'ALL' OR LOCATE( '%Us', access_restriction ) > 0 )

user_query = SELECT homedir AS home, maildir AS mail, \
    concat('*:bytes=', quota) as quota_rule, uid, gid \
  FROM mailbox WHERE username = '%u'

答案1

你使用哪个版本的 postfix 和 dovecot?dovecot sql 配置是什么样的?-> Postfix 配置不负责 dovecot。

有效的 dovecot 配置(注意配置,用于 postfixadmin 而不是 vbadmin 的 sql 查询)应该如下所示:

/etc/dovecot/dovecot-sql.conf

    driver = mysql
connect = host=<dbhost> dbname=<maildb> user=<maildb> password=<password>
default_pass_scheme = MD5-CRYPT
user_query = SELECT '/var/vmail/%d/%n' as home, 'maildir:/var/vmail/%d/%n' as mail, 303 AS uid, 303 AS gid, concat('dirsize:storage=', quota) AS quota FROM mailbox WHERE username = '%u' AND active = '1'
# Get the password
password_query = SELECT username as user, password, '/var/vmail/%d/%n' as userdb_home, 'maildir:/var/vmail/%d/%n' as userdb_mail, 303 as userdb_uid, 303 as userdb_gid FROM mailbox WHERE username = '%u' AND active = '1'

将值 <...> 替换为您的数据。例如,可能是 127.0.0.1

并且必须通过以下方式实施:

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

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

通过包含文件:/etc/dovecot/conf.d/auth-sql.conf 或 /etc/dovecot/dovecot.conf

基于 Opensuse 15.1 系统和 dovecot 2.3.3

答案2

将 dovecot-sql.conf.ext 重命名为 dovecot-sql.conf 以便包含。

那 dovecot.conf 呢?它会被包含在那里吗?

答案3

我调试了这个问题dovecot -n

不知怎的我在配置中找不到:

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

我发现:

passdb {
  driver=pam
}

然后,我不再来回浏览每个文件,而是这样做了(我在我的主目录中):

sudo cp /etc/dovecot/dovecot.conf /etc/dovecot/dovecot.conf.old
doveconf -n > dovecot.conf
sudo cp doveconf.conf /etc/dovecot/dovecot.conf

并修复了passdb和userdb。

答案4

@Fandi Susanto,

使用 conf.d/* 进行包含是一种有效方法。

但据我所知,需要的文件应该从 *.conf.ext 重命名为 *.conf。它们作为示例提供,但必须根据您的要求进行修改。我认为为了避免出现故障或安全问题,默认情况下不会包含这些文件。

相关内容