<?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>ダメ出し日記 &#187; Postfix</title>
	<atom:link href="http://www.sfo.jp/blog/archives/category/software/postfix/feed" rel="self" type="application/rss+xml" />
	<link>http://www.sfo.jp/blog</link>
	<description>自称・独立&#38;OSS系(?) SE、さとうふみやすの日記。OSS テクノロジ(株)に勤務。</description>
	<lastBuildDate>Fri, 23 Oct 2009 08:10:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Postfix: SMTP HELO コマンドの制限</title>
		<link>http://www.sfo.jp/blog/archives/2005/10/post-22.html</link>
		<comments>http://www.sfo.jp/blog/archives/2005/10/post-22.html#comments</comments>
		<pubDate>Thu, 27 Oct 2005 13:33:06 +0000</pubDate>
		<dc:creator>fumiyas</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Mail]]></category>
		<category><![CDATA[Postfix]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[ダメ出し]]></category>
		<category><![CDATA[仕事]]></category>

		<guid isPermaLink="false">http://www.sfo.jp/blog/archives/2005/10/post-22.html</guid>
		<description><![CDATA[
某所で NetSky 系のウイルスが欝陶しい。
ウイルスである SMTP クライアントは
HELO 宛先アドレスのドメイン部
と喋るようなので、これで制限することにした。




まずは
/etc/postfix/he [...]]]></description>
			<content:encoded><![CDATA[<p>
某所で NetSky 系のウイルスが欝陶しい。
ウイルスである SMTP クライアントは
<q><code>HELO 宛先アドレスのドメイン部</code></q>
と喋るようなので、これで制限することにした。
</p>

<p><span id="more-67"></span>
<p>
まずは
<code class="file">/etc/postfix/helo<em>access</code>
を用意して、
<code class="commandline">postmap /etc/postfix/helo</em>access</code>
しておく。
内容は以下の通り:
</p>
<pre class="code"><code>example.com REJECT
</code></pre>
<p>
次に
<code class="file">/etc/postfix/main.cf</code>
に以下のような設定を追加して、
<code class="commandline">postfix reload</code>
する:
</p>
<pre class="code"><code>smtpd<em>helo</em>restrictions =
check<em>helo</em>access hash:/etc/postfix/helo<em>access
</code></pre>
<p>
で、試してみると…
<q><code>HELO exmaple.com</code></q>
だけでなく、
<q><code>HELO subdomain.exmaple.com</code></q>
も拒否してしまうのであった。
</p>
<p>
何で素直に exmaple.com だけを対象にしないのかね、まったく。
ちなみにこれと同じ変な仕様は、Apache の mod</em>access にもある。
いや待てよ、もしかしたら、これがいわゆる「普通」なのかも?!
だとしたらちょっと狂ってる。
<code class="command">qmail-smtpd</code>(8) の
<code class="file">rcpthosts</code> ファイルのように、
exmaple.com だったら exmaple.com だけにマッチし、
.example.com だったら example.com のサブドメインすべてにマッチするという仕様のほうが、
ずっと直感的でわかりやすく、なおかつ使い易いと思う。
</p>
<p>
気をとりなおして <code class="file">access</code>(5) を斜め読みしてから、
<code class="file">/etc/postfix/helo<em>access</code>
を以下のように変更してみた:
</p>
<pre class="code"><code>.example.com DUNNO
example.com REJECT
</code></pre>
<p>
しかし結果は変わらず。
</p>
<p>
もう一度 <code class="file">access</code>(5) をようく読んだところ、
<code class="parameter">parent</em>domain<em>matches</em>subdomains</code> が元凶であることが判明。
そこで
<code class="file">/etc/postfix/main.cf</code>
に以下を追加して無効にすることにした:
<pre class="code"><code>parent<em>domain</em>matches<em>subdomains =
</code></pre>
<p>
<code class="file">/etc/postfix/helo</em>access</code>
を最初のものに戻して試したところ、今度は成功した。
</p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sfo.jp/blog/archives/2005/10/post-22.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

