十、配置cyrus-sasl--EXTMAIL

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
云数据库 RDS MySQL Serverless,价值2615元额度,1个月
简介:

RHEL4/CentOS4的cyrus-sasl默认没有打开authdaemon的支持,为了使用集中认证的authlib,必须打开这个支持。为此我们必须删除系统的cyrus-sasl软件包,替换成打开了authdaemon支持的sasl软件包。

1、安装cyrus-sasl

删除系统的cyrus-sasl:

 

shell

# rpm -e cyrus-sasl --nodeps

安装新的支持authdaemon的软件包

 

shell

# yum install cyrus-sasl2、配置main.cf文件

Postfix的SMTP认证需要透过Cyrus-SASL,连接到authdaemon获取认证信息。

编辑main.cf

 

shell

# vi /etc/postfix/main.cf

增加如下内容:

# smtpd related configsmtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_hostname, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unauth_destination, reject_unauth_pipelining, reject_invalid_hostname,# SMTP sender login matching configsmtpd_sender_restrictions = permit_mynetworks, reject_sender_login_mismatch, reject_authenticated_sender_login_mismatch, reject_unauthenticated_sender_login_mismatchsmtpd_sender_login_maps = mysql:/etc/postfix/mysql_virtual_sender_maps.cf, mysql:/etc/postfix/mysql_virtual_alias_maps.cf # SMTP AUTH config herebroken_sasl_auth_clients = yessmtpd_sasl_auth_enable = yessmtpd_sasl_local_domain = $myhostnamesmtpd_sasl_security_options = noanonymous3、编辑smtpd.conf文件

shell

# vi /usr/lib/sasl2/smtpd.conf

确保其内容为:

pwcheck_method: authdaemondlog_level: 3mech_list: PLAIN LOGINauthdaemond_path:/var/spool/authdaemon/socket

重新启动postfix:

 

shell

# service postfix start 4、测试SMTP认证

通过以下命令获得postmaster@extmail.org的用户名及密码的BASE64编码:

 

shell

# perl -e ‘use MIME::Base64; print encode_base64(”postmaster\@extmail.org”)’

内容如下:

cG9zdG1hc3RlckBleHRtYWlsLm9yZw==

shell

# perl -e ‘use MIME::Base64; print encode_base64(”extmail”)’

内容如下:

ZXh0bWFpbA==

然后本机测试:

 

shell

# telnet localhost 25

其过程如下:

Trying 127.0.0.1...Connected to localhost.localdomain (127.0.0.1).Escape character is '^]'.220 mail.extmail.org ESMTP Postfix - by extmail.orgehlo demo.domain.tld << 输入内容250-mail.extmail.org250-PIPELINING250-SIZE 10240000250-VRFY250-ETRN250-AUTH LOGIN PLAIN250-AUTH=LOGIN PLAIN250-ENHANCEDSTATUSCODES250-8BITMIME250 DSNauth login << 输入内容334 VXNlcm5hbWU6cG9zdG1hc3RlckBleHRtYWlsLm9yZw== << 输入内容334 UGFzc3dvcmQ6ZXh0bWFpbA== << 输入内容235 2.0.0 Authentication successfulquit << 输入内容221 2.0.0 Bye

最后出现235 Authentication Successful 表明认证成功了。




      本文转自glying 51CTO博客,原文链接:http://blog.51cto.com/liying/968551,如需转载请自行联系原作者




相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
网络安全 数据安全/隐私保护
|
缓存 数据安全/隐私保护 存储
|
Shell 机器学习/深度学习 存储
|
Web App开发 关系型数据库 MySQL