sasl认证
1.查看系统版本
[root@server79 ~]# cat /etc/issue
Red Hat Enterprise Linux Server release 6.3 (Santiago)
Kernel \r on an \m
2.下载与系统版本相匹配的cyrus-sasl认证包
[root@server79 ~]# yum localinstall cyrus-sasl-sql-2.1.23-13.el6.x86_64.rpm
3 查看所装cyrus-sasl版本
[root@server79 ~]# rpm -q cyrus-sasl
cyrus-sasl-2.1.23-13.el6.x86_64
4.编辑认证协议
[root@server79 sasl2]# vim /etc/sasl2/smtpd.conf
pwcheck_method: auxprop
auxprop_plugin: sql
mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM
sql_engine: mysql
sql_hostnames: 127.0.0.1
sql_user: extmail
sql_passwd: extmail
sql_database: extmail
sql_select: SELECT password FROM mailbox WHERE username = '%u@%r'
5.查看认证协议的参数
[root@server79 sasl2]# postconf -d | grep ^smtpd_sasl
6.打开认证
[root@server79 sasl2]# postconf -e smtpd_sasl_auth_enable=yes
[root@server79 sasl2]# postconf -e smtpd_sasl_authenticated_header=yes
[root@server79 sasl2]# postconf -d | grep ^smtpd_relay
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination
7.生成用户加密串
[root@server79 sasl2]# perl -MMIME::Base64 -e 'print encode_base64("\0cun\@extmail.org\0westos");'
8.验证
[root@server79 sasl2]# telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 server79.example.com ESMTP Postfix
ehlo localhost
250-server79.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH LOGIN CRAM-MD5 DIGEST-MD5 PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
auth plain AGN1bkBleHRtYWlsLm9yZwB3ZXN0b3M=
235 2.7.0 Authentication successful
quit
221 2.0.0 Bye
验证成功
9.用雷鸟进行收发邮件即可感受到其效果
雷鸟设置:
setting->Outgoing Server-Edit->servername 192.168.0.179,port 25,connection security:NONE,Authentication method:Password,transmitted,User Name:cun@extmail.org
转载于:https://blog.51cto.com/cuanlf/1391027