CentOS6安裝postfix並設置sasl的具體方法

postfix是一個流行的smtp服務器。smtp服務器默認端口是25(不採用ssl/tls加密的狀況)。下面介紹如何在CentOS6上安裝postfix。html

 

1 . CentOS6默認安裝了postfix.若是系統沒有postfix,能夠用如下命令安裝。linux

[root@mail ~]# yum -y install postfix

2 . 配置postfix的main.cf,配置smtp-auth採用dovecot的sasl功能。centos

[root@mail ~]# vi /etc/postfix/main.cf
# 第75行: 去掉註釋,並設置主機名。
myhostname = mail.opsky.top
# 第83行: 去掉註釋,並設置域名。
mydomain = opsky.top
# 第99行: 去掉註釋。
myorigin = $mydomain
# 第116行: 
inet_interfaces = all
# 第119行: 若是隻使用ipv4,那麼設置以下。
inet_protocols = ipv4
# 第164行: 配置可接收郵件的域名。
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
# 第264行: 去掉註釋,並設置本地網絡號段.
mynetworks = 127.0.0.0/8, 10.0.0.0/24
# 第419行: 去掉註釋,採用Maildir格式。
home_mailbox = Maildir/
# 第571行: 
smtpd_banner = $myhostname ESMTP
# 添加以下配置到文件末尾
# 一封郵件大小限制爲10M
message_size_limit = 10485760
# 一個郵箱大小限制爲1G
mailbox_size_limit = 1073741824
# 配置SMTP-Auth採用dovecot的sasl功能
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject
main.cf配置完畢後,啓動postfix,並設置自動啓動。

[root@mail ~]# /etc/rc.d/init.d/postfix start 
Starting postfix: [  OK  ]
[root@mail ~]# chkconfig postfix on

3 . 若是iptables在開啓狀態,那麼設置iptables開放smtp的25端口。服務器

[root@dlp ~]# iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 25 -j ACCEPT

本文地址:http://www.linuxprobe.com/centos6-postfix.html編輯:任維國,審覈員:逄增寶網絡

相關文章
相關標籤/搜索