<?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>days of linnchord &#187; 工具</title>
	<atom:link href="http://linnchord.net/archives/category/tool/feed" rel="self" type="application/rss+xml" />
	<link>http://linnchord.net</link>
	<description>南台静坐 : : :</description>
	<lastBuildDate>Thu, 03 Nov 2011 02:22:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>postfix with smtp auth on Ubuntu 11.04</title>
		<link>http://linnchord.net/archives/790.html</link>
		<comments>http://linnchord.net/archives/790.html#comments</comments>
		<pubDate>Thu, 18 Aug 2011 16:10:51 +0000</pubDate>
		<dc:creator>linnchord</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[存照]]></category>
		<category><![CDATA[工具]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[sasl]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://linnchord.me/?p=790</guid>
		<description><![CDATA[公司网站注册需要向用户发送邮件，原有的QQ企业邮箱自然不能用来搞这个了，迫不得已自己来配置邮件服务器。网上有很多文章，到处查找搞了一晚上，现在来记录一下……估计过两天换主机还用得着……悲剧…… sudo -i #切到root方便点吧 apt-get install postfix libsasl2-2 sasl2-bin libsasl2-modules db4.6-util procmail dpkg-reconfigure postfix 需要配置一大批，注意凡是需要填写host什么的都只填写主域domain.com，不必填邮件服务器2级前缀。 sudo apt-get install bsd-mail #很多网上文章写的mailx，不好用了 设置Maildir vim /etc/postfix/main.cf 添加 home_mailbox = Maildir/ 给系统需要收发邮件的用户创建Maildir目录 cd /home/{{user}} #{{user}}替换为用户名 maildirmake Maildir chown -R {{user}} Maildir 安装pop和imap sudo apt-get install courier-pop sudo apt-get install courier-imap 添加SMTP认证 vim /etc/postfix/main.cf 添加 smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, [...]]]></description>
			<content:encoded><![CDATA[<p>公司网站注册需要向用户发送邮件，原有的QQ企业邮箱自然不能用来搞这个了，迫不得已自己来配置邮件服务器。网上有很多文章，到处查找搞了一晚上，现在来记录一下……估计过两天换主机还用得着……悲剧……</p>
<pre class="brush:bash">
sudo -i #切到root方便点吧
apt-get install postfix libsasl2-2 sasl2-bin libsasl2-modules db4.6-util procmail
dpkg-reconfigure postfix
</pre>
<p>需要配置一大批，注意凡是需要填写host什么的都只填写主域domain.com，不必填邮件服务器2级前缀。</p>
<pre class="brush:bash">
sudo apt-get install bsd-mail #很多网上文章写的mailx，不好用了
</pre>
<p>设置Maildir</p>
<pre class="brush:bash">
vim /etc/postfix/main.cf
</pre>
<p>添加</p>
<pre class="brush:bash">
home_mailbox = Maildir/
</pre>
<p>给系统需要收发邮件的用户创建Maildir目录</p>
<pre class="brush:bash">
cd /home/{{user}}  #{{user}}替换为用户名
maildirmake Maildir
chown -R {{user}} Maildir
</pre>
<p>安装pop和imap</p>
<pre class="brush:bash">
sudo apt-get install courier-pop
sudo apt-get install courier-imap
</pre>
<p>添加SMTP认证</p>
<pre class="brush:bash">
vim /etc/postfix/main.cf
</pre>
<p>添加</p>
<pre class="brush:bash">
smtpd_recipient_restrictions = permit_mynetworks,
    permit_sasl_authenticated,
    reject_unauth_destination,
    reject_invalid_hostname,
    reject_non_fqdn_sender,
    reject_non_fqdn_recipient,
    reject_non_fqdn_hostname,

smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
broken_sasl_auth_clients = yes
</pre>
<p>修改</p>
<pre class="brush:bash">
vim /etc/default/saslauthd
</pre>
<p>添加</p>
<pre class="brush:bash">
START=yes
PWDIR="/var/spool/postfix/var/run/saslauthd"
PARAMS="-m ${PWDIR} -r"
PIDFILE="${PWDIR}/saslauthd.pid"
MECHANISMS="pam"
OPTIONS="-c -m ${PWDIR}"
</pre>
<p>然后运行</p>
<pre class="brush:bash">
mkdir -p /var/spool/postfix/var/run/saslauthd
echo 'pwcheck_method: saslauthd' >> /etc/postfix/sasl/smtpd.conf
echo 'mech_list: plain login' >> /etc/postfix/sasl/smtpd.conf
</pre>
<p>最后重启</p>
<pre class="brush:bash">
/etc/init.d/postfix restart
/etc/init.d/saslauthd restart
</pre>
<p>最后测试出现如下错误</p>
<pre class="brush:bash">
authentication failed: generic failure
</pre>
<p>在日志(/var/log/mail.log)中可以看见错误信息</p>
<pre class="brush:bash">
SASL authentication failure: cannot connect to saslauthd server: Permission denied
SASL authentication failure: Password verification failed
SASL PLAIN authentication failed: generic failure
</pre>
<p>经历了一个漫长刺激痛苦的google旅程，最后解决方案如下</p>
<p>最后发现是saslauthd运行时目录权限问题</p>
<pre class="brush:bash">
dpkg-statoverride --add root sasl 710 /var/spool/postfix/var/run/saslauthd
adduser postfix sasl
</pre>
<p>重启</p>
<pre class="brush:bash">
/etc/init.d/postfix restart
/etc/init.d/saslauthd restart
</pre>
<p>OK 搞定</p>
<p>参考文章：</p>
<ul>
<li><a href="http://wiki.ubuntu.org.cn/PostfixBasicSetupHowto" target="_blank">http://wiki.ubuntu.org.cn/PostfixBasicSetupHowto</a></li>
<li><a href="http://rashost.com/blog/postfix-smtp-auth" target="_blank">http://rashost.com/blog/postfix-smtp-auth</a></li>
</ul>
<p><br/></p>
<p>后记：2011-08-25</p>
<ul>
<li>如果新增加用户，imap不能即时生效，必须重启。</li>
<li>另外要注意用户/home下的用户目录权限，必须是username.username，我曾在添加用户时用了其他的group，结果失败，会报错-uid -gid不对。</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://linnchord.net/archives/790.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>clean &amp; auto save default grub boot of ubuntu</title>
		<link>http://linnchord.net/archives/776.html</link>
		<comments>http://linnchord.net/archives/776.html#comments</comments>
		<pubDate>Mon, 21 Mar 2011 01:44:04 +0000</pubDate>
		<dc:creator>linnchord</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[工具]]></category>
		<category><![CDATA[grub]]></category>

		<guid isPermaLink="false">http://linnchord.net/?p=776</guid>
		<description><![CDATA[ubuntu用了一段时间，更新了好几个版本，引导菜单拉的老长，需要清理一下。 删除多余的引导项很简单 cd /boot/grub sudo rm -i *-2.6.35-25-* 填入你想要删除的版本号即可，安全起见，会逐个让你确认。 刚开始用ubuntu的时候，可以自动选择上一次选择的启动项为默认启动，很方便的功能。后来这个功能不知道为什么默认没有了，现在想重新搞起来，google之，都是大批copy如何指定具体启动项的。干脆查看了一下/boot/grub/grub.cfg源文件，里面有如下函数。 function savedefault { if [ -z "${boot_once}" ]; then saved_entry="${chosen}" save_env saved_entry fi } 看上去只要在选择启动项后调用这个函数就ok，不过不太赶立马动手，又google了一下grub的参考，得到这个grub2的guide http://ubuntuforums.org/showthread.php?t=1195275，ok，里面有如何配置savedefault的说明。 修改/etc/default/grub GRUB_DEFAULT=saved #原为GRUB_DEFAULT=0 GRUB_SAVEDEFAULT=true #新增 然后运行 sudo update-grub 系统重新生成grub.cfg，更新后查看下该文件，多余的启动项取消了，每个启动项中添加了savedefault的调用。]]></description>
			<content:encoded><![CDATA[<p>ubuntu用了一段时间，更新了好几个版本，引导菜单拉的老长，需要清理一下。</p>
<p>删除多余的引导项很简单</p>
<pre class="brush:bash">
cd /boot/grub
sudo rm -i *-2.6.35-25-*
</pre>
<p>填入你想要删除的版本号即可，安全起见，会逐个让你确认。</p>
<p>刚开始用ubuntu的时候，可以自动选择上一次选择的启动项为默认启动，很方便的功能。后来这个功能不知道为什么默认没有了，现在想重新搞起来，google之，都是大批copy如何指定具体启动项的。干脆查看了一下/boot/grub/grub.cfg源文件，里面有如下函数。</p>
<pre class="brush:bash">
function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}
</pre>
<p>看上去只要在选择启动项后调用这个函数就ok，不过不太赶立马动手，又google了一下grub的参考，得到这个grub2的guide <a href="http://ubuntuforums.org/showthread.php?t=1195275" target="_blank">http://ubuntuforums.org/showthread.php?t=1195275</a>，ok，里面有如何配置savedefault的说明。</p>
<p>修改/etc/default/grub</p>
<pre class="brush:bash">
GRUB_DEFAULT=saved  #原为GRUB_DEFAULT=0
GRUB_SAVEDEFAULT=true  #新增
</pre>
<p>然后运行</p>
<pre class="brush:bash">
sudo update-grub
</pre>
<p>系统重新生成grub.cfg，更新后查看下该文件，多余的启动项取消了，每个启动项中添加了savedefault的调用。</p>
]]></content:encoded>
			<wfw:commentRss>http://linnchord.net/archives/776.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>search by Google SSL</title>
		<link>http://linnchord.net/archives/735.html</link>
		<comments>http://linnchord.net/archives/735.html#comments</comments>
		<pubDate>Wed, 09 Jun 2010 01:43:31 +0000</pubDate>
		<dc:creator>linnchord</dc:creator>
				<category><![CDATA[工具]]></category>
		<category><![CDATA[addone]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://linnchord.net/?p=735</guid>
		<description><![CDATA[google有了ssl，免除了无法预知的时不时被重置的痛苦，没有任何理由不立即使用起来。 国内访问https://www.google.com会被定向到http://www.google.com.hk，这时你可以点击“Google.com in English”链接，然后点击页面右上“Settings -> Search Settings”，进入设置页面后的第一个下拉列表就是界面语言选项(interface language)，选择中文再保存(右上角按钮)。然后你就可以正常访问https://www.google.com了。 整个操作过程会使google在你的浏览器里种一个cookie，和用户帐号无关，因此如果你清空了cookie或者用其他浏览器需要重新操作一次。 在更多的时候，我习惯直接使用firefox的搜索框，或者通过页面里拖拉字符进行搜索（或右键搜索），这时候我们可以在firefox网站上找到Google SSL 加密搜索插件，安装即可。 嗯，这个功能其实期盼已久，不知道google以前为什么不提供，现在可以免去我时不时要打开全局ssh代理的繁琐了。]]></description>
			<content:encoded><![CDATA[<p>google有了ssl，免除了无法预知的时不时被重置的痛苦，没有任何理由不立即使用起来。</p>
<p>国内访问<a href="https://www.google.com" target="_blank">https://www.google.com</a>会被定向到<a href="http://www.google.com.hk" target="_blank">http://www.google.com.hk</a>，这时你可以点击“Google.com in English”链接，然后点击页面右上“Settings -> Search Settings”，进入设置页面后的第一个下拉列表就是界面语言选项(interface language)，选择中文再保存(右上角按钮)。然后你就可以正常访问<a href="https://www.google.com" target="_blank">https://www.google.com</a>了。</p>
<p>整个操作过程会使google在你的浏览器里种一个cookie，和用户帐号无关，因此如果你清空了cookie或者用其他浏览器需要重新操作一次。</p>
<p>在更多的时候，我习惯直接使用firefox的搜索框，或者通过页面里拖拉字符进行搜索（或右键搜索），这时候我们可以在firefox网站上找到<a href="https://addons.mozilla.org/zh-CN/firefox/addon/161901/" target="_blank">Google SSL 加密搜索</a>插件，安装即可。</p>
<p>嗯，这个功能其实期盼已久，不知道google以前为什么不提供，现在可以免去我时不时要打开全局ssh代理的繁琐了。</p>
]]></content:encoded>
			<wfw:commentRss>http://linnchord.net/archives/735.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>hosts</title>
		<link>http://linnchord.net/archives/704.html</link>
		<comments>http://linnchord.net/archives/704.html#comments</comments>
		<pubDate>Wed, 02 Dec 2009 11:37:46 +0000</pubDate>
		<dc:creator>linnchord</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[工具]]></category>
		<category><![CDATA[GFW]]></category>
		<category><![CDATA[hosts]]></category>
		<category><![CDATA[linode]]></category>
		<category><![CDATA[vps]]></category>

		<guid isPermaLink="false">http://linnchord.net/?p=704</guid>
		<description><![CDATA[hack GFW是选用国外主机的一大优势…… 最近似乎twitter和facebook的访问速度又慢了，写了一个php脚本在站点上跑了下，获取了最新的hosts 128.121.146.228 twitter.com 128.121.146.228 www.twitter.com 168.143.162.69 assets0.twitter.com 168.143.162.69 assets1.twitter.com 168.143.162.69 assets2.twitter.com 168.143.162.69 assets3.twitter.com 168.143.162.69 assets4.twitter.com 168.143.162.69 static.twitter.com 67.219.156.130 help.twitter.com 208.96.32.3 apiwiki.twitter.com 69.63.181.12 www.facebook.com 69.63.184.142 facebook.com 69.63.181.22 login.facebook.com 69.192.18.110 s-static.ak.facebook.com 69.63.176.69 secure-profile.facebook.com 69.63.176.59 secure-media-sf2p.facebook.com 69.63.178.15 ssl.facebook.com 77.67.91.82 profile.ak.facebook.com 208.19.38.26 b.static.ak.facebook.com 前端有dns轮询的，不过我们能用一个就ok，再跑一次脚本，或者用下面这个 128.121.146.100 twitter.com 128.121.146.100 www.twitter.com 128.121.146.229 assets0.twitter.com 128.121.146.229 assets1.twitter.com 128.121.146.229 assets2.twitter.com 128.121.146.229 assets3.twitter.com 128.121.146.229 [...]]]></description>
			<content:encoded><![CDATA[<p>hack GFW是选用国外主机的一大优势……</p>
<p>最近似乎twitter和facebook的访问速度又慢了，写了一个php脚本在站点上跑了下，获取了最新的hosts</p>
<p>128.121.146.228 twitter.com<br />
128.121.146.228 www.twitter.com<br />
168.143.162.69 assets0.twitter.com<br />
168.143.162.69 assets1.twitter.com<br />
168.143.162.69 assets2.twitter.com<br />
168.143.162.69 assets3.twitter.com<br />
168.143.162.69 assets4.twitter.com<br />
168.143.162.69 static.twitter.com<br />
67.219.156.130 help.twitter.com<br />
208.96.32.3 apiwiki.twitter.com<br />
69.63.181.12 www.facebook.com<br />
69.63.184.142 facebook.com<br />
69.63.181.22 login.facebook.com<br />
69.192.18.110 s-static.ak.facebook.com<br />
69.63.176.69 secure-profile.facebook.com<br />
69.63.176.59 secure-media-sf2p.facebook.com<br />
69.63.178.15 ssl.facebook.com<br />
77.67.91.82 profile.ak.facebook.com<br />
208.19.38.26 b.static.ak.facebook.com</p>
<p>前端有dns轮询的，不过我们能用一个就ok，再跑一次脚本，或者用下面这个<br />
<span id="more-704"></span><br />
128.121.146.100 twitter.com<br />
128.121.146.100 www.twitter.com<br />
128.121.146.229 assets0.twitter.com<br />
128.121.146.229 assets1.twitter.com<br />
128.121.146.229 assets2.twitter.com<br />
128.121.146.229 assets3.twitter.com<br />
128.121.146.229 assets4.twitter.com<br />
128.121.146.229 static.twitter.com<br />
6
