个人工具

“UbuntuHelp:Postfix/zh”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
Introduction(介绍)
配置
 
(未显示6个用户的14个中间版本)
第10行: 第10行:
 
== 介绍 ==
 
== 介绍 ==
  
Postfix是一个邮件传输客户端(MTA),它也是ubuntu中默认的邮件传输客户端.它是Ubuntu的main软件库中的一个软件.这意味着它拥有安全更新.这份指南告诉你如何安装及配置postfix并将其设置成一个使用安全连接的SMTP服务器.
+
Postfix是ubuntu中默认的邮件传输代理(MTA).它是Ubuntu的main软件库中的一个软件.这意味着它拥有安全更新.这份指南告诉你如何安装及配置postfix并将其设置成一个使用安全连接的SMTP服务器.
 
+
== Installation(安装) ==
+
In order to install Postfix with SMTP-AUTH and TLS do the following steps:
+
  
 +
== 安装 ==
 
安装带SMTP-AUTHT和TLSR的Postfix使用如下的命令:
 
安装带SMTP-AUTHT和TLSR的Postfix使用如下的命令:
  
第20行: 第18行:
 
apt-get install postfix libsasl2 sasl2-bin libsasl2-modules libdb3-util procmail
 
apt-get install postfix libsasl2 sasl2-bin libsasl2-modules libdb3-util procmail
 
</pre>
 
</pre>
 +
apt-get install postfix libsasl2-2 sasl2-bin libsasl2-modules db4.6-util procmail
  
== Configuration(配置) ==
+
Posts like this brighten up my day. Tahnks for taking the time.
 
+
Run:
+
 
+
运行:
+
 
+
<pre>
+
dpkg-reconfigure postfix
+
</pre>
+
Insert the following details when asked (replacing server1.example.com with your domain name if you have one):
+
 
+
当要求提供相关信息时输入如下的信息(如果你拥有一个域名的话,将server1.example.com替换成你自己的域名):
+
 
+
* Internet Site
+
* NONE
+
* server1.example.com
+
* server1.example.com, localhost.example.com, localhost
+
* No
+
* 127.0.0.0/8
+
* Yes
+
* 0
+
* +
+
* all
+
 
+
Then run the following commands:
+
 
+
运行下列命令:
+
 
+
<pre>
+
### Configure Postfix to do SMTP AUTH using SASL (saslauthd)
+
postconf -e 'smtpd_sasl_local_domain ='
+
postconf -e 'smtpd_sasl_auth_enable = yes'
+
postconf -e 'smtpd_sasl_security_options = noanonymous'
+
postconf -e 'broken_sasl_auth_clients = yes'
+
postconf -e 'smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination'
+
postconf -e 'inet_interfaces = all'
+
echo 'pwcheck_method: saslauthd' >> /etc/postfix/sasl/smtpd.conf
+
echo 'mech_list: plain login' >> /etc/postfix/sasl/smtpd.conf
+
### Generate certificates to be used for TLS encryption and/or certificate Authentication
+
mkdir /etc/postfix/ssl
+
cd /etc/postfix/ssl/
+
openssl genrsa -des3 -rand /etc/hosts -out smtpd.key 1024
+
chmod 600 smtpd.key
+
openssl req -new -key smtpd.key -out smtpd.csr
+
openssl x509 -req -days 3650 -in smtpd.csr -signkey smtpd.key -out smtpd.crt
+
openssl rsa -in smtpd.key -out smtpd.key.unencrypted
+
mv -f smtpd.key.unencrypted smtpd.key
+
openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 3650
+
### Configure Postfix to do TLS encryption for both incoming and outgoing mail
+
postconf -e 'smtpd_tls_auth_only = no'
+
postconf -e 'smtp_use_tls = yes'
+
postconf -e 'smtpd_use_tls = yes'
+
postconf -e 'smtp_tls_note_starttls_offer = yes'
+
postconf -e 'smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key'
+
postconf -e 'smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt'
+
postconf -e 'smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem'
+
postconf -e 'smtpd_tls_loglevel = 1'
+
postconf -e 'smtpd_tls_received_header = yes'
+
postconf -e 'smtpd_tls_session_cache_timeout = 3600s'
+
postconf -e 'tls_random_source = dev:/dev/urandom'
+
postconf -e 'myhostname = server1.example.com'
+
</pre>
+
 
