postfix+web页面+身份验证
本篇笔者将介绍使用web方式实现对postfix邮件接收发送的管理,且需要经过身份验证
一:修改主机名:
[[email protected] ~]# vim /etc/sysconfig/network
[[email protected] ~]# vim /etc/hosts
[[email protected] ~]# service sendmail stop
[[email protected] ~]# chkconfig sendmail off #关闭sendmail
[[email protected] ~]# init 6 #重启计算机
二:搭建dns服务器:
[[email protected] ~]# mkdir /mnt/cdrom #新建挂载点
[[email protected] ~]# mount /dev/cdrom /mnt/cdrom/ #挂载光盘
[[email protected] ~]# cd /mnt/cdrom/Server/
[[email protected] Server]# rpm -ivh bind-9.3.6-4.P1.el5.i386.rpm #安装dns主程序
[[email protected] Server]# rpm -ivh bind-chroot-9.3.6-4.P1.el5.i386.rpm #安装与dns安全相关的软件包
[[email protected] Server]# rpm -ivh caching-nameserver-9.3.6-4.P1.el5.i386.rpm #安装与缓存相关的软件包
[[email protected] Server]# cd /var/named/chroot/etc/
[[email protected] etc]# cp -p named.caching-nameserver.conf named.conf
[[email protected] etc]# vim named.conf #编辑dns的主配置文件
[[email protected] etc]# vim named.rfc1912.zones #编辑dns区域声明文件
[[email protected] etc]# cd ../var/named/
[[email protected] named]# cp -p localhost.zone 163.com.db
[[email protected] named]# vim 163.com.db #编辑数据库文件
[[email protected] named]# vim /etc/resolv.conf
[[email protected] named]# service named start #启动dns
[[email protected] named]# chkconfig named on #设置开机自动启动
三:搭建postfix:
[[email protected] named]# cd /mnt/cdrom/Server/
[[email protected] Server]# rpm -ivh postfix-2.3.3-2.1.el5_2.i386.rpm #安装postfix软件包
[[email protected] Server]# vim /etc/postfix/main.cf #编辑postfix主配置文件
除了以上截图外,还需要添加以下内容:
broken_sasl_auth_clients = yes #客户端需要经过身份验证
smtpd_sasl_auth_enable = yes #客户端需要经过身份验证
smtpd_sasl_security_options = noanonymous #不允许匿名发送
smtpd_sasl_application_name = smtpd
smtpd_client_restrictions = permit_sasl_authenticated,reject #发送方需要经过认证,没经过认证的拒绝
#smtpd_client_restrictions = permit_sasl_authenticated
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination #接收本地network的,经过认证的,非认证的拒绝
[[email protected] Server]# service saslauthd start #启动sasl验证功能
[[email protected] Server]# chkconfig saslauthd on #设置为开机自动启动
[[email protected] Server]# service postfix start
[[email protected] Server]# chkconfig postfix on
四:安装squirrelmail:
[[email protected] Server]# vim /etc/yum.repos.d/rhel-debuginfo.repo #编辑yum
[[email protected] Server]# yum install squirrelmail –y #安装squirrel
[[email protected] Server]# service httpd start #启动httpd
[[email protected] Server]# chkconfig httpd on #设置开机自动启动
[[email protected] Server]# cd /var/www/html/
[[email protected] html]# ln -s /usr/share/squirrelmail/ mail #创建符号连接mail
[[email protected] html]# cd
[[email protected] ~]# cd /var/www/html/mail/
[[email protected] mail]# cd config/
[[email protected] config]# ./conf.pl #对web页面进行设置
[[email protected] config]# vim /etc/httpd/conf/httpd.conf #修改apache的配置文件
[[email protected] config]# service httpd restart
五:安装dovecot:
[[email protected] config]# cd /mnt/cdrom/Server/
[[email protected] Server]# yum install dovecot –y #使用yum安装dovecot
[[email protected] Server]# service dovecot start
[[email protected] Server]# chkconfig dovecot on
六:创建用户:
[[email protected] Server]# useradd user1
[[email protected] Server]# passwd user1
[[email protected] Server]# useradd user2
[[email protected] Server]# passwd user2
七:禁用此行:
[[email protected] Server]# vim /etc/postfix/main.cf
[[email protected] Server]# service postfix restart
八:测试: