Centos安装配置Postfix邮件服务器
发布时间:July 6, 2012 // 分类:Mail // No Comments
在安装邮件服务器之前先了解几个名词,以后会用到:
|
1
2
3
4
5
6
|
MUA:用户代理端,即用户使用的写信、收信客户端软件MTA:邮件传送端,即常说的邮件服务器,用于转发、收取用户邮件。MDA:邮件代理端,相当于MUA和MTA的中间人,可用于过滤垃圾邮件。POP:邮局协议,用于MUA连接服务器收取用户邮件,通信端口110。IMOP:互联网应用协议,功能较POP多,通信端口143。SMTP:简单邮件传送协议,MUA连接MTA或MTA连接MTA发送邮件使用此协议,通信端口25。 |
本次配置MTA以Postfix为例,较sendmail简单、安全,且兼容于sendmail。
Postfi安装:
|
1
2
3
|
yum install postfixyum remove sendmail/etc/init.d/postfix start |
Postfix主配置设定:
|
1
2
3
4
5
6
7
8
9
10
11
|
cat /etc/postfix/main.cfmyhostname = mail.haiyun.me #Mail服务器域名,EHLO名称。mydomain = www.haiyun.me #myorigin = $mydomain #发信地址,此设置显示为@www.haiyun.me。 inet_interfaces = all #如对外提供MTA服务设置为监听所有网卡,默认只监听本地。inet_protocols = all #支持协议,可选IPV4/IPV6。mydestination = $mydomain $myhostname #本地邮件域名,直接接收mynetworks_style = subnet #允许转发的来源网段,可选subnet子网,class网段,host本机mynetworks = 192.168.1.0/24,127.0.0.0/8 #允许转发的来源IP,设置后忽略mynetworks_style参数relay_domains = $mydestination #允许转发的目标域smtpd_banner = $myhostname ESMTP "Mail Server" #自定服务器信息 |
现Postfix允许接收或发送邮件的条件:
|
1
2
3
4
5
6
|
接收邮件:目的地为$inet_interfaces的邮件;目的地为$mydestination或$vitual_alias_maps的邮件。转发邮件:来源客户端符合$mynetworks的邮件;来源或目的为$relay_domains的邮件。 |

配置邮件别名:
|
1
2
3
|
cat /etc/aliasestest:root,test@www.haiyun.me别名:收件地址1,收件地址2 |
更新别名数据库:
|
1
|
newaliases |
配置邮件转发:
|
1
2
|
cat ~/.forwardtest@www.haiyun.me,test2@www.haiyun.me |
设置SMTP密码验证,为防止MTA被滥用在postfix有配置信任网段,如在外网可使用smtp密码验证方式。
以系统用户密码方式认证,先启动saslauthd服务协助postfix进行系统密码验证:
|
1
2
3
|
/etc/init.d/saslauthd startchkconfig saslauthd onyum install cyrus-sasl-plain cyrus-sasl-md5 cyrus-sasl |
确定SMTPD配置文件有以下内容:
|
1
2
|
cat /usr/lib/sasl2/smtpd.conf pwcheck_method: saslauthd #saslauthd协助smtp进行密码验证 |
配置Postfix使用SASL验证,编辑main.cf配置文件添加:
TEST:testsaslautd -u username -p 'password'
|
1
2
3
4
5
6
7
|
smtpd_sasl_auth_enable = yes #开启SMTP验证smtpd_sasl_security_options = noanonymous #不允许匿名用户smtpd_recipient_restrictions = #接收者限制规则,按顺序执行 permit_mynetworks, #mynetworks用户通过,匹配结束 permit_sasl_authenticated, #sasl验证用户通过,匹配结束 reject_unknown_sender_domain, #拒绝无效的发送邮件域名 reject_unauth_destination #拒绝收件人非mydestination、relay_domains或virtual_alias_maps定义域邮件 |
测试SMTP验证是否生效:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
telnet localhost 25Trying ::1...Connected to localhost.Escape character is '^]'.220 mail.domain.com ESMTP Postfixehlo localhost250-mail.domain.com250-PIPELINING250-SIZE 10240000250-VRFY250-ETRN250-AUTH LOGIN PLAIN #显示此信息代表验证正常250-ENHANCEDSTATUSCODES250-8BITMIME250 DSN |
|
1
|
yum -y install dovecot |
编辑dovecot配置文件:
|
1
2
3
|
vim /etc/dovecot/dovecot.conf protocols = imap pop3 #监听协议login_trusted_networks = 127.0.0.1 #允许登录接收邮件的IP段 |
设置邮件目录:
|
1
2
|
cat /etc/dovecot/conf.d/10-mail.conf mail_location = mbox:~/mail:INBOX=/var/mail/%u |
新建Mail账号:
|
1
|
useradd -g mail -s /sbin/nologin user |
启动dovecot服务:
|
1
|
/etc/init.d/dovecot start |
Centos安装配置Postfix邮件服务器的更多相关文章
- Centos安装配置Postfix邮件服务器--网址
http://www.haiyun.me/archives/centos-install-postfix.html http://blog.csdn.net/liuyunfengheda/articl ...
- 烂泥:Postfix邮件服务器搭建之软件安装与配置
本文由ilanniweb提供友情赞助,首发于烂泥行天下 想要获得更多的文章,可以关注我的微信ilanniweb Postfix邮件服务器的搭建需要使用到几个软件,分别是cyrus-sasl.postf ...
- 烂泥:Postfix邮件服务器搭建之虚拟用户配置
virtual_gid_maps = static: virtual_transport = dovecot dovecot_destination_recipient_limit = 1 注意:po ...
- postfix邮件服务器搭建03-webmail安装篇
本文接着上文的安装进行,介绍另一个WebMail功能更加人性化的roundcube.当然也可以对已有的postfix邮件系统进行功能完善 1.下载安装roundcube cd /server/tool ...
- 阿里云服务器Linux CentOS安装配置(零)目录
阿里云服务器Linux CentOS安装配置(零)目录 阿里云服务器Linux CentOS安装配置(一)购买阿里云服务器 阿里云服务器Linux CentOS安装配置(二)yum安装svn 阿里云服 ...
- 阿里云服务器Linux CentOS安装配置(九)shell编译、打包、部署
阿里云服务器Linux CentOS安装配置(九)shell编译.打包.部署 1.查询当前目录以及子目录下所有的java文件,并显示查询结果 find . -name *.java -type f - ...
- 阿里云服务器Linux CentOS安装配置(八)nginx安装、配置、域名绑定
阿里云服务器Linux CentOS安装配置(八)nginx安装.配置.域名绑定 1.安装nginx yum -y install nginx 2.启动nginx service nginx star ...
- 阿里云服务器Linux CentOS安装配置(七)域名解析
阿里云服务器Linux CentOS安装配置(七)域名解析 1.购买域名 登录阿里云,左侧菜单点击[域名],然后[域名注册],完成域名购买.(一般首年45元) 2.添加域名解析 在域名列表里点击你的域 ...
- 阿里云服务器Linux CentOS安装配置(六)resin多端口配置、安装、部署
阿里云服务器Linux CentOS安装配置(六)resin多端口配置.安装.部署 1.下载resin包 http://125.39.66.162/files/2183000003E08525/cau ...
随机推荐
- C#中的Collection 3
IList<T> 和 ICollection<T> 最重要的一些类型 List<T>: Encapsulates[T], like array, but also ...
- javascript js 内存泄露
JavaScript 内存泄露 1.什么是闭包.以及闭包所涉及的作用域链这里就不说了. 2.JavaScript垃圾回收机制 JavaScript不需要手动地释放内存,它使用一种自动垃圾回收机制(ga ...
- (剑指Offer)面试题32:从1到n整数中1出现的次数
题目: 输入一个整数n,求从1到n这n个整数的十进制表示中1出现的次数.例如输入12,从1到12这些整数中包含1的数字有1,10,11和12,一共出现了5次. 思路: 1.累加法 累加1到n中每个整数 ...
- Delphi Interfaces
http://www.delphibasics.co.uk/Article.asp?Name=Interface The reason for interfaces Classes that ex ...
- 使用UILocalizedIndexedCollation实现区域索引排序 及 不显示没有数据的区域
UILocalizedIndexedCollation可以实现区域排序,类似通讯录的样式. //首先进行初始化 locationCollation = [UILocalizedIndexedColla ...
- hotfix分析
使用System Update Readiness Tool for Windows Server 2008 R2 x64 可以分析hotfix是否有安装失败的情况 示例:http://blogs.t ...
- Linux Kconfig及Makefile学习
内核源码树的目录下都有两个文档Kconfig (2.4版本是Config.in)和Makefile.分布到各目录的Kconfig构成了一个分布式的内核配置数据库,每个Kconfig分别描述了所属目录源 ...
- Owin管道与asp.net管道模型
------2016.3.6 更新 文中提到没有Microsoft.Owin.Host.SystemWeb 这个dll 便不会加载Startup.Configuration,因为这个dll 其中有个O ...
- OpenGL 4.0 GLSL 实现 投影纹理映射(Projective Texture Mapping) (转)
http://blog.csdn.net/zhuyingqingfen/article/details/19331721 分类: GLSL 投影纹理映射 (projective texture ...
- hdu5072 2014 Asia AnShan Regional Contest C Coprime
最后一次参加亚洲区…… 题意:给出n(3 ≤ n ≤ 105)个数字,每个数ai满足1 ≤ ai ≤ 105,求有多少对(a,b,c)满足[(a, b) = (b, c) = (a, c) = 1] ...