+
The file /etc/postfix/main.cf should now look like this:
+
 
+
/etc/postfix/main.cf 这个文件应当是如下的内容:
+
 
+
<pre>
+
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
+
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
+
biff = no
+
# appending .domain is the MUA's job.
+
append_dot_mydomain = no
+
# Uncomment the next line to generate "delayed mail" warnings
+
#delay_warning_time = 4h
+
myhostname = server1.example.com
+
alias_maps = hash:/etc/aliases
+
alias_database = hash:/etc/aliases
+
myorigin = /etc/mailname
+
mydestination = server1.example.com, localhost.example.com, localhost
+
relayhost =
+
mynetworks = 127.0.0.0/8
+
mailbox_command = procmail -a "$EXTENSION"
+
mailbox_size_limit = 0
+
recipient_delimiter = +
+
inet_interfaces = all
+
smtpd_sasl_local_domain =
+
smtpd_sasl_auth_enable = yes
+
smtpd_sasl_security_options = noanonymous
+
broken_sasl_auth_clients = yes
+
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject _unauth_destination
+
smtpd_tls_auth_only = no
+
smtp_use_tls = yes
+
smtpd_use_tls = yes
+
smtp_tls_note_starttls_offer = yes
+
smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key
+
smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt
+
smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
+
smtpd_tls_loglevel = 1
+
smtpd_tls_received_header = yes
+
smtpd_tls_session_cache_timeout = 3600s
+
tls_random_source = dev:/dev/urandom
+
</pre>
+
Restart the postfix daemon like this:
+
 
+
重启postfix守护进程:
+
 
+
<pre>
+
/etc/init.d/postfix restart
+
</pre>
+
  
== Authentication(验证) ==
+
== 验证 ==
Authentication will be done by saslauthd.
+
  
 
使用saslauthd来执行验证
 
使用saslauthd来执行验证
 
We have to change a few things to make it work properly. Because Postfix runs chrooted in '''''/var/spool/postfix''''' we have change a couple paths to live in the false root.  (ie. '''''/var/run/saslauthd''''' becomes '''''/var/spool/postfix/var/run/saslauthd'''''):
 
  
 
我们应当修改一些内容来令saslauthd正常工作.因为Postfix需要将根目录更改为'''''/var/spool/postfix ''''',我们应当将那些使用不正确根目录的目录更改为正确的.(例如:将'''''/var/run/saslauthd''''' 修改为'''''/var/spool/postfix/var/run/saslauthd'''''):
 
我们应当修改一些内容来令saslauthd正常工作.因为Postfix需要将根目录更改为'''''/var/spool/postfix ''''',我们应当将那些使用不正确根目录的目录更改为正确的.(例如:将'''''/var/run/saslauthd''''' 修改为'''''/var/spool/postfix/var/run/saslauthd'''''):
 
First we edit /etc/default/saslauthd in order to activate saslauthd. Remove # in front of START=yes and add the PWDIR, PARAMS, and PIDFILE lines:
 
  
 
首先,我们需要编辑/etc/default/saslauthd 以激活 saslauthd . 请将 '''''START=yes''''' 之前的 '''''#''''' 号去掉并添加''''' PWDIR''''', '''''PARAMS''''' 和''''' PIDFILE''''' 行:
 
首先,我们需要编辑/etc/default/saslauthd 以激活 saslauthd . 请将 '''''START=yes''''' 之前的 '''''#''''' 号去掉并添加''''' PWDIR''''', '''''PARAMS''''' 和''''' PIDFILE''''' 行:
第157行: 第42行:
 
MECHANISMS="pam"
 
MECHANISMS="pam"
 
</pre>
 
