Chinaunix首页 | 论坛 | 博客
  • 博客访问: 374031
  • 博文数量: 26
  • 博客积分: 522
  • 博客等级: 中士
  • 技术积分: 329
  • 用 户 组: 普通用户
  • 注册时间: 2009-04-14 13:49
文章分类

全部博文(26)

文章存档

2015年(2)

2012年(7)

2011年(16)

2009年(1)

我的朋友

分类: LINUX

2011-11-30 22:03:50

CentOS 简易邮件服务器搭建

 

CentOS 5.5 64bit postfix+dovecot+sasl2+webmail,发信认证,邮件帐号使用系统用户名

简易邮件服务器并不是专业的搭建一台完整的企业邮箱出来,关于mailscanner,spamfprot都没有装!包括mysql的认证。

 

环境:

系统         CentOS 5.5 64bit

企业域名monoedu.com

邮件服务器 mail. monoedu.com

Mail服务器名: mail. monoedu.com

ip210.14.78.1*

注: DNS必须配置,见其他配置文档

 

1.       Postfix sasl2 dovecot 安装

[root@mail ~]# yum install postfix cycus-sasl* dovecot

 

2.       配置

[root@mail ~]# vi /etc/postfix/main.cf

修改内容如下:

myhostname = mail.monoedu.com

mydomain = monoedu.com

myorigin = $mydomain

inet_interfaces = all

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,

 mail.$mydomain, ,

mynetworks_style = subnet //指定全网IP,这两个参数设置非常重要(下面)

mynetworks = 127.0.0.0/8, localhost, 210.14.78.0/24 //一般smtp不通都是因为这里没有配置对

relay_domains = $mydestination

home_mailbox = Maildir/  //如果采用系统帐号作为邮件用户名,该目录为帐号下的目录

最后面添加(sasl加密算法支持)

smtpd_sasl_auth_enable = yes

smtpd_sasl_security_options = noanonymous

broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,reject_unauth_destination,permit_mynetworks

smtpd_client_restrictions = permit_sasl_authenticated

 

从命令行选择可用的 MTA

[root@mail ~]# alternatives --config mta

There are 2 programs which provide 'mta'.

Selection    Command

-----------------------------------------------

*+ 1           /usr/sbin/sendmail.postfix

Enter to keep the current selection[+], or type selection number: 1

 

[root@mail ~]# vi /etc/sysconfig/saslauthd

SOCKETDIR=/var/run/saslauthd

MECH=shadow //采用系统帐号验证

 

[root@mail ~]# vi /usr/lib/sasl2/smtpd.conf

修改或者添加

pwcheck_method: saslauthd

mech_list: PLAIN LOGIN

log_level:3

 

[root@mail ~]# vi /etc/dovecot.conf

修改或者添加

protocols = imap pop3 pop3s

listen = *

 

[root@mail ~]# /etc/init.d/postfix start|stop|restart

[root@mail ~]# /etc/init.d/dovecot start|stop|restart

[root@mail ~]# /etc/init.d/saslauthd start|stop|restart

 

3.       设置开机自启

[root@mail ~]#chkconfig –level 345 postfix on

[root@mail ~]#chkconfig –level 345 dovecot on

[root@mail ~]#chkconfig –level 345 saslauthd on

 

4.       添加帐号

(1)     先新建系统帐号

[root@mail ~]# useradd –s  /bin/nologin –m test

[root@mail ~]# passwd test  //密码 test

(2)     添加邮箱账号

[root@mail ~]# /usr/sbin/testsaslauthd -u test -p test

上面这步所使用的用户名和密码,系统中必须有该用户和对应的密码,否则会报错

返回:oksuccessd,执行成功。

 

 5. foxmail 测试

      添加账号:pop3 stmp 都需要设置为域名地址(mail.monoedu.com)

 

最后就可以通过outlookfoxmail等客户端测试邮件服务器了。

 

阅读(26757) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

weskiller2014-09-24 17:46:46

博主 我表示认真出问题,unknown user