`
月影无痕
  • 浏览: 1003045 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

postfix : user unknown. Command output: Invalid user specified问题的解决

 
阅读更多

/var/log/maillog日志中不断出现类似以下日志:

user unknown. Command output: Invalid user specified


放狗搜索,网上给的说法是maildrop没有编译进authlib的支持,用以下方法检查:

maildrop -v

输出以下
maildrop 2.6.0 Copyright 1998-2005 Double Precision, Inc.
GDBM/DB extensions enabled.
Courier Authentication Library extension enabled.
Maildir quota extension are now always enabled.
This program is distributed under the terms of the GNU General Public
License. See COPYING for additional information.


出现Courier Authentication Library extension enabled 说明maildrop的安装没有问题。


百思不得其解,一连数天没有解决之,导致能正常外发邮件,但却无法收邮件。


突然有一天想到,根本错误信息的字段意思,就是收件人帐号不存在,于是想到跟踪mysql的查询日志,从而找出authlib最终向mysql发起的SQL查询是什么?


1. 以root登录mysql,执行命令show variables like  '%gen%'; 查看查询日志的记录状况,输出:

+------------------+-----------------------+
| Variable_name    | Value                 |
+------------------+-----------------------+
| general_log      | OFF                    |
| general_log_file | /data/mysql1/mail.log |
+------------------+-----------------------+


2. 发现查询日志并没有开启,于是开启之(修改此项参数不需要重启mysql)

set global general_log=1;


然后我观察general_log_file文件中的内容,竟然发现类似以下查询记录:

WHERE username = 'username@{mydomain.co}'


域名部分竟然带着大括号,怪不得无法查询到用户,这个大括号是如何产生的,无从所知,于是只有修改authlib的配置文件/usr/local/etc/authlib/authmysqlrc(也可能是/etc/authlib/authmysqlrc):

将以前的WHERE username = '$(local_part)@$(domain)'修改为:

WHERE username = replace(replace('$(local_part)@$(domain)','{',''),'}','')


再重启服务 /etc/init.d/courier-authlib restart

这时,收信功能竟然恢复正常


3. 最后,记得关闭mysql的查询日志记录功能:

set global general_log=0;





分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics