分类: LINUX
2008-11-12 19:25:02
PDF下载
|
安装postfix并配置发信验证功能
Alin Fang (Fang Yunlin)
MSN:
G Talk:
Blog: http://www.alinblog.cn/
12 Nov, 2008
第1次修改
GNU
本人实验笔记,非权威文档。如有错误请告知。十分感谢!
所有环境同搭建 smtp + pop3 服务器实验笔记(sendmail + dovecot)
这次实验笔记只是记录把sendmail换成postfix的操作方法
不讲理论,只有操作步骤。
如果想从头看起,请先看搭建 smtp + pop3 服务器实验笔记(sendmail + dovecot)
[root@mail ~]# cd /misc/cd/Server
[root@mail Server]# rpm -ivh postfix-2.3.3-2.i386.rpm
warning: postfix-2.3.3-2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:postfix ########################################### [100%]
[root@mail Server]# service sendmail stop
Shutting down sm-client: [ OK ]
Shutting down sendmail: [ OK ]
[root@mail Server]# service postfix start
Starting postfix: [ OK ]
[root@mail Server]# chkconfig --level 35 sendmail off
[root@mail Server]# chkconfig --level 35 postfix on
[root@mail Server]# alternatives --config mta
There are 2 programs which provide 'mta'.
Selection Command
-----------------------------------------------
*+ 1 /usr/sbin/sendmail.sendmail
2 /usr/sbin/sendmail.postfix
Enter to keep the current selection[+], or type selection number: 2
[root@mail Server]# alternatives --config mta
There are 2 programs which provide 'mta'.
Selection Command
-----------------------------------------------
* 1 /usr/sbin/sendmail.sendmail
+ 2 /usr/sbin/sendmail.postfix
Enter to keep the current selection[+], or type selection number:
[root@mail Server]#
[root@mail Server]# cd /etc/postfix/
[root@mail postfix]# ls
access header_checks makedefs.out post-install virtual
bounce.cf.default LICENSE master.cf relocated
canonical main.cf postfix-files TLS_LICENSE
generic main.cf.default postfix-script transport
[root@mail postfix]#
postfix的主要配置文件是main.cf
修改main.cf
把
inet_interfaces = localhost
改成
inet_interfaces = all
把
#myhostname = host.domain.tld
改成
myhostname = mail.apple.com
把
#mydomain = domain.tld
改成
mydomain = apple.com
把
mydestination = $myhostname, localhost.$mydomain, localhost
改成
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
保存退出。
重启postfix使新配置生效。
[root@mail postfix]# service postfix restart
Shutting down postfix: [ OK ]
Starting postfix: [ OK ]
[root@mail postfix]# netstat -ntpal | grep :25
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 4096/master
[root@mail postfix]# ps -ef | grep postfix
root 4096 1 0 02:37 ? 00:00:00 /usr/libexec/postfix/master
postfix 4098 4096 0 02:37 ? 00:00:00 pickup -l -t fifo -u
postfix 4099 4096 0 02:37 ? 00:00:00 qmgr -l -t fifo -u
root 4103 3331 0 02:37 pts/0 00:00:00 grep postfix
[root@mail postfix]#
测试发送邮件
[root@mail postfix]# telnet mail.apple.com 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 mail.apple.com ESMTP Postfix
helo mail.apple.com
250 mail.apple.com
mail
from:
250 2.1.0 Ok
rcpt
to:
250 2.1.5 Ok
data
354
End data with
From: alin
To: alin
Subject: Hello
Red Hat
.
250 2.0.0 Ok: queued as 8ADDB1638B1
quit
221 2.0.0 Bye
Connection closed by foreign host.
查收邮件
You have mail in /var/spool/mail/root
[root@mail postfix]# mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/root": 1 message 1 new
>N 1 alin@mail.apple.com Thu Nov 13 02:41 15/494 "Hello"
&
Message 1:
From root@mail.apple.com Thu Nov 13 02:41:48 2008
X-Original-To: root@apple.com
Delivered-To: root@apple.com
From: alin@mail.apple.com
To: alin@mail.apple.com
Subject: Hello
Date: Thu, 13 Nov 2008 02:41:03 +0800 (CST)
Red Hat
&
[root@mail postfix]# ls
access header_checks makedefs.out post-install virtual
bounce.cf.default LICENSE master.cf relocated
canonical main.cf postfix-files TLS_LICENSE
generic main.cf.default postfix-script transport
[root@mail postfix]# grep smtpd_sasl main.cf.default
smtpd_sasl_auth_enable = no
smtpd_sasl_authenticated_header = no
smtpd_sasl_exceptions_networks =
smtpd_sasl_local_domain =
smtpd_sasl_path = smtpd
smtpd_sasl_security_options = noanonymous
smtpd_sasl_tls_security_options = $smtpd_sasl_security_options
smtpd_sasl_type = cyrus
[root@mail postfix]# grep smtpd_sasl main.cf.default >> main.cf
[root@mail postfix]#
修改main.cf配置文件
把
smtpd_sasl_auth_enable = no
改为
smtpd_sasl_auth_enable = yes
重启postifx使配置生效
[root@mail postfix]# service postfix restart
Shutting down postfix: [ OK ]
Starting postfix: [ OK ]
[root@mail postfix]#
[root@mail postfix]# service saslauthd restart
Stopping saslauthd: [FAILED]
Starting saslauthd: [ OK ]
[root@mail postfix]# chkconfig --level 35 saslauthd on
[root@mail postfix]#
在mail.orange.com上同mail.apple.com一样配置postfix。
操作步骤省略。