</pre>
 
'''Note''': If you prefer, you can use "shadow" instead of "pam". This will use MD5 hashed password transfer and is perfectly secure. The username and password needed to authenticate will be those of the users on the system you are using on the server.
 
  
 
'''注''' : 如果你喜欢的话,你可以使用"shadow"来替换"pam" .这将使用MD5生成的哈希值来传输以得到更高的安全性. 需要验证的用户名及密码将是那些你服务器上的系统上的.
 
'''注''' : 如果你喜欢的话,你可以使用"shadow"来替换"pam" .这将使用MD5生成的哈希值来传输以得到更高的安全性. 需要验证的用户名及密码将是那些你服务器上的系统上的.
 
Next, we update the dpkg "state" of /var/spool/portfix/var/run/saslauthd.  The saslauthd init script uses this setting to create the missing directory with the appropriate permissions and ownership:
 
  
 
下一步: 我们更新 dpkg 中 /var/spool/portfix/var/run/saslauthd 的状态. saslauthd 的启动脚本需要一个特定的用户权限来建立一个新的目录.
 
下一步: 我们更新 dpkg 中 /var/spool/portfix/var/run/saslauthd 的状态. saslauthd 的启动脚本需要一个特定的用户权限来建立一个新的目录.
第169行: 第50行:
 
dpkg-statoverride --force --update --add root sasl 755 /var/spool/postfix/var/run/saslauthd
 
dpkg-statoverride --force --update --add root sasl 755 /var/spool/postfix/var/run/saslauthd
 
</pre>
 
</pre>
 
Finally, start saslauthd:
 
  
 
最后,启动saslauthd:
 
最后,启动saslauthd:
第178行: 第57行:
 
</pre>
 
</pre>
  
== Testing(测试) ==
+
== 测试 ==
To see if SMTP-AUTH and TLS work properly now run the following command:
+
 
+
 
要查看SMTP-AUTH 及TLS能否正常工作请使用如下命令:
 
要查看SMTP-AUTH 及TLS能否正常工作请使用如下命令:
  
第186行: 第63行:
 
telnet localhost 25
 
telnet localhost 25
 
</pre>
 
</pre>
 
After you have established the connection to your postfix mail server type
 
  
 
在您建立了与您的postfix邮件服务器类型的连接之后
 
在您建立了与您的postfix邮件服务器类型的连接之后
第194行: 第69行:
 
ehlo localhost
 
ehlo localhost
 
</pre>
 
</pre>
 
If you see the lines
 
  
 
如果你看到如下行
 
如果你看到如下行
第203行: 第76行:
 
250-AUTH
 
250-AUTH
 
</pre>
 
</pre>
 
among others, everything is working.
 
  
 
在其它内容之上,表明一切正常.
 
在其它内容之上,表明一切正常.
 
Type ''''quit'''' to return to the system's shell.
 
  
 
输入 '''''quit''''' 以返回系统.
 
输入 '''''quit''''' 以返回系统.
  
== Other Postfix Guides(其它 Postfix 指南) ==
+
== 其它 Postfix 指南 ==
These guides will teach your howto setup Postfix mail servers from basic to advanced.
+
 
+
 
这些指南将从基本层面到高级层面告诉你如何配置Postfix邮件服务器.
 
这些指南将从基本层面到高级层面告诉你如何配置Postfix邮件服务器.
  
=== Postfix Basic Setup(Postfix 基本设置指南) ===
+
=== Postfix 基本设置指南 ===
[[:PostfixBasicSetupHowto|PostfixBasic Setup Howto]] will teach you the concepts of Posfix and how you can get Postfix basics setup up and running. If you are new to Postfix it is recomended to follow this guide first.
+
 
+
[[:Postfix基本设置指南|Postfix基本设置指南]]将告诉你Postfix的概念以及你如何进行Postfix的基本设置并使其工作.如果你是Postfix的新手,建议你首先使用这份指南.
+
  
