Postfix-mysql身份验证失败

Postfix-mysql身份验证失败

我第一次使用 postfix 配置。我试图通过 MySQL 设置 postfix 用户身份验证(我使用带有 postfixadmin、courier 等的标准配置)。问题是我无法进行身份验证(即使在 thunderbird 或 squirremail Web 界面中)甚至无法从 postfixadmin 发送任何邮件。

/var/log/mail.err

Jan 30 12:30:29 envelon postfix/trivial-rewrite[29916]: fatal: proxy:mysql:/etc/postfix/mysql_relay_domains_maps.cf(0,lock|fold_fix): table lookup problem

/var/log/mail.warn

Jan 30 12:31:30 envelon postfix/proxymap[29783]: warning: mysql query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '??1???' at line 1
Jan 30 12:31:30 envelon postfix/trivial-rewrite[29919]: fatal: proxy:mysql:/etc/postfix/mysql_relay_domains_maps.cf(0,lock|fold_fix): table lookup problem
Jan 30 12:31:30 envelon postfix/trivial-rewrite[29920]: fatal: proxy:mysql:/etc/postfix/mysql_relay_domains_maps.cf(0,lock|fold_fix): table lookup problem
Jan 30 12:31:31 envelon postfix/smtpd[29810]: warning: problem talking to service rewrite: Success
Jan 30 12:31:31 envelon postfix/smtpd[29782]: warning: problem talking to service rewrite: Connection reset by peer
Jan 30 12:31:31 envelon postfix/master[19619]: warning: process /usr/lib/postfix/trivial-rewrite pid 29919 exit status 1
Jan 30 12:31:31 envelon postfix/master[19619]: warning: /usr/lib/postfix/trivial-rewrite: bad command startup -- throttling
Jan 30 12:31:31 envelon postfix/smtpd[29790]: warning: problem talking to service rewrite: Connection reset by peer
Jan 30 12:31:31 envelon postfix/master[19619]: warning: process /usr/lib/postfix/trivial-rewrite pid 29920 exit status 1

etc/postfix/mysql_relay_domains_maps.cf

user = postfix
password = XXXXXXXXXXX
hosts = 127.0.0.1
dbname = postfix
table = domain
select_field = domain
where_field = domain
additional_conditions = and backupmx = ′1′

有人发现哪里有问题吗?我完全不知所措。-/

谢谢 Devdas,我已将所有 MySQL 查询更改为基于“query = ...”的查询,看起来它有效。另一方面,我仍然无法登录。如果我尝试登录,它只会记录:

Jan 30 13:55:48 envelon imapd: LOGIN FAILED, [email protected], ip=[::ffff:127.0.0.1]
Jan 30 13:55:53 envelon imapd: LOGOUT, ip=[::ffff:127.0.0.1], rcvd=52, sent=332

Jan 30 14:35:21 server postfix/trivial-rewrite[30680]: warning: table "mysql:/etc/postfix/mysql_virtual_domains_maps.cf": empty lookup result for: "domain.de" -- ignored

也许问题出在密码上,因为如果我查看数据库,相同密码的哈希值会有所不同。但我很确定 postfixadmin 和 courier 密码设置没有问题。或者我没有在 /home/virtual 中看到任何文件夹,而 /home/virtual 是虚拟用户的主文件夹

如果我尝试从 postfixadmin 发送电子邮件,它可以正常工作!:-)

有什么建议么?

答案1

答案就在您的 MySQL 查询日志中。

此外,建议的方法是使用查询而不是tableselect_fieldwhere_fieldadditional_conditions

query = SELECT d.domain FROM domain AS d WHERE d.domain = '%s' AND backupmx = 1

我使用了别名domain以便d您更容易知道哪个是表、哪个是列。

相关内容