个人工具
104.160.18.24
该IP地址的讨论
登录
查看“Postfix 快速指南”的源代码 - Ubuntu中文
页面
讨论
查看源代码
历史
搜索
导航
首页
最近更改
随机页面
页面分类
帮助
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
特殊页面
页面信息
查看“Postfix 快速指南”的源代码
来自Ubuntu中文
←
Postfix 快速指南
跳转至:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
== 介绍 == Postfix 是一种 <code><nowiki>Mail Transfer Agent 邮件传送代理</nowiki></code> (MTA) 是 Ubuntu 缺省的邮件代理程序. 它在 Ubuntu 的 main 仓库, 意味着它将接收到安全方面的升级。 这个指南说明了如何安装和配置 postfix 和设置为一个使用安全连接的 SMTP 服务器。 == 安装 == 为了安装 Postfix 、 SMTP-AUTH 和 TLS 执行下列步骤: <pre><nowiki> apt-get install postfix libsasl2-2 sasl2-bin libsasl2-modules libdb3-util procmail </nowiki></pre> 在10.04版本中, 安装libdb3-util 会找不到安装包,因为该软件已经升级。 <pre><nowiki> apt-get install db4.6-util </nowiki></pre> == 配置 == 运行: <pre><nowiki> dpkg-reconfigure postfix </nowiki></pre> 在被询问时,插入如下的内容 (如果你有一个域名的话,使用你的域名替换掉 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 然后运行下面的命令: <pre><nowiki> 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 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 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' </nowiki></pre> 文件 /etc/postfix/main.cf 现在看起来如下: <pre><nowiki> # 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 </nowiki></pre> 重启 postfix 服务: <pre><nowiki> /etc/init.d/postfix restart</nowiki></pre> == 验证 == 验证通过 saslauthd 完成。 我们不得不调整一些东西使它工作的更好。 因为 Postfix 运行 chrooted 在 '''''/var/spool/postfix''''' 我们修改一些相对路径使其在一个假想的 root 下运行。 (例如. '''''/var/run/saslauthd''''' 变成 '''''/var/spool/postfix/var/run/saslauthd'''''): 首先我们编辑 /etc/default/saslauthd 为了激活 saslauthd. 删除 # 于 START=yes 行的前面并且正在 PWDIR, PARAMS, 和 PIDFILE 行: <pre><nowiki> # This needs to be uncommented before saslauthd will be run automatically START=yes PWDIR="/var/spool/postfix/var/run/saslauthd" OPTIONS="-c -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" </nowiki></pre> '''笔记''': 如果你喜欢, 你可以使用 "shadow" 代替 "pam". 它将使用 MD5 来传输密码,这是一种更安全的做法。 用户名和密码的验证需要使用你服务器上的用户。 下一步, 我们更新 dpkg "状态" 于 /var/spool/portfix/var/run/saslauthd. saslauthd 初始化脚本来建立缺少的目录并拥有适当的权限: <pre><nowiki> dpkg-statoverride --force --update --add root sasl 755 /var/spool/postfix/var/run/saslauthd </nowiki></pre> 最后,运行 saslauthd: <pre><nowiki> /etc/init.d/saslauthd start </nowiki></pre> == 测试 == 为了查看 SMTP-AUTH 和 TLS 是否正确运行,现在运行如下命令: telnet localhost 25 当你连接到你的 postfix 邮件服务器后,输入 ehlo localhost 如果你看到如下行 <pre><nowiki> 250-STARTTLS 250-AUTH </nowiki></pre> 在其它的中间, 所有的事情都在正常运行. 输入 <code><nowiki>quit</nowiki></code> 返回到系统终端. == 其它 Postfix 指南 == 这些指南将教会你如何使用 Postfix 邮件服务器从基本的到高级设置。 === Postfix 基础设置 === [[Postfix 基本设置指南]] 将教会你 Posfix 的概念和如果做 Postfix 的基本设置和运行. 如果你是 Postfix 新手,推荐首先阅读这个指南. === Postfix 虚拟邮箱和病毒过滤 === [[Postfix 虚拟邮箱和病毒过滤指南]] 将教会你如何设置一个虚拟邮箱使用 non-linux 帐号,每个用户将使用他们的 e-mail 地址和 POP3/IMAP 服务来验证 和 ClamSMTP 防毒软件过滤所有发进发出邮件已知的病毒. === Postfix 完整的问答 === [[Postfix 完整虚拟邮件系统指南]] 将帮助你,如果你作为一个 ISP 管理一个大的虚拟域名,或者在一个大公司里面需要管理多个邮件域名,这个手册是适合的,你将看到如下的方法: * 基于 Web 的系统管理 * 不限制数量的域名 * 不需要系统帐号的虚拟邮件用户 * 特定域名的用户帐号 * 邮箱空间大小限制 * Web 访问邮件帐号 * Web 界面的修改用户帐号 * IMAP 和 POP3 支持 * Auto 回复 * SMTP 验证 * SSL 传输安全 * 强大的 SPAM 过滤 * Anti-Virus 过滤 * 日志分析 [[Category:服务器]]
返回至
Postfix 快速指南
。