免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 7619 | 回复: 1
打印 上一主题 下一主题

[Mail] 求助: Postfix 配置SASL2.1.19的SMTP认证无法实现(已解决) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-08-23 18:16 |只看该作者 |倒序浏览
Postfix-2.3+OpenLDAP-2.2+Courier-IMAP+Courier-Authlib+Maildrop都已经安装配置测试通过了.可以收发Email,POP3/IMAP也都正常.

但是在配置SASL进行SMTP认证的时候出问题了,按照一些文档资料做了相关的配置后,无法实现SMTP认证.

具体现象为:
1. telnet localhost 25,只出现
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'

然后就没了

2. 查看/var/log/maillog,有下面的错误信息
Aug 23 16:35:45 postfix postfix/smtpd[1507]: warning: SASL per-connection security setup; invalid parameter supplied
Aug 23 16:35:45 postfix postfix/smtpd[1507]: fatal: SASL per-connection initialization failed
Aug 23 16:35:46 postfix postfix/master[19459]: warning: process /usr/libexec/postfix/smtpd pid 1505 exit status 1
Aug 23 16:35:46 postfix postfix/master[19459]: warning: /usr/libexec/postfix/smtpd: bad command startup -- throttling

我的SASL-2.19是RHAS4安装盘上的RPM包.配置文件内容如下
# more /etc/saslauthd.conf
ldap_server:ldap://127.0.0.1
ldap_search_baseu=cn,o=postsample
ldap_filter&(uid=%u))

# more /usr/lib/sasl2/smtpd.conf
pwcheck_method:saslauthd
mech_list:login plain

more /etc/sysconfig/saslauthd
SOCKETDIR=/var/run/saslauthd
MECH=ldap
FLAGS=

Postfix的main.cf中相关的配置内容如下:
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
permit_auth_destinatioin,
reject_unauth_destination,
reject
smtpd_client_restrictions = permit_sasl_authenticated
smtpd_sasl_security_options = noanonymous
smtp_sasl_security_options =

只要把上面的main.cf中的内容取消,就可以收发邮件.
postconf -a的结果是
# postconf -a
cyrus
dovecot
说明应该支持Cyrus-sasl的,而且saslauthd也支持ldap的认证机制的
saslauthd 2.1.19
authentication mechanisms: getpwent kerberos5 pam rimap shadow ldap

请问问题出在哪里?

我加一点.

现在我用testsaslauthd -u test -p passwd可以通过测试.因此有关SASL的配置文件应该是正确的.



看来问题是Postfix在调用SASL的时候出了问题.但是究竟是什么问题,看Log也不是很清楚.

[ 本帖最后由 我家老婆最美丽 于 2006-8-24 11:14 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2006-08-24 11:24 |只看该作者

过程

搜索了所有能找到网页,邮件列表都没有找到类似的问题或是任何线索。最后经过仔细试验,仔细阅读前辈们的文档,终于解决了问题了。

结果是Cyrus-SASL的库的问题。我的系统RHAS4自带Cyrus-SASL-2.1.19的RPM版本,因此我就没有重装,但是其实我指定的Authentication 方式Login Plain是不支持的。但是Log里面又看不出来,而起这个只是SMTPD和SASL之间传递用户ID、密码的方式。如果我直接使用testsaslauthd是测不出来的。

因此我前面的结论是SASL没有问题,是postfix的main.cf的问题。但是事实上还是由于SASL没有支持Login Plain的认证方式而导致的问题。

解决方法是原来的SASL的库目录改名,然后重新编译安装2进制源代码,配置时指定使用plain和login方式。
./configure --disable-aono --enable-plain --enable-login --enable-ldapdb --with-ldap=/usr/lib --with-saslauthd=/var/run/saslauthd --sysconfdir=/etc

安装完成后,将安装后的/usr/local/lib/sasl2链接为/usr/lib/sasl2
ln -s /usr/local/lib/sasl2 /usr/lib/sasl2

确认/etc/sysconfig/saslauthd, /etc/saslauthd.conf,/usr/lib/sasl2/smtpd这几个配置文件正确配置,再配置main.cf

smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_sasl_local_domain =

smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, reject
smtpd_client_restrictions = permit_sasl_authenticated, reject

终于可以使用了!!!

挺开心的.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP