<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[Heck's  Blog]]></title> 
<link>https://www.heckjj.com/index.php</link> 
<description><![CDATA[一瞬间的决定，往往可以改变很多，事实上，让自己成功的往往不是知识，是精神！ 如果你总是为自己找借口，那只好让成功推迟。执行力，今天！]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[Heck's  Blog]]></copyright>
<item>
<link>https://www.heckjj.com/centos53-cfg-mailserver-Postfix-html/</link>
<title><![CDATA[Centos 5.3服务器完美配置之安装Postfix邮件服务器]]></title> 
<author>Heck &lt;@hecks.tk&gt;</author>
<category><![CDATA[电脑技术]]></category>
<pubDate>Mon, 20 Sep 2010 17:24:32 +0000</pubDate> 
<guid>https://www.heckjj.com/centos53-cfg-mailserver-Postfix-html/</guid> 
<description>
<![CDATA[ 
	<span style="font-family: 微软雅黑;"><span style="font-size: 14px;"><strong><span style="color: #4169E1;">Postfix邮件服务器的安装</span></strong></span><br/>现在安装Postfix以及Dovecot（Dovecot可以用作pop/imap服务器）。<br/>yum install cyrus-sasl cyrus-sasl-devel cyrus-sasl-gssapi cyrus-sasl-md5 cyrus-sasl-plain postfix dovecot<br/><br/>现在配置SMTP-AUTH以及TLS（如果你的smtp服务器不需要认证可以跳过这一步），使用root用户：<br/>postconf -e 'smtpd_sasl_local_domain ='<br/>postconf -e 'smtpd_sasl_auth_enable = yes'<br/>postconf -e 'smtpd_sasl_security_options = noanonymous'<br/>postconf -e 'broken_sasl_auth_clients = yes'<br/>postconf -e 'smtpd_sasl_authenticated_header = yes'<br/>postconf -e 'smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination'<br/>postconf -e 'inet_interfaces = all'<br/>postconf -e 'mynetworks = 127.0.0.0/8'<br/><br/>之后需要编辑/usr/lib/sasl2/smtpd.conf，64位CentOS上是/usr/lib64/sasl2/smtpd.conf：<br/><br/>vi /usr/lib/sasl2/smtpd.conf</span><span style="font-family: 微软雅黑;"><br/><br/>将其中的内容编辑成类似如下的内容：<br/><br/>pwcheck_method: saslauthd<br/>mech_list: plain login<br/>之后创建TLS证书：<br/>mkdir /etc/postfix/ssl<br/>cd /etc/postfix/ssl/<br/>openssl genrsa -des3 -rand /etc/hosts -out smtpd.key 1024<br/>chmod 600 smtpd.keyopenssl req -new -key smtpd.key -out smtpd.csr<br/>openssl x509 -req -days 3650 -in smtpd.csr -signkey smtpd.key -out smtpd.crt<br/>openssl rsa -in smtpd.key -out smtpd.key.unencrypted<br/><br/>mv -f smtpd.key.unencrypted smtpd.key<br/>openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 3650<br/><br/>之后对postfix配置TLS：<br/>postconf -e 'smtpd_tls_auth_only = no'<br/>postconf -e 'smtp_use_tls = yes'<br/>postconf -e 'smtpd_use_tls = yes'<br/>postconf -e 'smtp_tls_note_starttls_offer = yes'<br/>postconf -e 'smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key'<br/>postconf -e 'smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt'<br/>postconf -e 'smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem'<br/>postconf -e 'smtpd_tls_loglevel = 1'<br/>postconf -e 'smtpd_tls_received_header = yes'<br/>postconf -e 'smtpd_tls_session_cache_timeout = 3600s'<br/>postconf -e 'tls_random_source = dev:/dev/urandom'<br/>然后配置smtp服务器的域名：postconf -e 'myhostname = server1.example.com'把server1.example.com换成你的域名之后检查一下你的配置，所有的配置都在/etc/postfix/main.cf中：cat /etc/postfix/main.cf其中的内容应该类似下面：</span><br/><textarea name="code" class="python" rows="15" cols="100">
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
mail_owner = postfix
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost
unknown_local_recipient_reject_code = 550
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
debug_peer_level = 2
debugger_command =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xxgdb $daemon_directory/$process_name $process_id & sleep 5

sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.3.3/samples
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
smtpd_sasl_local_domain =
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
mynetworks = 127.0.0.0/8
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
myhostname = server1.example.com
</textarea><span style="font-family: 微软雅黑;"><br/><span style="font-size: 14px;"><strong><span style="color: #4169E1;">安装Dovecot用于POP/IMAP服务器</span></strong></span><br/>默认情况下，CentOS上Dovecot只用于IMAP服务器，如果你也想用它做pop服务器可以修改/etc/dovecot.conf.将其中的protocols改成：protocols = imap imaps pop3 pop3s用vi打开配置文件：<br/>vi /etc/dovecot.conf其中的内容修改成类似这样的：<br/>[...]<br/># Base directory where to store runtime data.<br/>#base_dir = /var/run/dovecot/<br/># Protocols we want to be serving: imap imaps pop3 pop3s<br/># If you only want to use dovecot-auth, you can set this to "none".protocols = imap imaps pop3 pop3s<br/># IP or host address where to listen in for connections. It's not currently<br/># possible to specify multiple addresses. "*" listens in all IPv4 interfaces.<br/># "[::]" listens in all IPv6 interfaces, but may also listen in all IPv4<br/># interfaces depending on the operating system.<br/>[...]配置MailDir<br/>postconf -e 'home_mailbox = Maildir/'<br/>postconf -e 'mailbox_command ='<br/>/etc/init.d/postfix restart<br/>启动邮件服务器启动<br/>postfix，saslauthd以及dovecot： <br/>chkconfig --levels 235 sendmail off&nbsp;&nbsp;<br/>chkconfig --levels 235 postfix on&nbsp;&nbsp;<br/>chkconfig --levels 235 saslauthd on&nbsp;&nbsp;<br/>chkconfig --levels 235 dovecot on&nbsp;&nbsp;<br/>/etc/init.d/sendmail stop&nbsp;&nbsp;<br/>/etc/init.d/postfix start&nbsp;&nbsp;<br/>/etc/init.d/saslauthd start&nbsp;&nbsp;<br/>/etc/init.d/dovecot start之后验证是否smtp服务器已经开始运行：telnet localhost 25 连接上以后打这个命令：ehlo localhost <br/><br/>如果postfix已经正常启动应该看到这样一行字：<br/><br/>250-STARTTLS <br/><br/>以及：<br/><br/>250-AUTH PLAIN LOGIN <br/><br/>然后打入：quit退出这次连接。</span><br/>Tags - <a href="https://www.heckjj.com/tags/%25E5%25AE%258C%25E7%25BE%258E%25E9%2585%258D%25E7%25BD%25AEcentos/" rel="tag">完美配置centos</a> , <a href="https://www.heckjj.com/tags/%25E9%2582%25AE%25E4%25BB%25B6%25E6%259C%258D%25E5%258A%25A1%25E5%2599%25A8/" rel="tag">邮件服务器</a> , <a href="https://www.heckjj.com/tags/postfix/" rel="tag">postfix</a>
]]>
</description>
</item><item>
<link>https://www.heckjj.com/centos53-cfg-mailserver-Postfix-html/#blogcomment</link>
<title><![CDATA[[评论] Centos 5.3服务器完美配置之安装Postfix邮件服务器]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://www.heckjj.com/centos53-cfg-mailserver-Postfix-html/#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>