(6)验证 [root@Qserver ~]# service postfix restart 错误: [root@Qserver ~]# mail user1 -bash: mail: command not found [root@Qserver ~]# yum install mailx 安装mailx [root@Qserver ~]# mail user1 Subject: 177 qqqqqccccc
. 以点结束 EOT [root@Qserver ~]# tail -f /var/log/maillog 查看邮件日志 也可以 [root@Qserver ~]# cd /var/spool/mail/ [root@Qserver mail]# vim user1
3.4 postfix开启基于cyrus-sasl的认证功能 (1)查看已安装sasl有关的软件包 [root@Qserver mail]# rpm -qa |grep sasl cyrus-sasl-lib-2.1.23-13.el6_3.1.i686 cyrus-sasl-2.1.23-13.el6_3.1.i686 cyrus-sasl-devel-2.1.23-13.el6_3.1.i686 cyrus-sasl-md5-2.1.23-13.el6_3.1.i686 cyrus-sasl-plain 没有安装 [root@Qserver Packages]# ll |grep sasl 查看sasl安装软件包 [root@Qserver Packages]# yum install cyrus-sasl-plain-2.1.23-13.el6_3.1.i686.rpm (2)postfix与sasl结合,编辑Postfix文件 [root@Qserver ~]# 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! (3)验证 [root@Qserver ~]# service postfix restart [root@Qserver ~]# telnet 127.0.0.1 25 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. 220 Welcome to our mail.cj.com ESMTP,Warning: Version not Available! (4)sasl配置 [root@Qserver ~]# mkdir /usr/local/lib/sasl2 [root@Qserver ~]# vim /usr/local/sasl2smtpd.conf [root@Qserver ~]# service saslauthd start [root@Qserver ~]# chkconfig --add saslauthd [root@Qserver ~]# chkconfig saslauthd on
3.5安装Courier authentication library (1)解压安装 [root@Qserver ~]# tar -jxvf courier-authlib-0.63.0.tar.bz2 -C /usr/local/src/ [root@Qserver ~]# cd /usr/local/src/courier-authlib-0.63.0/ [root@Qserver courier-authlib-0.63.0]# 编译 ./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 [root@Qserver courier-authlib-0.63.0]# make && make install 安装 (2)配置SMTP vim /usr/local/lib/sasl2/smtpd.conf (3)修改配置 [root@Qserver ~]# chmod 755 /usr/local/courier-authlib/var/spool/authdaemon/ [root@Qserver ~]# cp /etc/authdaemonrc.dist /etc/authdaemonrc [root@Qserver ~]# cp /etc/authmysqlrc.dist /etc/authmysqlrc [root@Qserver ~]# vim /etc/authdaemonrc vim /etc/authdaemonrc authmodulelist="authmysql" 修改 authmodulelistorig="authmysql" daemons=10 [root@Qserver ~]# vim /etc/authmysqlrc MYSQL_SERVER localhost MYSQL_PORT 3306 (指定你的mysql监听的端口,这里使用默认的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@Qserver courier-authlib-0.63.0]# cp courier-authlib.sysvinit /etc/init.d/courier-authlib [root@Qserver courier-authlib-0.63.0]# chmod 755 /etc/init.d/courier-authlib 增加可执行权限 [root@Qserver courier-authlib-0.63.0]# chkconfig --add courier-authlib [root@Qserver courier-authlib-0.63.0]# chkconfig --level 2345 courier-authlib on [root@Qserver courier-authlib-0.63.0]# echo "/usr/local/courier-authlib/lib/courier-authlib" >> /etc/ld.so.conf.d/courier-authlib.conf [root@Qserver courier-authlib-0.63.0]# ldconfig -v 启动courier-authlib服务 [root@Qserver courier-authlib-0.63.0]# mkdir -pv /var/mailbox 新建虚拟用户邮箱所在的目录,并将其权限赋予postfix用户 [root@Qserver courier-authlib-0.63.0]# chown -R postfix /var/mailbox ![]() |
|