=== Postfix Virtual Mailbox and Antivirus Filtering (Postfix 虚拟邮箱和病毒过滤) ===
+
[[:UbuntuHelp:PostfixBasicSetupHowto/zh|Postfix基本设置指南]]将告诉你Postfix的概念以及你如何进行Postfix的基本设置并使其工作.如果你是Postfix的新手,建议你首先使用这份指南.
[[:PostfixVirtualMailBoxClamSmtpHowto|Postfix Virtual MailBox ClamSmtp Howto]] will teach you howto setup a Virtual mailboxes using non-linux accounts where each user will authenticate using their e-mail address with Dovecot POP3/IMAP server and ClamSMTP Antivirus to filter both incoming and out going mails for known viruses.
+
  
[[:PostfixVirtualMailBoxClamSmtpHowto|Postfix虚拟邮箱和病毒过滤指南]]将告诉你如何设置通过非linux帐户来验证的虚拟邮箱,它使用e-mail地址及Dovecot POP3/IMAP 服务器执行验证.以及如何使用 ClamSMTP 反病毒软件来过滤接收及发送邮件中的已知病毒.
+
=== Postfix 虚拟邮箱和病毒过滤 ===
  
=== Postfix Complete Solution(Postfix 完全解决方案) ===
+
[[:UbuntuHelp:PostfixVirtualMailBoxClamSmtpHowto|Postfix虚拟邮箱和病毒过滤指南]]将告诉你如何设置通过非linux帐户来验证的虚拟邮箱,它使用e-mail地址及Dovecot POP3/IMAP 服务器执行验证.以及如何使用 ClamSMTP 反病毒软件来过滤接收及发送邮件中的已知病毒.
[[:PostfixCompleteVirtualMailSystemHowto|Postfix Complete Virtual Mail System Howto]] will help you if you are managing a large number of virtual domains at an ISP level service provider or in a large corporation where you mange few hundred or thousand mail domains. This guide is appropriate if you are looking a complete solution with:
+
  
[[:PostfixCompleteVirtualMailSystemHowto|Postfix 完整虚拟邮件系统指南]]将帮助你管理ISP级别的成千上万的虚拟域名,或在一个大型组织中帮助你管理成百上千的邮件域名.当你寻找一份与下述内容有关的完全解决方案时建议你阅读这份指南:
+
=== Postfix 完全解决方案 ===
 +
[[:UbuntuHelp:PostfixCompleteVirtualMailSystemHowto|Postfix 完整虚拟邮件系统指南]]将帮助你管理ISP级别的成千上万的虚拟域名,或在一个大型组织中帮助你管理成百上千的邮件域名.当你寻找一份与下述内容有关的完全解决方案时建议你阅读这份指南:
  
  * Web based system administration 基于网页的系统管理
+
  * 基于网页的系统管理
  * Unlimited number of domains 无限制数量的域名
+
  * 无限制数量的域名
  * Virtual mail users without the need for shell accounts 不需要shell帐号的虚拟邮件用户
+
  * 不需要shell帐号的虚拟邮件用户
  * Domain specific user names 特定域名的用户名
+
  * 特定域名的用户名
  * Mailbox quotas 邮箱引用
+
  * 邮箱引用
  * Web access to email accounts 通过网页来使用邮箱
+
  * 通过网页来使用邮箱
  * Web base interface to change user passwords 通过网页形式来更改用户密码
+
  * 通过网页形式来更改用户密码
  * IMAP and POP3 support IMAP及POP3支持
+
  * IMAP及POP3支持
  * Auto responders 自动回复
+
  * 自动回复
  * SMTP Authentication for secure relaying 通过SMTP验证以实现安全传递
+
  * 通过SMTP验证以实现安全传递
  * SSL for transport layer security 通过SSL以实现传输层安全传输
+
  * 通过SSL以实现传输层安全传输
  * Strong SPAM filtering 强垃圾邮件过滤
+
  * 强垃圾邮件过滤
  * Anti-Virus filtering 反病毒过滤
+
  * 反病毒过滤
  * Log Analysis 日志审计
+
  * 日志审计

