<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>LiangXu Wang &#187; postfix</title>
	<atom:link href="http://wlx.westgis.ac.cn/tag/postfix/feed/" rel="self" type="application/rss+xml" />
	<link>http://wlx.westgis.ac.cn</link>
	<description>technology backup/share</description>
	<lastBuildDate>Sat, 14 Jan 2012 03:56:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>ubuntu hardy下的smtp服务</title>
		<link>http://wlx.westgis.ac.cn/492/</link>
		<comments>http://wlx.westgis.ac.cn/492/#comments</comments>
		<pubDate>Tue, 27 May 2008 03:08:37 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[hardy]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[sasl]]></category>
		<category><![CDATA[smtp]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/?p=492</guid>
		<description><![CDATA[前面介绍了应如何打造安全的SMTP服务，我们的服务器升级到ubuntu hardy后发现邮件服务急剧上升，最终检查发现smtp服务不安全了：全面开放了，这可是一个大问题。 经过一系列测试发现，修改了/etc/postfix/master.cf，去掉了这两个的注释： smtp inet n &#8211; &#8211; &#8211; &#8211; smtpd #submission inet n &#8211; &#8211; &#8211; &#8211; smtpd # -o smtpd_etrn_restrictions=reject -o smtpd_client_restrictions=permit_sasl_authenticated,reject #smtps inet n &#8211; &#8211; &#8211; &#8211; smtpd # -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes #submission inet n &#8230; <a href="http://wlx.westgis.ac.cn/492/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>前面介绍了应<a href="http://wlx.westgis.ac.cn/325/">如何打造安全的SMTP服务</a>，我们的服务器升级到ubuntu hardy后发现邮件服务急剧上升，最终检查发现smtp服务不安全了：全面开放了，这可是一个大问题。</p>
<p>经过一系列测试发现，修改了/etc/postfix/master.cf，去掉了这两个的注释：</p>
<blockquote><p>smtp      inet  n       &#8211;       &#8211;       &#8211;       &#8211;       smtpd<br />
#submission inet n      &#8211;       &#8211;       &#8211;       &#8211;       smtpd<br />
#	-o smtpd_etrn_restrictions=reject<br />
	-o smtpd_client_restrictions=permit_sasl_authenticated,reject<br />
#smtps    inet  n       &#8211;       &#8211;       &#8211;       &#8211;       smtpd<br />
#  -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes<br />
#submission inet n      &#8211;       &#8211;       &#8211;       &#8211;       smtpd<br />
  -o smtpd_etrn_restrictions=reject<br />
  -o smtpd_enforce_tls=yes -o smtpd_sasl_auth_enable=yes
</p></blockquote>
<p>这样就要求客户端必须使用TLS来连接，并必须通过验证。<br />
暂时还不清楚是否对本机上的其他Web邮件服务是否有影响。</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/492/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>转移邮件服务器：postfix</title>
		<link>http://wlx.westgis.ac.cn/396/</link>
		<comments>http://wlx.westgis.ac.cn/396/#comments</comments>
		<pubDate>Tue, 03 Jul 2007 11:24:43 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[amavis]]></category>
		<category><![CDATA[clamav]]></category>
		<category><![CDATA[courier]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[feisty]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[saslauth]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/396/</guid>
		<description><![CDATA[原邮件服务器硬盘损害，已经无法工作，需要转移到新服务器上。 原来的服务器是debian etch，新服务器是ubuntu feisty。 首先安装： sudo aptitude install postfix postfix-mysql courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl postfix-tls libsasl2 libsasl2-modules libsasl2-modules-sql sasl2-bin openssl libpam-mysql amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 unzoo libnet-ph-perl libnet-snpp-perl libnet-telnet-perl nomarch lzop pax razor pyzor dcc-client &#8230; <a href="http://wlx.westgis.ac.cn/396/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>原邮件服务器硬盘损害，已经无法工作，需要转移到新服务器上。<br />
原来的服务器是debian etch，新服务器是ubuntu feisty。</p>
<p>首先安装：<br />
sudo aptitude install postfix postfix-mysql courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl postfix-tls libsasl2 libsasl2-modules libsasl2-modules-sql sasl2-bin openssl libpam-mysql  amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 unzoo libnet-ph-perl libnet-snpp-perl libnet-telnet-perl nomarch lzop pax razor pyzor dcc-client</p>
<p>首先创建mysql数据库，因为原来已经创建，直接导入就可以了。<br />
把原来的mysql-virtual*文件拷贝到/etc/postfix/目录下，注意若mysql用户密码发生变化，要进行相应的修改。<br />
然后修改文件权限：</p>
<blockquote><p>chmod o= /etc/postfix/mysql-virtual_*.cf<br />
chgrp postfix /etc/postfix/mysql-virtual_*.cf</p></blockquote>
<p>创建vmail用户：</p>
<blockquote><p>groupadd -g 5000 vmail<br />
useradd -g vmail -u 5000 vmail -d /home/vmail -m</p></blockquote>
<p>对/etc/postfix/main.cf进行修改定制：</p>
<blockquote><p>postconf -e &#8216;myhostname = server1.example.com&#8217;<br />
postconf -e &#8216;mydestination = server1.example.com, localhost, localhost.localdomain&#8217;<br />
postconf -e &#8216;mynetworks = 127.0.0.0/8&#8242;<br />
postconf -e &#8216;virtual_alias_domains =&#8217;<br />
postconf -e &#8216; virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf&#8217;<br />
postconf -e &#8216;virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf&#8217;<br />
postconf -e &#8216;virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf&#8217;<br />
postconf -e &#8216;virtual_mailbox_base = /home/vmail&#8217;<br />
postconf -e &#8216;virtual_uid_maps = static:5000&#8242;<br />
postconf -e &#8216;virtual_gid_maps = static:5000&#8242;<br />
postconf -e &#8216;smtpd_sasl_auth_enable = yes&#8217;<br />
postconf -e &#8216;broken_sasl_auth_clients = yes&#8217;<br />
postconf -e &#8216;smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination&#8217;<br />
postconf -e &#8216;transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf&#8217;<br />
postconf -e &#8216;content_filter = amavis:[127.0.0.1]:10024&#8242;<br />
postconf -e &#8216;receive_override_options = no_address_mappings&#8217;
</p></blockquote>
<p>这部分需要具体检查，我把myorigin这个给注释掉了，对于多域名的邮件列表有影响。</p>
<p>saslauthd相关设置，和DEBIAN不大一样，和UBUNTU EDGY也不尽相同：</p>
<blockquote><p>sudo rm -fdr /var/spool/postfix/var/run/saslauthd<br />
sudo mv /var/run/saslauthd /var/spool/postfix/var/run/saslauthd<br />
sudo ln -s /var/spool/postfix/var/run/saslauthd /var/run/saslauthd<br />
sudo adduser postfix sasl</p></blockquote>
<p>修改/etc/default/saslauthd文件，把START修改为yes。<br />
修改/etc/pam.d/smtp文件：</p>
<blockquote><p>auth    required   pam_mysql.so user=mail_admin passwd=mail_admin_password host=127.0.0.1 db=mail table=users usercolumn=email passwdcolumn=password crypt=1</p>
<p>account sufficient pam_mysql.so user=mail_admin passwd=mail_admin_password host=127.0.0.1 db=mail table=users usercolumn=email passwdcolumn=password crypt=1</p></blockquote>
<p>对应的用户名密码数据库要进行替换。</p>
<p>修改/etc/courier/authdaemonrc文件，把authmodulelist的值变为”authmysql”。</p>
<p>修改/etc/init.d/postfix文件，在FILES部分：</p>
<blockquote><p>     FILES=”etc/localtime etc/services etc/resolv.conf etc/hosts \<br />
    etc/nsswitch.conf etc/nss_mdns.config etc/postfix/sasl/smtpd.conf etc/sasldb2″ </p></blockquote>
<p>这个原来是有sasldb2文件的，但是在ubuntu feisty下没有这个文件，但执行起来没有问题，比较奇怪。</p>
<p>修改/etc/courier/authmysqlrc文件：</p>
<blockquote><p>MYSQL_SERVER localhost</p>
<p>MYSQL_USERNAME mail_admin</p>
<p>MYSQL_PASSWORD mail_admin_password</p>
<p>MYSQL_PORT 0</p>
<p>MYSQL_DATABASE mail</p>
<p>MYSQL_USER_TABLE users</p>
<p>MYSQL_CRYPT_PWFIELD password</p>
<p>#MYSQL_CLEAR_PWFIELD password</p>
<p>MYSQL_UID_FIELD 5000</p>
<p>MYSQL_GID_FIELD 5000</p>
<p>MYSQL_LOGIN_FIELD email</p>
<p>MYSQL_HOME_FIELD “/home/vmail”</p>
<p>MYSQL_MAILDIR_FIELD CONCAT(SUBSTRING_INDEX(email,&#8217;@',-1),&#8217;/',SUBSTRING_INDEX(email,&#8217;@',1),&#8217;/')
</p></blockquote>
<p>重新启动服务：</p>
<blockquote><p>/etc/init.d/courier-authdaemon restart<br />
/etc/init.d/courier-imap restart<br />
/etc/init.d/courier-imap-ssl restart<br />
/etc/init.d/courier-pop restart<br />
/etc/init.d/courier-pop-ssl restart<br />
/etc/init.d/postfix restart<br />
/etc/init.d/saslauthd restart</p></blockquote>
<p>修改/etc/aliases文件，可以根据自己的需要进行修改。</p>
<p>修改vi /etc/amavis/conf.d/15-content_filter_mode文件，去掉几个注释：</p>
<blockquote><p>use strict;</p>
<p># You can modify this file to re-enable SPAM checking through spamassassin</p>
<p># and to re-enable antivirus checking.</p>
<p>#</p>
<p># Default antivirus checking mode</p>
<p># Uncomment the two lines below to enable it back</p>
<p>#</p>
<p>@bypass_virus_checks_maps = (</p>
<p>   \%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re);</p>
<p>#</p>
<p># Default SPAM checking mode</p>
<p># Uncomment the two lines below to enable it back</p>
<p>#</p>
<p>@bypass_spam_checks_maps = (</p>
<p>   \%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re);</p>
<p>1;  # insure a defined return</p></blockquote>
<p>修改 /etc/amavis/conf.d/50-user文件，添加：</p>
<blockquote><p>$pax=&#8217;pax&#8217;;</p></blockquote>
<p>修改/etc/postfix/master.cf文件，添加：</p>
<blockquote><p>[...]</p>
<p>amavis unix &#8211; - &#8211; - 2 smtp</p>
<p>        -o smtp_data_done_timeout=1200</p>
<p>        -o smtp_send_xforward_command=yes</p>
<p>127.0.0.1:10025 inet n &#8211; - &#8211; - smtpd</p>
<p>        -o content_filter=</p>
<p>        -o local_recipient_maps=</p>
<p>        -o relay_recipient_maps=</p>
<p>        -o smtpd_restriction_classes=</p>
<p>        -o smtpd_client_restrictions=</p>
<p>        -o smtpd_helo_restrictions=</p>
<p>        -o smtpd_sender_restrictions=</p>
<p>        -o smtpd_recipient_restrictions=permit_mynetworks,reject</p>
<p>        -o mynetworks=127.0.0.0/8</p>
<p>        -o strict_rfc821_envelopes=yes</p>
<p>        -o receive_override_options=no_unknown_recipient_checks,no_header_body_checks</p>
<p>        -o smtpd_bind_address=127.0.0.1</p></blockquote>
<p>修改/etc/spamassassin/local.cf，添加：</p>
<blockquote><p>[...]</p>
<p># dcc</p>
<p>use_dcc 1</p>
<p>dcc_path /usr/bin/dccproc</p>
<p>dcc_add_header 1</p>
<p>dcc_dccifd_path /usr/sbin/dccifd</p>
<p>#pyzor</p>
<p>use_pyzor 1</p>
<p>pyzor_path /usr/bin/pyzor</p>
<p>pyzor_add_header 1</p>
<p>#razor</p>
<p>use_razor2 1</p>
<p>razor_config /etc/razor/razor-agent.conf</p>
<p>#bayes</p>
<p>use_bayes 1</p>
<p>use_bayes_rules 1</p>
<p>bayes_auto_learn 1</p></blockquote>
<p>启动服务：</p>
<blockquote><p>adduser clamav amavis<br />
/etc/init.d/amavis restart<br />
/etc/init.d/clamav-daemon restart<br />
/etc/init.d/clamav-freshclam restart<br />
/etc/init.d/postfix restart
</p></blockquote>
<p>参考：</p>
<p>http://www.howtoforge.com/virtual_postfix_mysql_quota_courier_ubuntu_edgy</p>
<p>http://wlx.westgis.ac.cn/322/</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/396/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>mailman中使用postfix建立多域</title>
		<link>http://wlx.westgis.ac.cn/371/</link>
		<comments>http://wlx.westgis.ac.cn/371/#comments</comments>
		<pubDate>Mon, 21 May 2007 12:22:43 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[domain]]></category>
		<category><![CDATA[etch]]></category>
		<category><![CDATA[mailman]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[virtual]]></category>
		<category><![CDATA[westdc]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/371/</guid>
		<description><![CDATA[mailman： 2.1.9 debian etch 服务器上很早就搭建了postfix和mailman服务，但后来又产生新要求，要求mailman中再添加一个域名。原来做过多次尝试，一直未果。 今天把服务器升级为etch，顺便把x和gnome都干掉了。然后想看看这个问题能不能解决，就又试验起来了。 http://www.python.org/cgi-bin/faqw-mm.py?query=virtual+domain&#038;querytype=simple&#038;casefold=yes&#038;req=search 开始都是以为要查询virtual domain，进入了误区，结果一直无解。 官方文档：http://www.gnu.org/software/mailman/mailman-install/node13.html 看了上面的文档后，又实验了多种配置，还是有问题，发到新邮件列表的信一直自动转发到老邮件列表上，导致查无此人。 Reporting-MTA: dns; debian.westgis.ac.cn Received-From-MTA: smtp; debian.westgis.ac.cn ([127.0.0.1]) Arrival-Date: Sat, 30 Dec 2006 12:09:02 +0800 (CST) Original-Recipient: rfc822;westdc@lists.westgis.ac.cn Final-Recipient: rfc822;westdc@list.cngis.org Action: failed Status: 5.1.1 Remote-MTA: dns; 127.0.0.1 Diagnostic-Code: smtp; 550 &#8230; <a href="http://wlx.westgis.ac.cn/371/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>mailman： 2.1.9<br />
debian etch<br />
服务器上很早就<a href="http://wlx.westgis.ac.cn/44/">搭建了postfix和mailman服务</a>，但后来又产生新要求，要求mailman中再添加一个域名。原来做过多次尝试，一直未果。</p>
<p>今天把服务器升级为etch，顺便把x和gnome都干掉了。然后想看看这个问题能不能解决，就又试验起来了。</p>
<p>http://www.python.org/cgi-bin/faqw-mm.py?query=virtual+domain&#038;querytype=simple&#038;casefold=yes&#038;req=search</p>
<p>开始都是以为要查询virtual domain，进入了误区，结果一直无解。</p>
<p>官方文档：http://www.gnu.org/software/mailman/mailman-install/node13.html<br />
看了上面的文档后，又实验了多种配置，还是有问题，发到新邮件列表的信一直自动转发到老邮件列表上，导致查无此人。</p>
<blockquote><p><code>Reporting-MTA: dns; debian.westgis.ac.cn<br />
 Received-From-MTA: smtp; debian.westgis.ac.cn ([127.0.0.1])<br />
 Arrival-Date: Sat, 30 Dec 2006 12:09:02 +0800 (CST)<br />
 Original-Recipient: rfc822;westdc@lists.westgis.ac.cn<br />
 Final-Recipient: rfc822;westdc@list.cngis.org<br />
 Action: failed<br />
 Status: 5.1.1<br />
 Remote-MTA: dns; 127.0.0.1<br />
 Diagnostic-Code: smtp; 550 5.1.1 &lt;westdc@list.cngis.org&gt;: Recipient address rejected: User unknown in virtual mailbox table<br />
 Last-Attempt-Date: Sat, 30 Dec 2006 12:09:12 +0800 (CST)</code></p></blockquote>
<p>修改mm_cfg.py里的相关参数，都试验了一遍，错误信息依旧。然后查看到syslog里的出错信息，也是邮件地址的后缀自动变换了，非常奇怪。<br />
于是检查postfix的main.cf设置，看到：</p>
<blockquote><p>myorigin = list.cngis.org
</p></blockquote>
<p>想到了是否和这个配置有关系，于是首先修改为另外一个地址，然后再次试验，错误依旧，但错误信息发生了变化！<br />
于是把这个配置注释掉，万事大吉！<br />
想想好像这个地方原来是专门为配置mailman而加上的，没想到错误会出现在这里。当时好像是参照网上的教程直接搬下来的，还是官方的文档可靠阿。</p>
<p>这个问题已经都快半年没有解决了，今天终于解决了，爽阿。<br />
此办法的缺点：各域名之间不能创建同名的邮件列表，即不能同时创建a@dom1.org和a@dom2.org。这个问题在mailman 2.2的版本中得到了解决。</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/371/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ubuntu下打造安全的smtp服务</title>
		<link>http://wlx.westgis.ac.cn/325/</link>
		<comments>http://wlx.westgis.ac.cn/325/#comments</comments>
		<pubDate>Wed, 27 Dec 2006 09:49:35 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[sasl]]></category>
		<category><![CDATA[smtp]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/325/</guid>
		<description><![CDATA[其实，和DEBIAN ETCH下大部分相同，但在SASL处理上稍有不同。 若想安全，即避免被垃圾邮件骚扰，即必须进行smth认证，此处使用了sasl进行认证。同时要想不被sniffer，还必须使用tls加密。 详细过程请参考下面的站点。 参考：https://help.ubuntu.com/6.10/ubuntu/serverguide/C/email-services.html]]></description>
			<content:encoded><![CDATA[<p>其实，和DEBIAN ETCH下大部分相同，但在SASL处理上稍有不同。<br />
若想安全，即避免被垃圾邮件骚扰，即必须进行smth认证，此处使用了sasl进行认证。同时要想不被sniffer，还必须使用tls加密。<br />
详细过程请参考下面的站点。<br />
参考：https://help.ubuntu.com/6.10/ubuntu/serverguide/C/email-services.html</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/325/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>postfix使用sasl进行smtp验证</title>
		<link>http://wlx.westgis.ac.cn/322/</link>
		<comments>http://wlx.westgis.ac.cn/322/#comments</comments>
		<pubDate>Tue, 26 Dec 2006 14:27:42 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[sasl]]></category>
		<category><![CDATA[smtp]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/322/</guid>
		<description><![CDATA[DEBIAN服务器上安装了postfix，为了防止垃圾邮件，安装了sasl进行smtp验证。原来好像是使用authdaemon进行认证的，现在使用了debian testing升级了以后，出现了问题。 pop3没有问题，IMAP也没有问题，但是不能smtp，提示认证失败。 Dec 26 20:08:16 debian postfix/smtpd[2696]: warning: unknown[210.77.68.211]: SASL LOGIN authentication failed: authentication failure Dec 26 20:08:21 debian postfix/smtpd[2696]: warning: unknown[210.77.68.211]: SASL LOGIN authentication failed: authentication failure 为了搞定这个问题，又彻底检查了一遍postfix的各个配置参数，google了无数站点，最终在这个站点找到了解决方法。 我最初的安装方案应该是采用了这个站点的方法，但后来我也修改了不少地方。 现在将我这次的修改记录一下： 1. 修改/etc/postfix/sasl/smtpd.conf文件，内容如下： pwcheck_method: saslauthd mech_list: PLAIN LOGIN log_level: &#8230; <a href="http://wlx.westgis.ac.cn/322/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>DEBIAN服务器上安装了postfix，为了防止垃圾邮件，安装了sasl进行smtp验证。原来好像是使用authdaemon进行认证的，现在使用了debian testing升级了以后，出现了问题。<br />
pop3没有问题，IMAP也没有问题，但是不能smtp，提示认证失败。</p>
<blockquote><p>Dec 26 20:08:16 debian postfix/smtpd[2696]: warning: unknown[210.77.68.211]: SASL LOGIN authentication failed: authentication failure<br />
Dec 26 20:08:21 debian postfix/smtpd[2696]: warning: unknown[210.77.68.211]: SASL LOGIN authentication failed: authentication failure</p></blockquote>
<p>为了搞定这个问题，又彻底检查了一遍postfix的各个配置参数，google了无数站点，最终在<a href="http://www.nervous.it/txt/Postfix-SMTP-AUTH-4-DUMMIES.html">这个站点</a>找到了解决方法。<br />
我最初的安装方案应该是采用了<a href="http://workaround.org/articles/ispmail-sarge">这个站点</a>的方法，但后来我也修改了不少地方。</p>
<p>现在将我这次的修改记录一下：</p>
<p>1. 修改/etc/postfix/sasl/smtpd.conf文件，内容如下：</p>
<blockquote><p>pwcheck_method: saslauthd<br />
mech_list: PLAIN LOGIN<br />
log_level: 5</p></blockquote>
<p>其中，log_level可以自己调整，若出现问题，可以调大，最大为7，然后到/var/log/mail.warn、/var/log/syslog、/var/log/auth.log等文件中查找相关信息。<br />
2. 调整/etc/init.d/saslauthd文件，加入一个参数：</p>
<blockquote><p>DAEMON_ARGS=” -r </p></blockquote>
<p>这个参数本来的值是空的，我就是在这个地方给卡死了两天。<br />
3.  调整saslauthd运行目录，令其可以运行在chroot环境下，因为在DEBIAN里，postfix是运行在chroot里的。</p>
<blockquote><p>Move saslauthd&#8217;s socket dir inside Postfix&#8217;s chroot and create a link to keep everybody happy:</p>
<p># mv /var/run/saslauthd /var/spool/postfix/var/run/saslauthd<br />
# ln -s /var/spool/postfix/var/run/saslauthd /var/run/saslauthd</p>
<p>Add the postfix user to the sasl group:</p>
<p># adduser postfix sasl</p></blockquote>
<p>4. 修改/etc/init.d/postfix文件，主要是修改FILES文件定义：</p>
<blockquote><p>                FILES=”etc/localtime etc/services etc/resolv.conf etc/hosts \<br />
                    etc/nsswitch.conf etc/nss_mdns.config etc/postfix/sasl/smtpd.conf etc/sasldb2&#8243;
</p></blockquote>
<p>然后重新启动服务：</p>
<blockquote><p># /etc/init.d/postfix restart<br />
# /etc/init.d/saslauthd start</p></blockquote>
<p>这个网站的FAQ里提供的内容：</p>
<blockquote><p>Q.: Can Postfix query the MySQL db directly?<br />
A.: No.</p>
<p>Q.: Why do you use libpam-mysql? saslauthd natively supports SQL.<br />
A.: Because saslauthd only supports unencrypted password if you use a sql db as an authentication backend. That&#8217;s the reason for interfacing saslauthd with PAM. PAM, in turn, can use just anything.</p>
<p>Q.: My friend told me that /etc/postfix/sasl/smtpd.conf should contain</p>
<p> “pwcheck_method: pam”</p>
<p>A.: That was true for SASL < 2.x. Now you have to use saslauthd.</p>
<p><strong>Q.: Why do you run saslauthd with the -r flag?<br />
A.: Because my users authenticate as “user@domain”, not “user”. If you are in trouble check /var/log/auth.log .</strong></p>
<p>Q.: Why did you move saslauthd&#8217;s socket to</p>
<p>    /var/spool/postfix/var/run/saslauthd</p>
<p>?</p>
<p>A.: Because the smtp service runs chroot&#8217;ed.</p>
<p>Q.: Why did you add etc/postfix/sasl/smtpd.conf to the FILES variable?<br />
A.: Because Postfix needs to access that file from inside the chroot. The init.d script copies the latest copy of that file inside the chroot at every restart.</p>
<p>Q.: How does the authentication chain work?<br />
A.: Postfix connects to saslauthd via socket, which in turn asks PAM to authenticate the user which in turn queries the relevant MySQL table.</p>
<p>Q.: Are there any alternatives to libpam-mysql?<br />
A.: Perhaps it&#8217;s possible to use authdaemon from the Courier package.</p>
<p>Q.: Why do you use 127.0.0.1 instead of localhost?<br />
A.: In order to use a TCP socket instead of a unix socket. This way we don&#8217;t have to put MySQL&#8217;s unix socket inside Postfix&#8217;s chroot. </p></blockquote>
<p>致谢：(Thanks to)<br />
1. Luca Gibelli, http://www.nervous.it/txt/Postfix-SMTP-AUTH-4-DUMMIES.html<br />
2. http://postfix.wiki.xs4all.nl/index.php</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/322/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>postfix不能SMTP的问题</title>
		<link>http://wlx.westgis.ac.cn/202/</link>
		<comments>http://wlx.westgis.ac.cn/202/#comments</comments>
		<pubDate>Thu, 20 Jul 2006 08:56:14 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[smtp]]></category>

		<guid isPermaLink="false">http://wlxblog.westgis.ac.cn/202/</guid>
		<description><![CDATA[升级DEBIAN服务器后，POSTFIX出现问题，不能SMTP。 最后也没找到原因，取消了原来的SMTP验证模块，换了一个新的验证模块。 参考： http://howtoforge.com/virtual_postfix_mysql_quota_courier 垃圾邮件处理也进一步增强了。]]></description>
			<content:encoded><![CDATA[<p>升级DEBIAN服务器后，POSTFIX出现问题，不能SMTP。</p>
<p>最后也没找到原因，取消了原来的SMTP验证模块，换了一个新的验证模块。<br />
参考：</p>
<p>http://howtoforge.com/virtual_postfix_mysql_quota_courier</p>
<p>垃圾邮件处理也进一步增强了。</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/202/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>debian sarge mailman on postfix</title>
		<link>http://wlx.westgis.ac.cn/44/</link>
		<comments>http://wlx.westgis.ac.cn/44/#comments</comments>
		<pubDate>Fri, 04 Mar 2005 01:47:23 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[mailman]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[postfix]]></category>

		<guid isPermaLink="false">http://blog.mygis.org/44/</guid>
		<description><![CDATA[已经安装了postfix-mysql。postfix的virtual domain是放在MYSQL中的。 安装mailman: apt-get install mailman 配置： 1. /etc/postfix/main.cf owner_request_special = no alias_maps = hash:/etc/postfix/aliases, hash:/usr/local/mailman/data/aliases virtual_alias_maps = , hash:/usr/local/mailman/data/virtual-mailman 2. /etc/mailman/mm_cfg.py MTA = &#8216;Postfix&#8217; POSTFIX_STYLE_VIRTUAL_DOMAINS = ['list.cngis.org', list.mygis.org'] 3. 生成两个文件 cd /usr/local/mailman bin/genaliases su chmod 666 data/aliases* touch data/virtual-mailman &#8230; <a href="http://wlx.westgis.ac.cn/44/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>已经安装了postfix-mysql。postfix的virtual domain是放在MYSQL中的。<br />
安装mailman:<br />
apt-get install mailman<br />
配置：<br />
1. /etc/postfix/main.cf</p>
<blockquote><p>
owner_request_special = no</p>
<p>alias_maps = hash:/etc/postfix/aliases,<br />
            hash:/usr/local/mailman/data/aliases<br />
virtual_alias_maps = <your normal virtual alias files>,<br />
        hash:/usr/local/mailman/data/virtual-mailman
</p></blockquote>
<p>2.  /etc/mailman/mm_cfg.py</p>
<blockquote><p>
MTA = &#8216;Postfix&#8217;<br />
POSTFIX_STYLE_VIRTUAL_DOMAINS = ['list.cngis.org', list.mygis.org']
</p></blockquote>
<p>3. 生成两个文件</p>
<blockquote><p>
cd /usr/local/mailman<br />
bin/genaliases<br />
su<br />
chmod 666 data/aliases*<br />
touch data/virtual-mailman<br />
touch data/virtual-mailman.db<br />
chmod 666 data/virtual-mailman*
</p></blockquote>
<p>4、 生成默认的mail list<br />
newlist mailman<br />
5、 重新启动服务</p>
<blockquote><p>
/etc/init.d/postfix reload<br />
/etc/init.d/mailman restart
</p></blockquote>
<p>可能以后新加入的mail list都需要postfix reload。<br />
BTW：可惜目前的mailman不支持中文。<br />
总结： 多看官方的安装文档，检查系统的LOG记录，遇到问题到GOOGLE搜索答案。</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/44/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

