本篇笔者将介绍使用web方式实现对postfix邮件接收发送的管理,且需要经过身份验证

一:修改主机名:

[root@lyt ~]# vim /etc/sysconfig/network

p_w_picpath

[root@lyt ~]# vim /etc/hosts

p_w_picpath

[root@lyt ~]# service sendmail stop

[root@lyt ~]# chkconfig sendmail off       #关闭sendmail

[root@lyt ~]# init 6     #重启计算机

二:搭建dns服务器:

[root@mail ~]# mkdir /mnt/cdrom       #新建挂载点

[root@mail ~]# mount /dev/cdrom /mnt/cdrom/      #挂载光盘

[root@mail ~]# cd /mnt/cdrom/Server/

[root@mail Server]# rpm -ivh bind-9.3.6-4.P1.el5.i386.rpm      #安装dns主程序

[root@mail Server]# rpm -ivh bind-chroot-9.3.6-4.P1.el5.i386.rpm       #安装与dns安全相关的软件包

[root@mail Server]# rpm -ivh caching-nameserver-9.3.6-4.P1.el5.i386.rpm       #安装与缓存相关的软件包

[root@mail Server]# cd /var/named/chroot/etc/

[root@mail etc]# cp -p named.caching-nameserver.conf named.conf    

[root@mail etc]# vim named.conf         #编辑dns的主配置文件

p_w_picpath

p_w_picpath

p_w_picpath

[root@mail etc]# vim named.rfc1912.zones        #编辑dns区域声明文件

p_w_picpath

[root@mail etc]# cd ../var/named/

[root@mail named]# cp -p localhost.zone 163.com.db

[root@mail named]# vim 163.com.db        #编辑数据库文件

p_w_picpath 

[root@mail named]# vim /etc/resolv.conf

p_w_picpath

[root@mail named]# service named start         #启动dns

[root@mail named]# chkconfig named on        #设置开机自动启动

三:搭建postfix:

[root@mail named]# cd /mnt/cdrom/Server/

[root@mail Server]# rpm -ivh postfix-2.3.3-2.1.el5_2.i386.rpm       #安装postfix软件包

[root@mail Server]# vim /etc/postfix/main.cf           #编辑postfix主配置文件

p_w_picpath

p_w_picpath

p_w_picpath

p_w_picpath

p_w_picpath

除了以上截图外,还需要添加以下内容:

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的,经过认证的,非认证的拒绝

p_w_picpath

[root@mail Server]# service saslauthd start        #启动sasl验证功能

[root@mail Server]# chkconfig saslauthd on        #设置为开机自动启动

[root@mail Server]# service postfix start

[root@mail Server]# chkconfig postfix on

四:安装squirrelmail:

[root@mail Server]# vim /etc/yum.repos.d/rhel-debuginfo.repo      #编辑yum

p_w_picpath

[root@mail Server]# yum install squirrelmail –y      #安装squirrel

[root@mail Server]# service httpd start       #启动httpd

[root@mail Server]# chkconfig httpd on       #设置开机自动启动

[root@mail Server]# cd /var/www/html/

[root@mail html]# ln -s /usr/share/squirrelmail/ mail      #创建符号连接mail

[root@mail html]# cd

[root@mail ~]# cd /var/www/html/mail/

[root@mail mail]# cd config/

[root@mail config]# ./conf.pl      #对web页面进行设置

p_w_picpath

p_w_picpath

p_w_picpath

p_w_picpath

p_w_picpath

p_w_picpath

p_w_picpath

p_w_picpath

p_w_picpath

p_w_picpath

[root@mail config]# vim /etc/httpd/conf/httpd.conf       #修改apache的配置文件

p_w_picpath

[root@mail config]# service httpd restart

五:安装dovecot:

[root@mail config]# cd /mnt/cdrom/Server/

[root@mail Server]# yum install dovecot –y       #使用yum安装dovecot

[root@mail Server]# service dovecot start

[root@mail Server]# chkconfig dovecot on

六:创建用户:

[root@mail Server]# useradd user1

[root@mail Server]# passwd user1

[root@mail Server]# useradd user2

[root@mail Server]# passwd user2

七:禁用此行:

[root@mail Server]# vim /etc/postfix/main.cf

p_w_picpath

[root@mail Server]# service postfix restart

八:测试:

p_w_picpath

p_w_picpath

p_w_picpath

p_w_picpath