你好,游客 登录 注册 搜索
背景:
阅读新闻

红帽企业Linux 5.4下搭建基于虚拟用户的电子邮件服务器

[日期:2012-05-27] 来源:Linux社区  作者:zhuchaobo [字体:大 中 小]
三、为postfix开启基于cyrus-sasl的认证功能
 
[root@mail ~]# vim /etc/postfix/main.cf
 
增加以下内容:
 
############################CYRUS-SASL############################
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,reject_invalid_hostname,reject_non_fqdn_hostname,reject_unknown_sender_domain,reject_non_fqdn_sender,reject_non_fqdn_recipient,reject_unknown_recipient_domain,reject_unauth_pipelining,reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
smtpd_banner = Welcome to our $myhostname ESMTP,Warning: Version not Available!
 
 
[root@mail sasl2]# vim /usr/lib/sasl2/smtpd.conf
 
增加如下内容:
pwcheck_method: saslauthd
mech_list: PLAIN LOGIN
 
启动sasl,并将其设为开机自启动
[root@mail sasl2]# service saslauthd start
Starting saslauthd:                                        [  OK ]
[root@mail sasl2]# chkconfig saslauthd on
 
重启postfix
[root@mail sasl2]# service postfix restart
 
 
[root@mail ~]# telnet mail.abc.com 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 Welcome to our mail.abc.com ESMTP,Warning: Version not Available!
EHLO mail.abc.com
250-mail.abc.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN   #已出现验证机制
250-AUTH=PLAIN LOGIN   #已出现验证机制
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
 
四、安装Courier authentication library
 
 
[root@mail ~]# tar -jxvf courier-authlib-0.63.1.20111230.tar.bz2 -C /usr/src/
[root@mail ~]# cd /usr/src/courier-authlib-0.63.1.20111230/
 
[root@mail courier-authlib-0.63.1.20111230]# ./configure --prefix=/usr/local/courier-authlib --sysconfdir=/etc --with-authmysql --with-mysql-libs=/usr/lib/mysql --with-mysql-includes=/usr/include/mysql --with-RedHat --with-authmysqlrc=/etc/authmysqlrc --with-authdaemonrc=/etc/authdaemonrc --with-ltdl-lib=/usr/lib --with-ltdl-include=/usr/include
 
[root@mail courier-authlib-0.63.1.20111230]# make && make install
[root@mail ~]#chmod 755 /usr/local/courier-authlib/var/spool/authdaemon
 
[root@mail ~]# cp /etc/authdaemonrc.dist /etc/authdaemonrc
[root@mail ~]# cp /etc/authmysqlrc.dist /etc/authmysqlrc
 
修改文件/etc/authdaemonrc
[root@mail ~]# vim /etc/authdaemonrc
 
authmodulelist="authmysql"
authmodulelistorig="authmysql"
daemons=10
 
[root@mail ~]# vim /etc/authmysqlrc
 
修改的内容:
 
MYSQL_SERVER localhost
MYSQL_PORT 3306
MYSQL_USERNAME extmail
MYSQL_PASSWORD extmail
MYSQL_SOCKET /var/lib/mysql/mysql.sock
MYSQL_DATABASE extmail
MYSQL_USER_TABLE mailbox
MYSQL_CRYPT_PWFIELD password
MYSQL_UID_FIELD '2525'
MYSQL_GID_FIELD '2525'
MYSQL_LOGIN_FIELD username
MYSQL_HOME_FIELD concat('/var/mailbox/',homedir)
MYSQL_NAME_FIELD name
MYSQL_MAILDIR_FIELD concat('/var/mailbox/',maildir)
 
[root@mail ~]# cd /usr/src/courier-authlib-0.63.1.20111230/
[root@mail courier-authlib-0.63.1.20111230]# cp courier-authlib.sysvinit /etc/init.d/courier-authlib
 
[root@mail ~]#chmod 755 /etc/init.d/courier-authlib
[root@mail ~]# chkconfig --add courier-authlib
[root@mail ~]# chkconfig --level 2345 courier-authlib on
 
[root@mail ~]# echo "/usr/local/courier-authlib/lib/courier-authlib" >> /etc/ld.so.conf.d/courier-authlib.conf
[root@mail ~]# ldconfig –v
[root@mail ~]# service courier-authlib start
 
新建虚拟用户邮箱所在的目录,并将其权限赋予postfix用户:
[root@mail ~]# mkdir -pv /var/mailbox
mkdir: created directory `/var/mailbox'
[root@mail ~]# chown -R postfix /var/mailbox
 
接下来重新配置SMTP 认证,编辑 /usr /lib/sasl2/smtpd.conf ,确保其为以下内容:
 
pwcheck_method: authdaemond
log_level: 3
mech_list:PLAIN LOGIN
authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socketlinux
相关资讯       红帽企业Linux 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款