<?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>Masashi Blog &#187; sshd</title>
	<atom:link href="http://www.masashi.org/blog/category/software/freebsd/sshd/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.masashi.org/blog</link>
	<description>日々の四方山話を徒然と･･･</description>
	<lastBuildDate>Fri, 03 Sep 2010 06:53:53 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>FreeBSD (sshd &amp; hosts.allow)</title>
		<link>http://www.masashi.org/blog/2006/11/27/freebsd-sshd-hostsallow/</link>
		<comments>http://www.masashi.org/blog/2006/11/27/freebsd-sshd-hostsallow/#comments</comments>
		<pubDate>Mon, 27 Nov 2006 13:37:40 +0000</pubDate>
		<dc:creator>Masashi</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[sshd]]></category>
		<category><![CDATA[hosts.allow]]></category>
		<category><![CDATA[Maxlogins]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.masashi.org/blog/archives/192</guid>
		<description><![CDATA[サーバーをインタネットに公開するとsshの扉を叩く人がかなりいます。それも手持ちの鍵（idとパスワード)を順番に片っ端から試していく奴が結構沢山。
そこで、Maxloginsを使ってみる。このツールはsyslogでssh [...]]]></description>
			<content:encoded><![CDATA[<p class="storycontent">サーバーをインタネットに公開するとsshの扉を叩く人がかなりいます。それも手持ちの鍵（idとパスワード)を順番に片っ端から試していく奴が結構沢山。</p>
<p>そこで、<a href="http://www.teamits.com/resources/maxlogins.html">Maxlogins</a>を使ってみる。このツールはsyslogでsshアクセス失敗回数を監視し、一定の基準を超えたアクセス禁止のIPアドレスリストを吐き出す。そのリストをhosts.allowに取り込んでsshのアクセスを禁止する仕組み。<br />
ツールの実体は<a href="http://www.teamits.com/resources/maxlogins.txt">ここ</a>にある。 テキストファイルだけど、”maxlogins.pl”とかの名前で/usr/local/bin に保存すし、次のようにしてsyslogから実行できるようにしておく。</p>
<blockquote><p># chown root:wheel /usr/local/bin/maxlogins.pl<br />
# chmod 750 /usr/local/bin/maxlogins.pl</p></blockquote>
<p>/etc/syslog.conf に以下を挿入する。</p>
<blockquote><p>auth.info;authpriv.info /var/log/auth.log       # ←この行の次に<br />
auth.info;authpriv.info |exec /usr/local/bin/maxlogins.pl  # ←この行を追加</p></blockquote>
<p>このmaxlogins.pl にはオプションを追加指定できる。</p>
<blockquote><p>-e: アクセス禁止の解除時間の指定。デフォルトは12時間。</p></blockquote>
<blockquote><p>-e=1d, -e=24h, -e=1440m, -e=86400s という感じで指定する。この場合いづれも1日の意味。</p></blockquote>
<p>-a: IPアドレスがブロックされるまでの最大試行回数。 デフォルトは3回。</p>
<blockquote><p>-a=5 という風に指定する。</p></blockquote>
<p>-l: ログレベルの指定。 ログはデフォルトで /var/log/auth.logに記録される。</p>
<blockquote><p>-l=1: informational (e.g., new blocks)<br />
-l=2: above, plus IP expirations<br />
-l=9: verbose logging</p></blockquote>
<p>/etc/hosts.allow をいじって「アクセス禁止のIPアドレスリスト」を読み込むようにする。</p>
<blockquote><p>#ALL : ALL : allow<br />
sshd : 127.0.0.1 : allow<br />
sshd : /var/log/maxlogins : deny<br />
sshd : ALL : allow</p></blockquote>
<p>ちなみに、これをやったらpopとかimapとかの設定も忘れずに。</p>
<blockquote><p>ftpd : localhost : allow<br />
ftpd : ALL : allow<br />
ipop3d : ALL : allow<br />
imapd : localhost : allow<br />
imapd : ALL : deny</p></blockquote>
<p>最後に、 syslog を再起動。</p>
<blockquote><p># kill -HUP (syslogのpid)</p></blockquote>
<p>ブロックされたIPアドレスは /var/log/maxlogins に記録される。</p>
<p>参考リンク： <a href="http://yoosee.net/d/archives/2005/11/08/002.html">1</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.masashi.org/blog/2006/11/27/freebsd-sshd-hostsallow/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FreeBSD Memo</title>
		<link>http://www.masashi.org/blog/2006/05/02/freebsd-memo/</link>
		<comments>http://www.masashi.org/blog/2006/05/02/freebsd-memo/#comments</comments>
		<pubDate>Tue, 02 May 2006 05:29:49 +0000</pubDate>
		<dc:creator>Masashi</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[sshd]]></category>

		<guid isPermaLink="false">http://www.masashi.org/blog/archives/123</guid>
		<description><![CDATA[FreeBSD 5.5β4-i3866.1-RC1-i386をDELL SC430にインストール。
インストール後に真っ先に設定したのはsshd_config。
TeraTERM+ttsshでそのまま使いたいのでsshd [...]]]></description>
			<content:encoded><![CDATA[<p class="storycontent">FreeBSD <strike>5.5β4-i386</strike>6.1-RC1-i386をDELL SC430にインストール。</p>
<p>インストール後に真っ先に設定したのはsshd_config。</p>
<p>TeraTERM+ttsshでそのまま使いたいのでsshd_configに</p>
<blockquote><p>Protocol 2,1<br />
PasswordAuthentication yes</p></blockquote>
<p>を追加。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.masashi.org/blog/2006/05/02/freebsd-memo/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