2011年5月22日 (日) 00:48的最新版本


Postfix 快速指南


介绍

Postfix是ubuntu中默认的邮件传输代理(MTA).它是Ubuntu的main软件库中的一个软件.这意味着它拥有安全更新.这份指南告诉你如何安装及配置postfix并将其设置成一个使用安全连接的SMTP服务器.

安装

安装带SMTP-AUTHT和TLSR的Postfix使用如下的命令:

apt-get install postfix libsasl2 sasl2-bin libsasl2-modules libdb3-util procmail
apt-get install postfix libsasl2-2 sasl2-bin libsasl2-modules db4.6-util procmail

Posts like this brighten up my day. Tahnks for taking the time.

验证

使用saslauthd来执行验证

我们应当修改一些内容来令saslauthd正常工作.因为Postfix需要将根目录更改为/var/spool/postfix ,我们应当将那些使用不正确根目录的目录更改为正确的.(例如:将/var/run/saslauthd 修改为/var/spool/postfix/var/run/saslauthd):

首先,我们需要编辑/etc/default/saslauthd 以激活 saslauthd . 请将 START=yes 之前的 # 号去掉并添加 PWDIR, PARAMS PIDFILE 行:

# This needs to be uncommented before saslauthd will be run automatically
START=yes
PWDIR="/var/spool/postfix/var/run/saslauthd"
PARAMS="-m ${PWDIR}"
PIDFILE="${PWDIR}/saslauthd.pid"
# You must specify the authentication mechanisms you wish to use.
# This defaults to "pam" for PAM support, but may also include
# "shadow" or "sasldb", like this:
# MECHANISMS="pam shadow"
MECHANISMS="pam"

 : 如果你喜欢的话,你可以使用"shadow"来替换"pam" .这将使用MD5生成的哈希值来传输以得到更高的安全性. 需要验证的用户名及密码将是那些你服务器上的系统上的.

下一步: 我们更新 dpkg 中 /var/spool/portfix/var/run/saslauthd 的状态. saslauthd 的启动脚本需要一个特定的用户权限来建立一个新的目录.

dpkg-statoverride --force --update --add root sasl 755 /var/spool/postfix/var/run/saslauthd

最后,启动saslauthd:

/etc/init.d/saslauthd start

测试

要查看SMTP-AUTH 及TLS能否正常工作请使用如下命令:

telnet localhost 25

在您建立了与您的postfix邮件服务器类型的连接之后

ehlo localhost

如果你看到如下行

250-STARTTLS
250-AUTH

在其它内容之上,表明一切正常.

输入 quit 以返回系统.

其它 Postfix 指南

这些指南将从基本层面到高级层面告诉你如何配置Postfix邮件服务器.

Postfix 基本设置指南

Postfix基本设置指南将告诉你Postfix的概念以及你如何进行Postfix的基本设置并使其工作.如果你是Postfix的新手,建议你首先使用这份指南.

Postfix 虚拟邮箱和病毒过滤

Postfix虚拟邮箱和病毒过滤指南将告诉你如何设置通过非linux帐户来验证的虚拟邮箱,它使用e-mail地址及Dovecot POP3/IMAP 服务器执行验证.以及如何使用 ClamSMTP 反病毒软件来过滤接收及发送邮件中的已知病毒.

Postfix 完全解决方案

Postfix 完整虚拟邮件系统指南将帮助你管理ISP级别的成千上万的虚拟域名,或在一个大型组织中帮助你管理成百上千的邮件域名.当你寻找一份与下述内容有关的完全解决方案时建议你阅读这份指南:

* 基于网页的系统管理
* 无限制数量的域名
* 不需要shell帐号的虚拟邮件用户
* 特定域名的用户名
* 邮箱引用
* 通过网页来使用邮箱
* 通过网页形式来更改用户密码
* IMAP及POP3支持
* 自动回复
* 通过SMTP验证以实现安全传递
* 通过SSL以实现传输层安全传输
* 强垃圾邮件过滤
* 反病毒过滤
* 日志审计