Linux IPCHAINS-HOWTO <author>Rusty Russell <date>v1.0.8, Tue Jul 4 14:20:53 EST 2000 <trans>日本語訳: JF Project (<tt>jf@linux.or.jp</tt>) <tdate>v1.0.1j Nov. 21, 2000 <abstract> <!-- This document aims to describe how to obtain, install and configure the enhanced IP firewalling chains software for Linux, and some ideas on how you might use them. --> この文書は、Linux 向けの拡張された IP ファイアウォーリングチェインソフ トウェアをどのように入手し、インストールし、設定し、そして、これを活用 するアイディアの幾つかを詳述することを目的とします。 </abstract> <!-- Table of contents --> <toc> <!-- Begin the document --> <!-- <sect>Introduction --> <sect>始めに<label id="intro"> <p> <!-- This is the Linux IPCHAINS-HOWTO; see <ref id="intro-where" name="Where?"> for the master site, which contains the latest copy. You should read the Linux NET-3-HOWTO as well. The IP-Masquerading HOWTO, the PPP-HOWTO, the Ethernet-HOWTO and the Firewall HOWTO might make interesting reading. (Then again, so might the alt.fan.bigfoot FAQ). --> この文書は IPCHAINS-HOWTO です。最新版があるマスターサイトは <ref id="intro-where" name="どこ?"> を参照して下さい。 LINUX NET-3-HOWTO も読んだ方がよいでしょう。 IP-Masquerading HOWTO, PPP-HOWTO, Ethernet-HOWTO と Firewall HOTO も面白いでしょう。 (そして、繰り返しますが、 alt.fan.bigfoot FAQ も)。 (訳注: alt.fan.bigfoot FAQ <- [雪男のニュースグループ、ギャグ?]) <p> <!-- If packet filtering is passe to you, read Section <ref id="intro-why" name="Why?">, Section <ref id="basics-how" name="How?">, and scan through the titles in Section <ref id="core" name="IP Firewalling Chains">. --> パケットフィルタリングについて既に知っている人は、 <ref id="intro-why" name="なぜ?"> の章、 <ref id="basics-how" name="どうやって?"> の章 を読んで、 <ref id="core" name="IP ファイアウォーリングチェイン"> の章の中のタイトルをざっと眺めてみましょう。 <p> <!-- If you are converting from <tt>ipfwadm</tt>, read Section <ref id="intro" name="Introduction">, Section <ref id="basics-how" name="How?">, and Appendices in section <ref id="ipfwadm-diff" name="Differences between ipchains and ipfwadm"> and section <ref id="upgrade" name="Using the `ipfwadm-wrapper' script">. --> <tt>ipfwadm</tt> から移行したい人は、 <ref id="intro" name="始めに"> の章、 <ref id="basics-how" name="どうやって?"> の章、 そして付録内の <ref id="ipfwadm-diff" name="ipchains と ipfwadm との違い"> の章と、 <ref id="upgrade" name="`ipfwadm-wrapper' スクリプトを使う"> の章を読みましょう。 <!-- <sect1>What? --> <sect1>何? <p> <!-- Linux <tt>ipchains</tt> is a rewrite of the Linux IPv4 firewalling code (which was mainly stolen from BSD) and a rewrite of <tt>ipfwadm</tt>, which was a rewrite of BSD's <tt>ipfw</tt>, I believe. It is required to administer the IP packet filters in Linux kernel versions 2.1.102 and above. --> Linux <tt>ipchains</tt> は Linux IPv4 ファイアウォーリングのコード (主に BSD からのパクリ)の書き直しであり、<tt>ipfwadm</tt> の書き直しでもあります。 その <tt>ipfwadm</tt> は、 BSD の <tt>ipfw</tt> の書き直しでもあると、私は信じています。 Linux バージョン 2.1.102 以降の IP パケットフィルタが、管理に必要です。 <!-- <sect1>Why?<label id="intro-why"> --> <sect1>なぜ?<label id="intro-why"> <p> <!-- The older Linux firewalling code doesn't deal with fragments, has 32-bit counters (on Intel at least), doesn't allow specification of protocols other than TCP, UDP or ICMP, can't make large changes atomically, can't specify inverse rules, has some quirks, and can be tough to manage (making it prone to user error). --> 以前の Linux のファイアウォールのコードは fragment を扱えませんし、 (少なくとも Intel 用では) 32 ビットのカウンタしかありませんし、 TCP/UDP/ICMP 以外の仕様のプロトコルを考慮していませんし、 アトミック(瞬間的)に大きく(ルールを)変更することもできませんし、 逆ルールを満たせませんし、 いくつか妙な癖がありましたし、 管理しにくいものでした(利用者のミスを招きやすい)。 (訳注: ここで用いられる「アトミック(原文は `atomically')」は、 ipchains というコマンドの名前の由来にもなっているところだと思います。 ユーザ定義チェインに複数のルールを定義しておき、それを既存のチェインに追加したり、或は既存のチェインを新しく定義したチェインと置換することで、一瞬にしてファイアウォールの作用を変更することができます。) <!-- <sect1>How? --> <sect1>どうすれば? <p> <!-- Currently the code is in the mainstream kernel from 2.1.102. For the 2.0 kernel series, you will need to download a kernel patch from the web page. If your 2.0 kernel is more recent than the supplied patch, the older patch should be OK; this part of the 2.0 kernels is fairly stable (eg. the 2.0.34 kernel patch works just fine on the 2.0.35 kernel). Since the 2.0 patch is incompatible with the ipportfw and ipautofw patches, I don't recommend applying it unless you really need some functionality that ipchains offers. --> 現在、カーネルのコードの主流は 2.1.102 以降です。 2.0 カーネルシリーズでは、 web ページからパッチをダウンロードする必要があります。 もし、お手持ちの 2.0 カーネルが web 上にて得られるパッチよりも新しいならば、その古いパッチは多分 OK でしょう。 2.0 カーネルの該当部分はおおよそ安定しています。(例えば、 2.0.34 カーネルのパッチは 2.0.35 カーネルにもしっかり当てられます) 2.0 パッチは ipportfw と ipautofw パッチとの互換性がないので、 ipchains 特有の機能を本当に必要としないならば、パッチの導入はお薦めしません。 <!-- <sect1>Where?<label id="intro-where"> --> <sect1>どこ?<label id="intro-where"> <p> <!-- The official page is in three places: <url url="http://netfilter.filewatcher.org/ipchains" name="Thanks to Penguin Computing"> <url url="http://www.samba.org/netfilter/ipchains" name="Thanks to the SAMBA Team"> <url url="http://netfilter.kernelnotes.org/ipchains" name="Thanks to Jim Pick"> --> 公式ページは3箇所あります。 <url url="http://netfilter.filewatcher.org/ipchains" name="Penguin Computing に感謝します。"> <url url="http://www.samba.org/netfilter/ipchains" name="the SAMBA Team に感謝します。"> <url url="http://netfilter.kernelnotes.org/ipchains" name="Jim Pick に感謝します。"> <p> <!-- There is a mailing list for bug reports, discussion, development and usage. Join the mailing list by sending a message containing the word ``subscribe ipchains-list'' to subscribe at east.balius.com. To mail to everyone on the list use ipchains-list at east.balius.com. --> バグ報告、議論、開発、使い方を話し合うメーリングリストがあります。 メーリングリストへの入会には、メッセージに ``subscribe ipchains-list'' を書いて、 east.balius.com にメールして下さい。 メーリングリストのメンバー全員にメールを出すには、 east.balius.com の ipchains-list を使って下さい。 <!-- 1章ここまでby松田 --> <!-- 2章ここからby後藤 --> <!-- Draft 1: Oct.2.2000 --> <!-- Dfaft 2: Nov.8.2000 Linux 2.4 Packet Filtering HOWTOでの訳を参考にした。 山森 浩幸(h-yamamo@db3.so-net.ne.jp) さんに感謝 :) コメントは、 MATSUDA Yoh-ichi / 松田陽一 <yoh@coolmail.net> さんからも。 --> <!-- Draft 3: コメントをいただいた方 Setoguchi Takashi <setzer@mx3.tiki.ne.jp> --> <!-- <sect>Packet Filtering Basics --> <sect>パケットフィルタリングの基礎 <!-- <sect1>What? --> <sect1>パケットフィルタとは何をするもの? <p> <!-- All traffic through a network is sent in the form of <bf>packets</bf>. For example, downloading this package (say it's 50k long) might cause you to receive 36 or so packets of 1460 bytes each, (to pull numbers at random). --> ネットワークを通る全てのトラフィックは、パケットの形で送り出されます。 例えば、このパッケージ(50Kバイトはあるでしょう)をダウンロードすることで、1460バイトのパケット36個ほどを受信することになるでしょう(実際にはそのときどきによって個数やサイズは異なります)。 (訳注: 現在ではこの文書は100KBを越えています:)) <p> <!-- The start of each packet says where it's going, where it came from, the type of the packet, and other administrative details. This start of the packet is called the <bf>header</bf>. The rest of the packet, containing the actual data being transmitted, is usually called the <bf>body</bf>. --> 各パケットはそれがどこに向けられたものかを記述する部分から始まり、どこから来たものか、それからパケットの種類と管理上必要な詳細内容を含んでいます。 パケットのこの開始部分は、<bf>ヘッダ</bf>と呼ばれています。また、伝送されている実際のデータを含んだパケットの残りの部分は、通常<bf>ボディ</bf>と呼ばれています。 <p> <!-- Some protocols, such <bf>TCP</bf>, which is used for web traffic, mail, and remote logins, use the concept of a `connection' -- before any packets with actual data are sent, various setup packets (with special headers) are exchanged saying `I want to connect', `OK' and `Thanks'. Then normal packets are exchanged. --> <!-- Draft 1: ウェブ・トラフィック、メールとリモートログインのために使われるいくつかのプロトコル(例えば <bf>TCP</bf>)は `接続(コネクション)' とよばれる概念を使います。実際のデータパケットが送り出される前に、 `私は、接続したい'、`OK'、そして`ありがとう'といった色々なセットアップ・パケットを(特別なヘッダで)交換します。 --> <!-- Reflect comments from: MATUDA Yoh-ichi / 松田陽一 <yoh@coolmail.net> --> ウェブ・トラフィック、メールとリモートログインのために使われるいくつかのプロトコル(例えば <bf>TCP</bf>)は `接続(コネクション)'とよばれる概念を使います。 実際のデータパケットが送り出される前に、`私は、接続したい'、`OK'、そして`ありがとう'といった、(特別なヘッダを伴う)色々なセットアップ・パケットを交換します。 <p> <!-- A packet filter is a piece of software which looks at the <em>header</em> of packets as they pass through, and decides the fate of the entire packet. It might decide to <bf>deny</bf> the packet (ie. discard the packet as if it had never received it), <bf>accept</bf> the packet (ie. let the packet go through), or <bf>reject</bf> the packet (like deny, but tell the source of the packet that it has done so). --> パケット・フィルタは、パケットの<em>ヘッダ</em>を見て、そのパケット全体をどのように取り扱うかを決定する小さなソフトウェアです。パケットは<bf>拒否(deny)</bf>(すなわち、受信しなかったかのように、パケットを捨てる)ことに決められるかもしれないし、<bf>許可(accept)</bf>(すなわち、パケットを通過させる)することになるかもしれないし、パケットを<bf>返却(reject)</bf>("拒否"と似ているけれど、パケットの発信元にそのことを通知する)するかもしれません。 <p> <!-- Under Linux, packet filtering is built into the kernel, and there are a few trickier things we can do with packets, but the general principle of looking at the headers and deciding the fate of the packet is still there. --> Linux においては、パケット・フィルタリングはカーネルに組み込まれています。 そして、パケットの取扱いに関して少しばかりトリックを仕掛けることができますが、その基本的な規則はあくまでヘッダを見て、パケットの取り扱いを決定するというものです。 <!-- <sect1>Why? --> <!-- <sect1>パケットフィルタはなぜ必要か? --> <!-- modified by [yoh] <yoh@coolmail.net> --> <sect1>なぜ? <p> <!-- Control. Security. Watchfulness. --> <!-- Draft 1 制御のため、セキュリティのため、用心のため --> コントロール。セキュリティ。監視。 <p> <descrip> <!-- <tag/Control:/ when you are using a Linux box to connect your internal network to another network (say, the Internet) you have an opportunity to allow certain types of traffic, and disallow others. For example, the header of a packet contains the destination address of the packet, so you can prevent packets going to a certain part of the outside network. As another example, I use Netscape to access the Dilbert archives. There are advertisements from doubleclick.net on the page, and Netscape wastes my time by cheerfully downloading them. Telling the packet filter not to allow any packets to or from the addresses owned by doubleclick.net solves that problem (there are better ways of doing this though). --> <!-- Draft 1 <tag/制御のため:/ あなたの内部ネットワークにもう一つのネットワーク(インターネット)を接続するために Linux ボックスを使っているならば、あなたに特定の種類のトラフィックを許して、それ以外を禁止するための機会があります。例えば、パケットのヘッダはパケットの行き先アドレスを含むので、あなたは外部のネットワークの特定の部分へ送り出されるパケットを禁止することができます。もう一つ例として、私はDilbertアーカイブにアクセスするためにNetscape を使います。そのアーカイブページにはdoubleclick.netからの広告がページにあり、そして、Netscapeはそれらを無邪気にもダウンロードして私の時間を浪費してくれます。そこで、パケットフィルタにdoubleclick.netによって所有されるアドレスに対してパケットの送受を許さないように設定すれば、その問題を解決することができます(実際にはもっと良い方法があります)。 --> <tag/コントロール:/ あなたが Linux ボックスを内部のネットワークと別のネットワーク(例えば、インターネット)を繋ぐために使っているなら、 あなたには、特定のトラフィックだけ許可して、他のものを許さないようにするチャンスがあります。 例えば、パケットのヘッダーにはあて先アドレス が含まれていて、外部ネットワークのとある所へ向かうパケットを拒否する ことができます。 別の例として、Netscape を使って Dilbert のアーカイブ (訳注: Dilbert というエンジニアが主人公の風刺漫画のサイト、ちなみに dilbert の意味は'ばか') にアクセスする場合です。 ページには doubleclick.net の広告があり、 Netscape はそれをいそいそとダウンロードするために私の時間を浪費します。 パケットフィルターに doubleclick.net 所有のアドレスからのどんなパケットも許可しないように指示すれば問題は解決します(もっといい方法がありますけれど: Junkbuster (訳注: <url url="http://internet.junkbuster.com" name="http://internet.junkbuster.com"> ) を見て下さい)。 <!-- <tag/Security:/ when your Linux box is the only thing between the chaos of the Internet and your nice, orderly network, it's nice to know you can restrict what comes tromping in your door. For example, you might allow anything to go out from your network, but you might be worried about the well-known `Ping of Death' coming in from malicious outsiders. As another example, you might not want outsiders telnetting to your Linux box, even though all your accounts have passwords; maybe you want (like most people) to be an observer on the Internet, and not a server (willing or otherwise) -- simply don't let anyone connect in, by having the packet filter reject incoming packets used to set up connections. --> <!-- Draft 1 <tag/セキュリティのため:/ あなたのLinuxボックスが、混沌としたインターネットと、あなたの素敵な秩序正しいネットワークの間に位置する唯一のものであるとき、あなたのドアを越えて野蛮に入り込むものを制限することができるということを知るのはすばらしいことです。例えば、あなたのネットワークから出ていくトラフィックはすべて許可するでしょうが、その一方で、あなたは悪意のある部外者からうける"死のping"については気になることでしょう。もう一つの例としては、たとえ全てのあなたのすべてのアカウントがパスワードによって保護されているとしても、あなたのLinuxボックスにtelnetで接続しようとしてくる部外者を望まないことでしょう。しかし、多分、あなたは(大部分の人々のように)あくまでインターネットを見ることのみを必要としており、望むか望まざるかにかかわらずサーバの監視者でありたいとは思わないでしょう。ならば、パケット・フィルタで接続のセットアップに使われるパケットを拒絶させることで、誰も接続できないようにしてしまうことです。 --> <tag/セキュリティ:/ あなたの Linux ボックスがインターネットの混沌と、秩序正しいあなたのすてきなネットワークの間にある唯一の物なら、すばらしいことに、あなたは殴りにやって来る者をドアのところで制限することができます。 例えば、あなたのネットワークから出て行くものは何でも許すようにして、悪意のある外部からのよく知られた `Ping of Death' 攻撃を警戒するようにできます。 別の例として、あなたの Linux ボックスに、たとえ全てのアカウントにパスワードが付いているとしても、外部の者が telnet してくることを望まないかもしれません。 たぶん、あなたは(大抵の人々のように)インターネットをただ眺めていたいだけで、サーバーに(好むと好まずにかかわらず)なりたくないのです。 単純に、パケットフィルターで接続を開始するパケットの流入を拒否して、だれにも接続されないようにして下さい。 (訳注: "死のping" 異常に長大な ICMP パケットなどをネットワーク接続されたコンピュータに送りつけて、システムクラッシュやサービスの停止を引き起こす攻撃のこと。) <!-- ToDo "Ping of death"の意味再確認 --> <!-- <tag/Watchfulness:/ sometimes a badly configured machine on the local network will decide to spew packets to the outside world. It's nice to tell the packet filter to let you know if anything abnormal occurs; maybe you can do something about it, or maybe you're just curious by nature. --> <!-- Draft 1 <tag/用心のため:/ 時々、誤って構成されたマシンが、ローカルネットワークの外部にパケットを出してしまう場合があります。 何か異常が発生していないかを知らせるようにパケット・フィルタを設定することは有益です。この仕掛けによって何らかの対策をとることもでき、本来とは違った奇妙な振る舞いが発生していることを知ることができます。 --> <!-- Draft 2 ときどきローカルネットワーク中に環境設定の悪いマシンがあり、 外の世界にパケットが漏れ出るようになっていることがあります。 すばらしいことに、パケットフィルターは何か異常なことが起こったときにあなたに知らせてくれます。たぶんあなたは何らかの対処ができるでしょうし、あるいはあなたの性格的なものから、単に興味を持つだけかもしれません。 --> <tag/監視:/ ときどきローカルネットワーク中に環境設定の悪いマシンがあり、外の世界にパケットが漏れ出るようになっていることがあります。 すばらしいことに、パケットフィルターは何か異常なことが起こったときにあなたに知らせてくれます。 それによって何らかの対処ができることを知るか、あるいはただ単に自分が詮索好きな性格だと知るだけかもしれません。 </descrip> <!-- <sect1>How?<label id="basics-how"> --> <!-- <sect1>どのようにしてパケットフィルタリングできるようにするか?<label id="basics-how"> --> <!-- modified by [yoh] <yoh@coolmail.net> --> <sect1> どうやって?<label id="basics-how"> <!-- <sect2>A Kernel With Packet Filtering --> <sect2>パケットフィルタリング機能を有効にしたカーネル <p> <!-- You need a kernel which has the new IP firewall chains in it. You can tell if the kernel you are running right now has this installed by looking for the file `/proc/net/ip_fwchains'. If it exists, you're in. --> 新しい IP ファイアウォール・チェーン機能を持つカーネルが必要です。今動作しているカーネルが、この機能を組み込んだものかどうか判断するには、 /proc/net/ip_fwchains を探してみましょう。 これが存在するならば、既に組み込まれています。 (訳注: 2.2.x以降のカーネルをお使いの場合は、大抵既に組み込まれていることでしょう。) <p> <!-- If not, you need to make a kernel that has IP firewall chains. First, download the source to the kernel you want. If you have a kernel numbered 2.1.102 or higher, you won't need to patch it (it's in the mainstream kernel now). Otherwise, apply the patch from the web page listed above, and set the configuration as detailed below. If you don't know how to do this, don't panic -- read the Kernel-HOWTO. --> もしそうでなければ、あなたは IP ファイアウォール・チェーンを持つカーネルを作る必要があります。 最初に、あなたが欲しいカーネルのソースをダウンロードしましょう。あなたのカーネルが バージョン 2.1.102 以降のものなら、現在主流のカーネルであるので、改めてパッチを当てる必要はありません。 そうでない時には前出の Web ページからパッチを入手して適用し、そして次に示すような設定でカーネルを構成して下さい。もし、あなたがこれをする方法を知らなくても、慌てないで Kernel-HOWTO を読みましょう。 (訳注: Kernel-HOWTOの邦訳は <url url="http://www.linux.or.jp/JF/JFdocs/Kernel-HOWTO.html" name="http://www.linux.or.jp/JF/JFdocs/Kernel-HOWTO.html"> にあります。) <p> <!-- The configuration options you will need to set <em>for the 2.0-series kernel</em> are: --> あなたが<em>2.0-シリーズのカーネル</em>に設定する必要があるコンフィグレーションオプションは、以下の通りです: <code> CONFIG_EXPERIMENTAL=y CONFIG_FIREWALL=y CONFIG_IP_FIREWALL=y CONFIG_IP_FIREWALL_CHAINS=y </code> <!-- For the <em>2.1 or 2.2 series kernels</em>: --> <em>2.1 か 2.2 のシリーズ・カーネル</em>の場合は次の通りです: <code> CONFIG_FIREWALL=y CONFIG_IP_FIREWALL=y </code> <p> <!-- The tool <tt>ipchains</tt> talks to the kernel and tells it what packets to filter. Unless you are a programmer, or overly curious, this is how you will control the packet filtering. --> ツールである <tt>ipchains</tt> プログラムは、カーネルに対してどんなパケットをフィルタするべきかについて通知するためのものです。あなたがプログラマであるか、奇特な人間でない限り、これがパケットフィルタリングを制御する方法となります。 <sect2> ipchains <p> <!-- The <tt>ipchains</tt> tool inserts and deletes rules from the kernel's packet filtering section. This means that whatever you set up, it will be lost upon reboot; see <ref id="permanent" name="Making Rules Permanent"> for how to make sure they are restored the next time Linux is booted. --> <tt>ipchains</tt> ツールは、カーネルのパケット・フィルタリングに関するセクションからルールを挿入したり削除したりします。 これは、あなたがたとえ何を設定しても、それが再起動によって消えてしまうことを意味しています。 <!-- Draft 1 Linuxがブートされる次のとき、それらを確実に戻すする方法については次の節 <ref id="permanent" name="フィルタ規則を恒久的にするには""> を参照して下さい。 --> <!-- Reflcet comments from: MATSUDA Yoh-ichi / 松田陽一 <yoh@coolmail.net> --> 次回、 Linux がブートされる際に、それらを確実に戻すする方法については、次の節 <ref id="permanent" name="フィルタ規則を恒久的にするには"> を参照して下さい。 <p> <!-- <tt>ipchains</tt> replaces <tt>ipfwadm</tt>, which was used for the old IP Firewall code. There is a set of useful scripts available from the ipchains ftp site: --> <!-- Draft 2 <tt>ipchains</tt>は以前までIPファイアウオールを実現するために使われていた<tt>ipfwadm</tt>と置き換えられることになります。役に立つスクリプトのセットが、次のipchainsのFTPサイトから入手可能です: --> <tt>ipchains</tt> は以前までIPファイアウォールを実現するために使われていた ipfwadm と置き換えられることになります。 役に立つスクリプトのセットが、次の ipchains のアドレスから入手可能です: <url url="http://netfilter.filewatcher.org/ipchains/ipchains-scripts-1.1.2.tar.gz" name="http://netfilter.filewatcher.org/ipchains/ipchains-scripts-1.1.2.tar.gz"> <!-- This contains a shell script called <tt>ipfwadm-wrapper</tt> which allows you to do packet filtering as it was done before. You probably shouldn't use this script unless you want a quick way of upgrading a system which uses <tt>ipfwadm</tt> (it's slower, and doesn't check arguments, etc). In that case, you don't need this HOWTO much either. --> これには以前行われていたのと同じようなスタイルでパケット・フィルタリングを行わせるための <tt>ipfwadm-wrapper</tt> と呼ばれているシェルスクリプトを含んでいます。 あなたが <tt>ipfwadm</tt> (ipchainsと比べ、より遅くて、引数、その他をチェックしない等のもの)を使うシステムをアップグレードする手っ取り早い方法が欲しくない限り、あなたは多分このスクリプトを使うべきではないでしょう。 そういう方にはあまりこの HOWTO も必要とはされないことと思います。 <!-- See Appendix <ref id="ipfwadm-diff" name="Differences between ipchains and ipfwadm"> and Appendix <ref id="upgrade" name="Using the `ipfwadm-wrapper' script"> for more details on <tt>ipfwadm</tt> issues. --> <!-- Draft 1 <tt>ipfwadm</tt>関連の詳細については、付録: <ref id="ipfwadm-diff" name="ipchainsとipfwadmの差分"> や付録: <ref id="upgrade" name="`ipfwadm-wrapper'スクリプトを使うには"> をご覧下さい。 --> <!-- Reflect comment from: MATSUDA Yoh-ichi / 松田陽一 <yoh@coolmail.net> --> <tt>ipfwadm</tt> 関連の詳細については、付録: <ref id="ipfwadm-diff" name="ipchains と ipfwadm との違い"> や付録: <ref id="upgrade" name="`ipfwadm-wrapper'スクリプトを使う"> をご覧下さい。 <!-- ToDo 付録に対する見出しの一致を確認すべし--> <!-- <sect2> Making Rules Permanent<label id="permanent"> --> <sect2> フィルタ規則を恒久的にするには<label id="permanent"> <!-- <p>Your current firewall setup is stored in the kernel, and thus will be lost on reboot. I recommend using the `ipchains-save' and `ipchains-restore' scripts to make your rules permanent. To do this, set up your rules, then run (as root): --> <p>あなたの現在のファイアウォール設定は、カーネルに格納されて、このように再起動時には失われてしまいます。 あなたのルールを恒久的にするために `ipchains-save' と `ipchains-restore' スクリプトを使うことをお勧めします。 これを使うには、まずあなたのルールを設定して、次のようにコマンドを実行します(root として実行して下さい): <tscreen><verb> # ipchains-save > /etc/ipchains.rules # </verb></tscreen> <!-- Create a script like the following: --> スクリプトは次のように作っておきます: <!-- <tscreen><verb> #! /bin/sh # Script to control packet filtering. # If no rules, do nothing. [ -f /etc/ipchains.rules ] || exit 0 case "$1" in start) echo -n "Turning on packet filtering:" /sbin/ipchains-restore < /etc/ipchains.rules || exit 1 echo 1 > /proc/sys/net/ipv4/ip_forward echo "." ;; stop) echo -n "Turning off packet filtering:" echo 0 > /proc/sys/net/ipv4/ip_forward /sbin/ipchains -F /sbin/ipchains -X /sbin/ipchains -P input ACCEPT /sbin/ipchains -P output ACCEPT /sbin/ipchains -P forward ACCEPT echo "." ;; *) echo "Usage: /etc/init.d/packetfilter {start|stop}" exit 1 ;; esac exit 0 </verb></tscreen> --> <tscreen><verb> #! /bin/sh # パケットフィルタ制御のためのスクリプト # ルールがなければ何もしない [ -f /etc/ipchains.rules ] || exit 0 case "$1" in start) echo -n "Turning on packet filtering:" /sbin/ipchains-restore < /etc/ipchains.rules || exit 1 echo 1 > /proc/sys/net/ipv4/ip_forward echo "." ;; stop) echo -n "Turning off packet filtering:" echo 0 > /proc/sys/net/ipv4/ip_forward /sbin/ipchains -F /sbin/ipchains -X /sbin/ipchains -P input ACCEPT /sbin/ipchains -P output ACCEPT /sbin/ipchains -P forward ACCEPT echo "." ;; *) echo "Usage: /etc/init.d/packetfilter {start|stop}" exit 1 ;; esac exit 0 </verb></tscreen> <!-- Make sure this is run early in the bootup procedure. In my case (Debian 2.1), I make a symbolic link called `S39packetfilter' in the `/etc/rcS.d' directory (this will be run before S40network). --> これが起動時の最初のうちに実行されるようにします。筆者のケース (Debian 2.1) では、 `S39packetfilter' というシンボリックリンクを `/etc/rcS.d' ディレクトリに作ってあります(これは、 S40network の前に実行されます)。 (訳注: 「最初のうち」というのは、起動時、ネットワークに対して通信が可能となる状態以前に行うという意味です。 ネットワークの他のサービスなどが起動したあとにファイアウオールを設定すると、全く設定されていないわずかな瞬間をついて"悪いやつ"が入り込む危険性があります。) <!-- 2章ここまでby後藤 --> <!-- 3章ここからby後藤 --> <!-- Draft 1:10.Oct. 2000 --> <!-- Draft 2:8.Nov. 2000 --> <!-- Comments from: Yuji Senda <ysenda@pop01.odn.ne.jp> TAKEI Nobumitsu <takei@webmasters.gr.jp> mizuhara@acm.org (MIZUHARA Bun) --> <!-- Draft 3: 9.Nov. 2000 Hiroyuki YAMAMORI <h-yamamo@db3.so-net.ne.jp> --> <!-- <sect>I'm confused! Routing, masquerading, portforwarding, ipautofw... --> <sect>もう、混乱して来た! ルーティングだの、マスカレーディングだの、ポートフォワーディングだの、自動フォワーディング(ipautofw)だのって…。 <p> <!-- This HOWTO is about packet filtering. This means deciding whether a packet should be allowed to pass or not. However, Linux being the hacker's playground that it is, you probably want to do more than that. --> この HOWTO は、パケット・フィルタリングについて述べたものです。 それはパケットが通過するのを許すかどうかについて決めることを意味しています。 しかしながら、Linuxはいわばハッカー達の遊び場のようなものですので、おそらくそれ以上の機能を実現したいと思うことでしょう。 <p> <!-- One problem is that the same tool (``ipchains'') is used to control both masquerading and transparent proxying, although these are notionally separate from packet filtering (the current Linux implementation blurs these together unnaturally, leaving the impression that they are closely related). --> 1つの問題は、本来別な概念であるはずのマスカレーディングと透過的なプロキシの制御のために同じツール (``ipchains'') が使われることです(現在の Linux での実装では、これらが不自然なかたちでいっしょになっており、あたかもそれらが密接に関連があるという印象を与えてしまいます)。 (訳注: カーネル 2.4.x 系では、これらの機能はさらに統合強化されています。 それらのカーネルをお使いの方は、Linux 2.4 NAT HOWTO(<url url="http://netfilter.kernelnotes.org/unreliable-guides/NAT-HOWTO.html" name="http://netfilter.kernelnotes.org/unreliable-guides/NAT-HOWTO.html">)もご覧下さい。 JFプロジェクトによる邦訳(<url url="http://www.linux.or.jp/JF/JFdocs/NAT-HOWTO.html" name="http://www.linux.or.jp/JF/JFdocs/NAT-HOWTO.html">)もあります。) <p> <!-- Masquerading and proxying are covered by separate HOWTOs, and the auto forwarding and port forwarding features are controlled by separate tools, but since so many people keep asking me about it, I'll include a set of common scenarios and indicate when each one should be applied. The security merits of each setup will not be discussed here. --> マスカレーディングとプロキシについては別々の HOWTO 文書などによって網羅され、自動フォワーディングとポート・フォワーディング機能は別々のツールで制御されます。しかし、多くの人々からそれらについての問い合わせをうけていますので、ここでは一連の一般的とおもわれるシナリオいくつかと、どのようにすればよいかという設定を提示します。なお、各セットアップのセキュリティに関する長所については、ここで論議しません。 <!-- <sect1>Rusty's Three-Line Guide To Masquerading --> <sect1>Rusty のマスカレーディングに関する 3つの指針 <p> <!-- This assumes that your <bf>external</bf> interface is called `ppp0'. Use ifconfig to find out, and adjust to taste. --> これは、あなたの<bf>外部</bf>インタフェースが `ppp0' であると仮定しています。 ifconfig コマンドをつかって、あなたの環境に合うように読み替えて下さい。 <tscreen><verb> # ipchains -P forward DENY # ipchains -A forward -i ppp0 -j MASQ # echo 1 > /proc/sys/net/ipv4/ip_forward </verb></tscreen> <!-- <sect1>Gratuitous Promotion: WatchGuard Rules --> <!-- Draft 1 3.2 WatchGuardに関して --> <!-- Reflect comments from : Yuji Senda <ysenda@pop01.odn.ne.jp> --> <sect1>自発的な宣伝: WatchGuard で規制する <!-- ToDo 原文では"Gratitutous Promotion"となっています。筆者がWatchGurad社に対して、特に利益供与をうけた上でこれを勧めているのではないというニュアンスと解釈しています --> <p> <!-- You can buy off-the-shelf firewalls. An excellent one is WatchGuard's FireBox. It's excellent because I like it, it's secure, it's Linux-based, and because they funded the maintenance of ipchains as well as the new firewalling code (for 2.4). In short, WatchGuard were paying for me to eat while I work for you. So please consider their stuff. --> <!-- Draft 1 市販のファイアウォール専用機を手にいれることもできます。それらのうち優れたものの 一つは、WatchGuard社のFireBoxです。それはLinuxベースで動作し、安全であり、 またこの会社は新しいファイアウォールのコード(2.4系カーネル用)を提供するだけでなく、 ipchainsプログラムのメンテナンスのために貢献しているということもあって、私は気に 入っています。いわば私が皆さんのために作業している間、WatchGuard社は企業営利を 目的として私に投資していたことになります。そのあたりの事情も考慮しておいて下さい。 --> <!-- Reflect comments from : Yuji Senda <ysenda@pop01.odn.ne.jp> --> 市販のファイアウォール専用機を購入することもできます。 優れた専用機のひとつとして、WatchGuard 社の FireBox があります。 FireBox が優れていると思うのは、わたしが気に入っているからであり、それが安全だからであり、Linux ベースで動作しているからです。 また、この会社は、ipchains のメインテナンスと、(2.4 系カーネル用の)新しいファイアウォールのコードのために資金提供してくれたからです。 つまり、わたしが皆さんのために作業をしている間、 WatchGuard 社は、わたしの生活を支えてくれたわけです。 そういうわけで、彼らの製品についても御一考願います。 <url url="http://www.watchguard.com" name="http://www.watchguard.com"> (訳注: WatchGuard社の日本国内のリセラーも、このページから手繰ることができます。) <!-- <sect1>Common Firewall-like Setups --> <sect1>ファイアウォール的動作に共通な設定 <p> <!-- You run littlecorp.com. You have an internal network, and a single dialup (PPP) connection to the Internet (firewall.littlecorp.com which is 1.2.3.4). You run Ethernet on your local network, and your personal machine is called "myhost". --> あなたは、 littlecorp.com というドメイン名でシステムを動かしています。 そして内部ネットワークを持ち、インターネットに対して、IPアドレスが 1.2.3.4 である (firewall.littlecorp.com) というコンピュータに1回線のダイヤルアップ(PPP)コネクションを持っています。 あなたはイーサネットによるローカルネットワークを構築しており、あなたの個人用コンピュータは "myhost" と呼ばれています。 <p> <!-- This section will illustrate the different arrangement which are common. Read carefully, because they are each subtly different. --> このセクションでは、一般的とおもわれるいくつかの配置例での設定について詳しく説明します。 それらは微妙に異なりますので、注意深く読み進めて下さい。 <!-- <sect2>Private Network: Traditional Proxies --> <sect2>ローカルネットワーク: 伝統的なプロキシ <p> <!-- In this scenario, packets from the private network never traverse the Internet, and vice versa. The IP addresses of the private network should be assigned from the RFC1918 Address Allocation for Private Internets (ie. 10.*.*.*, 172.16.*.*-172.31.*.* or 192.168.*.*). --> このシナリオでは、ローカルネットワークからのパケットは、インターネットを行き来することはありません。 ローカルネットワークの IP アドレスは、 RFC1918 にてプライベートなインターネット環境のために用意されているアドレス(すなわち 10.*.*.*, 172.16.*.*-172.31.*.* または 192.168.*.*)を割り当てなければなりません。 <p> <!-- The only way things ever connect to the Internet is by connecting to the firewall, which is the only machine on both networks which connects onwards. You run a program (on the firewall) called a proxy to do this (there are proxies for FTP, web access, telnet, RealAudio, Usenet News and other services). See the Firewall HOWTO. --> インターネットに接続する唯一の方法はファイアウォールに接続することで、このコンピュータが両方のネットワーク(訳注: インターネットとローカルネットワーク)に直接つながっています。 このファイアウォールの上でプロキシと呼ばれるソフトを動かすことになります(これは FTP 、ウェブ・アクセス、 telnet 、 RealAudio 、 Usenet News や他のサービスについて、"代理"として働きます)。 詳細については Firewall HOWTO を見ましょう。 (訳注: "Firewall HOWTO" の原文は <url url="http://www.linuxdoc.org/HOWTO/Firewall-HOWTO.html" name="http://www.linuxdoc.org/HOWTO/Firewall-HOWTO.html"> にあります。 JFプロジェクトによる邦訳はまだ作業中です。) <p> <!-- Any services you wish the Internet to access must be on the firewall. (But see <ref id="limited-services" name="Limited Internal Services"> below). --> あなたがインターネットへのアクセスで望むサービスについては、必ずファイアウォール上のプロキシでサポートされたサービスでなければなりません(しかし、後述の <ref id="limited-services" name="制限された内部サービス"> を参照して下さい)。 <p> <!-- Example: Allowing web access from private network to the Internet. --> 例: プライベートネットワークからインターネットへのウェブ・アクセスを許す <enum> <!-- <item> The private network is assigned 192.168.1.* addresses, with myhost being 192.168.1.100, and the firewall's Ethernet interface being assigned 192.168.1.1. --> <item> プライベートネットワークは、192.168.1.*を割り当てられた複数の番地からなり、IPアドレスが192.168.1.100は"myhost"に、ファイアウォールのイーサネット・インタフェースには192.168.1.1が割り当てられています。 <!-- <item> A web proxy (eg. "squid") is installed and configured on the firewall, say running on port 8080. --> <item> ウェブ・プロキシ(例えば"squid")は、ファイアウォールの上にインストールされておりポート8080で動いています。 <!-- <item> Netscape on the private network is configured to use the firewall port 8080 as a proxy. --> <item> プライベートネットワークのNetscapeは、プロキシとしてファイアウォールのポート8080を使うように設定されています。 <!-- <item> DNS does not need to be configured on the private network. --> <item> DNSは、プライベートネットワークの中で設定される必要はありません。 <!-- <item> DNS does need to be configured on the firewall. --> <item> DNSは、ファイアウォールの上で設定される必要があります。 <!-- <item> No default route (aka gateway) needs to be configured on the private network. --> <item> デフォルト・ルート(別名、ゲートウェイ)は、プライベートネットワークの中で設定される必要はありません。 </enum> <p> <!-- Netscape on myhost reads http://slashdot.org. --> myhost 上の Netscape から、 http://slashdot.org のページを見る <enum> <!-- <item> Netscape connects to the firewall port 8080, using port 1050 on myhost. It asks for the web page of "http://slashdot.org". --> <item> Netscape はファイアウォールのポート8080に接続し、 myhost 上のポート1050を使って "http://slashdot.org" のウェブ・ページを見るようにファイアウォールに依頼します。 <!-- <item> The proxy looks up the name "slashdot.org", and gets 207.218.152.131. It then opens a connection to that IP address (using port 1025 on the firewall's external interface), and asks the web server (port 80) for the web page. --> <item> プロキシは "slashdot.org" という名前を調べて、 "207.218.152.131" というIPアドレスを得ます。 それからファイアウォールの外部インタフェース(訳注: ppp0 など)の上でポート1025を使って、その IP アドレスに対してウェブ・サーバ(ポート80)でウェブ・ページを要求します。 <!-- <item> As it receives the web page from its connection to the web server, it copies the data to the connection from Netscape. --> <item> 相手のウェブ・サーバに対する接続からウェブ・ページを受け取ると、それはNetscapeへの接続へデータがコピーされます。 <!-- <item> Netscape renders the page. --> <item> Netscapeは、ページを表示します。 </enum> <!-- ie. From slashdot.org's point of view, the connection is made from 1.2.3.4 (firewall's PPP interface) port 1025 to 207.218.152.131 (slashdot.org) port 80. From myhost's point of view, the connection is made from 192.168.1.100 (myhost) port 1050, to 192.168.1.1 (firewall's Ethernet interface) port 8080. --> つまり、 slashdot.org の側から見ると、 1.2.3.4 (ファイアウォールの PPP インタフェース)ポート1025から、 207.218.152.131 (slashdot.org)ポート80まで接続されることになります。 myhost の側から見ると、 192.168.1.1 (ファイアウォールのイーサネット・インタフェース)のポート8080と 192.168.1.100(myhost)のポート1050が接続されることになります。 <!-- <sect2>Private Network: Transparent Proxies --> <sect2>プライベートネットワーク: 透過的なプロキシ <p> <!-- In this scenario, packets from the private network never traverse the Internet, and vice versa. The IP addresses of the private network should be assigned from the RFC1918 Address Allocation for Private Internets (ie. 10.*.*.*, 172.16.*.*-172.31.*.* or 192.168.*.*). --> このシナリオでは、ローカルネットワークからのパケットは、インターネットを行き来することはありません。 ローカルネットワークの IP アドレスは、 RFC1918 にてプライベートなインターネット環境のために用意されているアドレス(すなわち 10.*.*.* 、 172.16.*.*-172.31.*.* または 192.168.*.*)を割り当てなければなりません。 <p> <!-- The only way things ever connect to the Internet is by connecting to the firewall, which is the only machine on both networks, which connects onwards. You run a program (on the firewall) called a transparent proxy to do this; the kernel sends outgoing packets to the transparent proxy instead of sending them onwards (ie. it bastardizes routing). --> インターネットに接続する唯一の方法はファイアウォールに接続することで、このコンピュータが両方のネットワーク(訳注: インターネットとローカルネットワーク)に直接つながっています。 このファイアウォールの上で"透過的なプロキシ"と呼ばれるソフトを動かすことになりますが、ここではカーネルが出力パケットを外部に送る代りに、透過的なプロキシに送り出すことになります <!-- Draft 1 (すなわち、ルーティング自体は悪化するようになります)。 --> <!-- Reflect comments from: TAKEI Nobumitsu <takei@webmasters.gr.jp> --> (すなわち、偽のルーティングを行うようになります)。 <!-- ToDo "bastardizes"の訳はこれでいいか? --> <p> <!-- Transparent proxying means that the clients don't need to know there is a proxy involved. --> 透過的なプロキシを動かすということは、クライアントはプロキシの存在を意識しなくてもよいということです。 <p> <!-- Any services you wish the Internet to access must be on the firewall. (But see <ref id="limited-services" name="Limited Internal Services"> below). --> あなたがインターネットへのアクセスで望むサービスについては、必ずファイアウォール上のプロキシでサポートされたサービスでなければなりません(しかし、後述の <ref id="limited-services" name="制限された内部サービス"> を参照して下さい)。 <p> <!-- Example: Allowing web access from private network to the Internet. --> 例: プライベートネットワークからインターネットへのウェブ・アクセスを許す <enum> <!-- <item> The private network is assigned 192.168.1.* addresses, with myhost being 192.168.1.100, and the firewall's Ethernet interface being assigned 192.168.1.1. --> <item> プライベートネットワークは、 192.168.1.* を割り当てられた複数の番地からなり、 IP アドレスが 192.168.1.100 は myhost に、ファイアウォールのイーサネット・インタフェースには 192.168.1.1 が割り当てられています。 <!-- <item> A transparent web proxy (I believe there are patches for squid to allow it to operate in this manner, or try "transproxy") is installed and configured on the firewall, say running on port 8080. --> <item> 透過的なウェブ・プロキシ(squid に対するこの用途のためのパッチがいくつかあると思います。あるいは "transproxy" を試すのもいいかも)はインストールされて、ファイアウォールの上でポート8080にて動いています。 <!-- <item> The kernel is told to redirect connections to port 80 to the proxy, using ipchains. --> <item> カーネルは ipchains を使ってポート80の接続をプロキシに向けなおすように指示されています。 <!-- <item> Netscape on the private network is configured to connect directly. --> <item> プライベートネットワークの Netscape は、あたかも直接接続するように設定します。 <!-- <item> DNS needs to be configured on the private network (ie. you need to run a DNS server as a proxy on the firewall). --> <!-- Rusty Russell氏への質問から回答無し。水原さんからのコメントと、当方の見解一致したためこのまま。--> <item> DNS は、プライベートネットワーク上に設定されている必要があります(すなわち、あなたはファイアウォールの上での「代理」として DNS サーバを実行する必要があります)。 (訳注: つまり、クライアントからの名前解決の処理をすべてプライベートネットワーク内の DNS で賄わなければならないということです。 さもないと、名前解決のためのパケットがクライアントからインターネットに出てしまいます。) <!-- <item> The default route (aka gateway) needs to be configured on the private network, to send packets to the firewall. --> <item> ファイアウォールにパケットを送るためにプライベートネットワーク内にデフォルト・ルート(別名、ゲートウェイ)を設定する必要があります。 </enum> <p> <!-- Netscape on myhost reads http://slashdot.org. --> myhost の Netscape から、http://slashdot.org を見る。 <enum> <!-- <item> Netscape looks up the name "slashdot.org", and gets 207.218.152.131. It then opens a connection to that IP address, using local port 1050, and asks the web server (port 80) for the web page. --> <item> Netscapeは、 "slashdot.org" という名前を調べて、 207.218.152.131 という IP アドレスを得ます。そして、その IP アドレスに対してポート1050にて接続し、ウェブサーバ(ポート80)へページデータを要求します。 <!-- <item> As the packets from myhost (port 1050) to slashdot.org (port 80) pass through the firewall, they are redirected to the waiting transparent proxy on port 8080. The transparent proxy opens a connection (using local port 1025) to 207.218.152.131 port 80 (which is where the original packets were going). --> <item> slashdot.org (ポート80)への myhost (ポート1050)からのパケットはファイアウォールを経由しますが、それらはポート8080の上で待っている透過的なプロキシに向け直されます。 透過的なプロキシは、 207.218.152.131 のポート80(もともとクライアントからのパケットに指定されていた宛先)に対して、(ローカルなポート1025を使って)接続を行います。 <!-- <item> As the proxy receives the web page from its connection to the web server, it copies the data to the connection from Netscape. --> <item> プロキシはその接続によってウェブ・サーバからページを受け取り、 Netscape に対する接続にそのデータをコピーします。 <!-- <item> Netscape renders the page. --> <item> Netscapeは、ページを表示します。 </enum> <!-- ie. From slashdot.org's point of view, the connection is made from 1.2.3.4 (firewall's PPP interface) port 1025 to 207.218.152.131 (slashdot.org) port 80. From myhost's point of view, the connection is made from 192.168.1.100 (myhost) port 1050, to 207.218.152.131 (slashdot.org) port 80, but it's actually talking to the transparent proxy. --> つまり、 slashdot.org から見ると、接続はは 1.2.3.4 (ファイアウォールの PPP インタフェース)ポート1025から、 207.218.152.131 (slashdot.org)のポート80までの間で行われています。 myhost から見ると、 207.218.152.131 (slashdot.org)のポート80に対して、 192.168.1.100 (myhost)ポート1050までの間で行われています。 が、それは実際には透過的なプロキシとやり取りしていることになります。 <!-- <sect2>Private Network: Masquerading --> <sect2>プライベートネットワーク: マスカレーディング <p> <!-- In this scenario, packets from the private network never traverse the Internet without special treatment, and vice versa. The IP addresses of the private network should be assigned from the RFC1918 Address Allocation for Private Internets (ie. 10.*.*.*, 172.16.*.*-172.31.*.* or 192.168.*.*). --> <!-- Draft 2 このシナリオでは、ローカルネットワークからのパケットは、インターネットを行き来することはありません。ローカルネットワークのIPアドレスは、RFC1918にてプライベートなインターネット環境のために用意されているアドレス(すなわち10.*.*.*、172.16.*.*-172.31.*.*または192.168.*.*)を割り当てなければなりません。 --> このシナリオでは、ローカルネットワークからのパケットは、特別な扱いがなければインターネットを行き来することはありません。 ローカルネットワークの IP アドレスは、 RFC1918 にてプライベートなインターネット環境のために用意されているアドレス(すなわち 10.*.*.* 、 172.16.*.*-172.31.*.* または 192.168.*.*)を割り当てなければなりません。 <p> <!-- Instead of using a proxy, we use a special kernel facility called "masquerading". Masquerading rewrites packets as they pass through the firewall, so that they always seem to come from the firewall itself. It then rewrites the responses so that they look like they are going to the original recipient. --> プロキシを使う代わりに、 "マスカレーディング" と呼ばれる特別なカーネル機能を使います。 マスカレーディングは、ファイアウォールを経由したかのようにパケットを書き換えるので、これらのパケットは常にファイアウォール自身からきたように見えます。 それから、応答を本来の要求元へ送るように書き換えます。 <p> <!-- Masquerading has separate modules to handle "tricky" protocols, such as FTP, RealAudio, Quake, etc. For really hard-to-handle protocols, the "auto forwarding" facility can handle some of them by automatically setting up port forwarding for related sets of ports: look for ``ipportfw'' (2.0 kernels) or ``ipmasqadm'' (2.1 kernels). --> マスカレーディングはいくつかの "トリッキーな" プロトコルを扱うための個別のモジュールを持っています。 例えば、FTP, RealAudio, Quake などです。 本当に取り扱いが難しいプロトコルのためには、 "自動フォワーディング" 機能にて、関連したポートの転送を自動的に設定することにより、それらの一部を取り扱うことができます。 詳細については ``ipportfw'' (2.0系カーネル)または ``ipmasqadm'' (2.1系カーネル)を調べてみて下さい。 <p> <!-- Any services you wish the Internet to access must be on the firewall. (But see <ref id="limited-services" name="Limited Internal Services"> below). --> あなたがインターネットへのアクセスで望むサービスについては、必ずファイアウォール上のプロキシでサポートされたサービスでなければなりません(しかし、後述の <ref id="limited-services" name="制限された内部サービス"> を参照して下さい)。 <p> <!-- Example: Allowing web access from private network to the Internet. --> 例: プライベートネットワークからインターネットへのウェブ・アクセスを許す <enum> <!-- <item> The private network is assigned 192.168.1.* addresses, with myhost being 192.168.1.100, and the firewall's Ethernet interface being assigned 192.168.1.1. --> <item> プライベートネットワークは、 192.168.1.* 上の複数の番地からなり、 myhost には 192.168.1.100 が割り当てられ、ファイアウォールのイーサネットインターフェースには 192.168.1.1 が割り当てられています。 <!-- <item> The firewall is set up to masquerade any packets coming from the private network and going to port 80 on an Internet host. --> <item> ファイアウォールは、プライベートネットワークからインターネットの上のホストのポート80へのすべてのパケットをマスカレードするよう設定されています。 <!-- <item> Netscape is configured to connect directly. --> <item> Netscape は、直接接続するように設定されています。 <!-- <item> DNS must be configured correctly on the private network. --> <item> DNS は、プライベートネットワークの上で正しく設定されていなければなりません。 <!-- <item> The firewall should be the default route (aka gateway) for the private network. --> <item> ファイアウォールは、プライベートネットワークのためのデフォルト・ルート(別名、ゲートウェイ)でなければなりません。 </enum> <!-- Netscape on myhost reads http://slashdot.org. --> myhost の Netscape から、 http://slashdot.org を読む。 <enum> <!-- <item> Netscape looks up the name "slashdot.org", and gets 207.218.152.131. It then opens a connection to that IP address, using local port 1050, and asks the web server (port 80) for the web page. --> <item> Netscape は、 "slashdot.org" という名前を調べて、 207.218.152.131 という IP アドレスを得ます。 それからローカルなポート1050を使って、その IP アドレスのウェブ・サーバ(ポート80)に対して接続を行い、ウェブ・ページを要求します。 <!-- <item> As the packets from myhost (port 1050) to slashdot.org (port 80) pass through the firewall, they are rewritten to come from the PPP interface of the firewall, port 65000. The firewall has a valid Internet address (1.2.3.4) so reply packets from slashdot.org get routed back OK. --> <item> slashdot.org (ポート80)への myhost (ポート1050)からのパケットはファイアウォールに渡され、そこでファイアウォール(ポート65000)の PPP インタフェースから来たかのように書き直されます。 slashdot.org からの応答パケットを返すことが可能となるように、ファイアウォールは有効なインターネットアドレス(1.2.3.4)を持っています。 <!-- <item> As packets from slashdot.org (port 80) to firewall.littlecorp.com (port 65000) come in, they are rewritten to go to myhost, port 1050. This is the real magic of masquerading: it remembers when it rewrites outgoing packets to it can write them back as replies come in. --> <item> firewall.littlecorp.com (ポート65000)に対して slashdot.org (ポート80)からのパケットが返され、それらを myhost (ポート1050)へ送るために書き直されます。 マスカレーディングを実現するための "魔法" の正体というのは、つまり、応答が来たときに、それを正しく戻せるように、出力パケットを書き換えるときに覚えておくということです。 <!-- <item> Netscape renders the page. --> <item> Netscapeは、ページを表示します。 </enum> <!-- ie. From the slashdot.org's point of view, the connection is made from 1.2.3.4 (firewall's PPP interface) port 65000 to 207.218.152.131 (slashdot.org) port 80. From the myhost's point of view, the connection is made from 192.168.1.100 (myhost) port 1050, to 207.218.152.131 (slashdot.org) port 80. --> slashdot.org の側から見ると、接続は 1.2.3.4 (ファイアウォールの PPP インタフェース)ポート65000から、 207.218.152.131 (slashdot.org)ポート80まで行われています。 myhost の側から見ると、接続は 207.218.152.131 (slashdot.org)ポート80に対して、 192.168.1.100 (myhost)ポート1050から行われています。 <!-- <sect2>Public Network --> <sect2>パブリックネットワーク <p> <!-- In this scenario, your personal network is a part of the Internet: packets can flow without change across both networks. The IP addresses of the internal network must be assigned by applying for a block of IP addresses, so the rest of the network will know how to get packets to you. This implies a permanent connection. --> <!-- このシナリオで、あなたの個人のネットワークは、インターネットの一部分であり、パケットは、変更されることなく両方のネットワークを流れることができます。内部ネットワークのIPアドレスは、それ以外のネットワークがあなたのところへパケットをどのように届かせるかが判るように、IPアドレスのブロックを申し込むことで得られたものでなければなりません。これは継続的に接続されることを意味しています。 --> <!-- Modified by [yoh] <yoh@coolmail.net> --> このシナリオでは、あなたの個人のネットワークはインターネットの一部分です: パケットは変更されることなく両方のネットワークを流れることができます。 <!-- Modified by 後藤さん --> 内部ネットワークの IP アドレスは、 IP アドレスのブロックを申請することによって割り当てられたもののはずですので、他のネットワークは、どうやってあなたの元へパケットを届けられるかを知っているでしょう。 これは継続的に接続されることを意味しています。 (訳注: 例えば、 INTERNIC や JPNIC などに対する正しい手続きによって得られた継続的に使用できる IP アドレスをあなたが所有していなければならないということです。) <p> <!-- In this role, packet filtering is used to restrict which packets can be forwarded between your network and the rest of the Internet, eg. to restrict the rest of the Internet to only accessing your internal web servers. --> この場面でパケット・フィルタリングは、どのようなパケットがあなたのネットワークとそれ以外のインターネットとの間でやり取りされるかを制限するためなどに使われます。 例えば、インターネットの他の場所とのパケットのやり取りをあなたのウェブサーバに対してのみに限定させることができます。 <p> <!-- Example: Allowing web access from private network to the Internet. --> プライベートネットワークからインターネットへのウェブ・アクセスを許す <enum> <!-- <item> Your internal network is assigned according to the IP address block you have registered, (say 1.2.3.*). --> <!-- 1.あなたが登録したIPアドレス・ブロック(1.2.3.*とします)にしたがって、あなたの内部ネットワークは、アドレスを割り当てられています。 --> <item> あなたの内部ネットワークは、あなたが登録した IP アドレス・ブロック(1.2.3.* とします)に応じたアドレスが割り当てられています。 <!-- <item> The firewall is set up to allow all traffic. --> <item> ファイアウォールは、全てのトラフィックを許すよう設定されています。 (訳注: ここで示されたシナリオは説明のための便宜的なケースです。 実際のケースでは、次の節("内部サービスの限定")で示されたように、サービスを限定するなど、あなたのネットワークを守るために、出入りするパケットについて適切な許可/拒否のための条件を設定しておかなければなりません。) <!-- <item> Netscape is configured to connect directly. --> <item> Netscapeは、インターネットに直接接続するように設定されています。 <!-- <item> DNS must be configured correctly on your network. --> <item> DNSは、あなたのネットワークの上で正しく設定されていなければなりません。 <!-- <item> The firewall should be the default route (aka gateway) for the private network. --> <item> ファイアウォールは、プライベートネットワークのためのデフォルト・ルート(ゲートウェイ)でなければなりません。 </enum> <!-- Netscape on myhost reads http://slashdot.org. --> myhost の Netscape から、http://slashdot.org を見る。 <enum> <!-- <item> Netscape looks up the name "slashdot.org", and gets 207.218.152.131. It then opens a connection to that IP address, using local port 1050, and asks the web server (port 80) for the web page. --> <item> Netscapeは、 "slashdot.org" という名前を調べて、 207.218.152.131 という IP アドレスを得ます。 それからローカルなポート1050を使って、その IP アドレスのウェブ・サーバ(ポート80)に対して接続を行い、ウェブ・ページを要求します。 <!-- <item> Packets pass through your firewall, just as they pass through several other routers between you and slashdot.org. --> <item> パケットはあなたのネットワークと slashdot.org の間の他のいくつかのルーターを通り抜けるのと同じように、あなたのファイアウォールを通り抜けてやり取りされます。 <!-- <item> Netscape renders the page. --> <item> Netscapeは、ページを表示します。 </enum> <!-- ie. There is only one connection: from 1.2.3.100 (myhost) port 1050, to 207.218.152.131 (slashdot.org) port 80. --> つまり、この場合は 207.218.152.131 (slashdot.org)ポート80と、 1.2.3.100 (myhost)ポート1050の間のただひとつだけの接続が存在します。 <!-- <sect2>Limited Internal Services<label id="limited-services"> --> <!-- <sect2>内部サービスを限定する<label id="limited-services"> --> <!-- Modified by [yoh] <yoh@coolmail.net> --> <sect2>制限された内部サービス<label id="limited-services"> <p> <!-- There are a few tricks you can pull to allow the Internet to access your internal services, rather than running the services on the firewall. These will work with either a proxy or masquerading based approach for external connections. --> 外のインターネットからあなたの内部サービスに対して、ファイアウォール上でサービスを実行する以外の方法をとることのできるトリックが少しばかりあります。 それらの方法ではプロキシやマスカレーディングを外部のコネクションのために使用するというアプローチをとります。 <p> <!-- The simplest approach is to run a "redirector", which is a poor-man's proxy which waits for a connection on a given port, and then open a connection a fixed internal host and port, and copies data between the two connections. An example of this is the "redir" program. From the Internet point of view, the connection is made to your firewall. >From your internal server's point of view, the connection is made from the internal interface of the firewall to the server. --> 最も単純なアプローチは "リダイレクター" (それは与えられたポートの上で接続を待つという"貧弱な"プロキシです)を動作させることです。 それらはあらかじめ決められた内部ホストとポートに対して接続を行い、データを二つの接続の間でコピーします。 "redir" プログラムを使った例を示すと、外のインターネット側から見ると、接続はあなたのファイアウォールに対して行われます。 中のサーバの側から見ると、ファイアウォールとそのサーバに対して接続が行われるようになります。 <p> <!-- Another approach (which requires a 2.0 kernel patched for ipportfw, or a 2.1 or later kernel) is to use port forwarding in the kernel. This does the same job as "redir" in a different way: the kernel rewrites packets as they pass through, changing their destination address and ports to point them at an internal host and port. From the Internet's point of view, the connection is made to your firewall. From your internal server's point of view, a direct connection is made from the Internet host to the server. --> もう一つのアプローチ(これには ipportfw のためにパッチを当てられた 2.0 系カーネルか、あるいは 2.1 系以降のカーネルが必要です)はカーネルでのポート・フォワーディングを使うことです。 これは、 "redir" と同じ動作を別な方法で行います。 つまり、カーネルは渡されたパケットに対して、その目的アドレスとポートを内部のホストとポートに対して向けられたように書き換えます。 外のインターネット側から見ると、あなたのファイアウォールに対して接続されたように見えます。 また、あなたの内部のサーバ側から見ると、インターネット・ホストからサーバまで直接接続されているように見えます。 <!-- <sect1>More Information on Masquerading --> <sect1>マスカレーディングに対するその他の情報 <p> <!-- David Ranch has written an excellent new HOWTO on Masquerading, which has a large amount of overlap with this HOWTO. You can currently find that HOWTO at --> David Ranch はマスカレーディングに関する優れた新しい HOWTO を書きました。 この HOWTO とは多くの重複部分を持ちますが、次のページから見つけることができます。 <url url="http://www.linuxdoc.org/HOWTO/IP-Masquerade-HOWTO.html" name="http://www.linuxdoc.org/HOWTO/IP-Masquerade-HOWTO.html"> <p> <!-- The official Masquerading home page is at --> マスカレーディングの公式ページは次のとおりです。 <url url="http://ipmasq.cjb.net" name="http://ipmasq.cjb.net"> <!-- 3章ここまでby後藤 --> <!-- 4章ここからby松田 --> <!-- Draft 1: Nov.7.2000 --> <!-- Dfaft 2: Nov.8.2000 Linux 2.4 Packet Filtering HOWTOの訳を参考にしました。 山森 浩幸 <h-yamamo@db3.so-net.ne.jp> さんに感謝します。 (__) --> <p> <!-- <sect>IP Firewalling Chains<label id="core"> --> <sect>IP ファイアウォーリングチェイン<label id="core"> <p> <!-- This section describes all you really need to know to build a packet filter that meets your needs. --> この章は、あなたの必要に叶うパケットフィルタを構築するために、実際に知っておかなければならないことを全て説明します。 <!-- <sect1>How Packets Traverse The Filters --> <sect1>どのようにパケットがフィルタを通過するのか <p> <!-- The kernel starts with three lists of rules; these lists are called <bf>firewall chains</bf> or just <bf>chains</bf>. The three chains are called <bf>input</bf>, <bf>output</bf> and <bf>forward</bf>. When a packet comes in (say, through the Ethernet card) the kernel uses the <tt>input</tt> chain to decide its fate. If it survives that step, then the kernel decides where to send the packet next (this is called <bf>routing</bf>). If it is destined for another machine, it consults the <tt>forward</tt> chain. Finally, just before a packet is to go out, the kernel consults the <tt>output</tt> chain. --> カーネルは起動時に 3つのルールリストを保持しています。 これらのリストは<bf>ファイアウォールチェイン</bf>、または単に<bf>チェイン</bf>と呼ばれます。 3つのチェインは、 <bf>input</bf>, <bf>output</bf> そして <bf>forward</bf> と呼ばれます。 <!-- from packet-filtering HOWTO by松田 --> パケットが (例えば、イーサネットカードを通じて) 入って来ると、カーネルはそのパケットの「運命」を決定するために <tt>input</tt> チェインを使います。 パケットがこのステップで生き残ると、カーネルはパケットを次にどこに送るかを決定します。(これを<bf>ルーティング</bf>と呼びます。) パケットが他のマシンへ行くと定められているならば、 <tt>forward</tt> チェインを調べます。 最後に、パケットが出力される前に、カーネルは <tt>output</tt> チェインを調べます。 <p> <!-- A chain is a checklist of <bf>rules</bf>. Each rule says `if the packet header looks like this, then here's what to do with the packet'. If the rule doesn't match the packet, then the next rule in the chain is consulted. Finally, if there are no more rules to consult, then the kernel looks at the chain <bf>policy</bf> to decide what to do. In a security-conscious system, this policy usually tells the kernel to reject or deny the packet. --> 1つのチェインは複数の<bf>ルール</bf>のチェックリストから構成されています。 各々のルールは「もし、パケットのヘッダーがこんなだったら、パケットをこのようにしなさい」と指示します。 もし、あるルールがパケットとマッチしなければ、チェイン内の次のルールが調べられます。 最終的に、調べるルールが無くなったら、カーネルはそのチェインの<bf>ポリシー</bf>(方針)を見て何をするか決めます。 セキュリティ意識の強いシステムでは、このポリシーは普通、パケットを DROP するようにカーネルに指示します。 <!-- from packet-filtering HOWTO by松田 --> <p> <!-- For ASCII-art fans, this shown the complete path of a packet coming into a machine. --> ASCII アートファンのために、マシンに入来するパケットの完全な通り道をここに記します。 (訳注: この文書では日本語文字コードを用いた "JIS アート" を作成しております。 <newline> いわゆる全角文字と半角文字が混在する "JIS アート" を、 Netscape Navigator/Communicator や Microsoft Internet Explorer で表示させると、半角文字の幅と全角文字の幅の比が一致しない為に、『ガタガタに崩れた図面』になってしまいます。 <newline> html 版 を見る際には、 lynx や w3m 等のテキストブラウザをお薦めします。) <!-- <verb> ---------------------------------------------------------------- | ACCEPT/ lo interface | v REDIRECT _______ | --> C --> S --> ______ --> D --> ~~~~~~~~ -->|forward|----> _______ --> h a |input | e {Routing } |Chain | |output |ACCEPT e n |Chain | m {Decision} |_______| --->|Chain | c i |______| a ~~~~~~~~ | | ->|_______| k t | s | | | | | s y | q | v | | | u | v e v DENY/ | | v m | DENY/ r Local Process REJECT | | DENY/ | v REJECT a | | | REJECT | DENY d --------------------- | v e ----------------------------- DENY </verb> --> <verb> ┌──────────────────────────────────┐ │ lo インターフェース│ │ ACCEPT/ │ ↓ REDIRECT ┏━━━━━┓ ┌────┐ ACCEPT│ →チ→正→┌────┐→マ→┃ルーティン┃→│forward │──→┌────┐→ ェ 当 │ input │ ス ┃グの決定 ┃ │チェイン│┌─→│ output │ ッ 性 │チェイン│ カ ┗━━━━━┛ └────┘│┌→│チェイン│ ク │ └────┘ レ │ │ ││ └────┘ サ │ │ ー ↓ │ ││ │ ム │ │ ド ローカルプロセス ↓ ││ ↓ │ ↓ ↓ 外 │ DENY/ ││ DENY/ │ DENY DENY/ し │ REJECT ││ REJECT ↓ REJECT │ │ ││ DENY │ └──────────┘│ └────────────────┘ </verb> <!-- Here is a blow-by-blow description of each stage: --> 以下に各々の段階での説明を逐一記します。 <descrip> <!-- <tag/Checksum:/ This is a test that the packet hasn't been corrupted in some way. If it has, it is denied. --> <tag/チェックサム:/ パケットが幾つかの方法にて壊されていないかをテストします。 パケットが壊れていれば、否定されます。 <!-- <tag/Sanity:/ There is actually one of these sanity checks before each firewall chain, but the input chain's is the most important. Some malformed packets might confuse the rule-checking code, and these are denied here (a message is printed to the syslog if this happens). --> <tag/正当性:/ 各々のファイアウォールチェインの前にそれらのパケットの正当性のチェックが一つあります。 しかし、 input チェインのそれが最も重要です。 幾つかの異常なパケットは規則チェックコードを混乱させる恐れがあります。 それらはここで否定されます。 (これが発生すると syslog にメッセージが記録されます。) <!-- <tag/input chain:/ This is the first firewall chain against which the packet will be tested. If the verdict of the chain is not <tt>DENY</tt> or <tt>REJECT</tt>, the packet continues on. --> <tag/input チェイン:/ パケットがテストされる最初のファイアウォールチェインです。 チェインの判断が <tt>DENY</tt> (否定) または <tt>REJECT</tt> (拒絶) でなければ、 パケットの動きは続きます。 <!-- <tag/Demasquerade:/ If the packet is a reply to a previously masqueraded packet, it is demasqueraded, and skips straight to the <tt>output</tt> chain. If you don't use IP Masquerading, you can mentally erase this from the diagram. --> <tag/デマスカレード(マスカレード外し):/ パケットが以前にマスカレードされたパケットに対する応答なら、マスカレードが外され、 <tt>output</tt> チェインまで一気に処理を飛ばします。 IP マスカレードを使っていなければ、意図的に上記の図から消去できます。 <!-- <tag/Routing decision:/ The destination field is examined by the routing code, to decide if this packet should go to a local process (see Local process below) or forwarded to a remote machine (see forward chain below). --> <tag/ルーティングの決定:/ (パケット中の)宛先フィールドはルーティングコードによって、このパケットがローカルプロセスに行くべきなのか (ローカルプロセスの章を参照して下さい) 、リモートマシンに転送されるのか (フォワードチェインの章を参照して下さい) を決定するために調べられます。 <!-- <tag/Local process:/ A process running on the machine can receive packets after the Routing Decision step, and can send packets (which go through the Routing Decision step, then traverse the output chain). --> <tag/ローカルプロセス:/ マシン上で稼働するプロセスはルーティングの決定の段階の後のパケットを受け取れると共に、パケットを送信できます。 (送信パケットはルーティング決定ステップを経て、 output チェインを通過します。) <!-- <tag/lo interface:/ If packets from a local process are destined for a local process, they will go through the output chain with interface set to `lo', then return through the input chain with interface also `lo'. The lo interface is usually called the loopback interface. --> <tag/lo インターフェース:/ ローカルプロセスからのパケットがローカルプロセスに行くものならば、それらは `lo' と設定されたインターフェースで output チェインを通り抜け、再び `lo' インターフェースで input チェインに入ります。 lo インターフェースは通常ループバックインターフェースと呼ばれます。 <!-- <tag/local:/ If the packet was not created by a local process, then the forward chain is checked, otherwise the packet goes to the output chain. --> <tag/ローカル:/ パケットがローカルプロセスで生成されたものでないなら、 forward チェインがチェックされ、さもなくば、パケットは output チェインへ行きます。 <!-- <tag/forward chain:/ This chain is traversed for any packets which are attempting to pass through this machine to another. --> <tag/forward チェイン:/ このチェインにはこのマシンから他へ転送される全てのパケットが通過します。 <!-- <tag/output chain:/ This chain is traversed for all packets just before they are sent out. --> <tag/output チェイン:/ このチェインには出力される直前の全てのパケットが通過します。 </descrip> <!-- <sect2>Using ipchains --> <sect2>ipchains を使う <p> <!-- First, check that you have the version of ipchains that this document refers to: --> 先ず、この文書にて扱うお手持ちの ipchains のバージョンを、以下のように参照しましょう: <tscreen><verb> $ ipchains --version ipchains 1.3.9, 17-Mar-1999 </verb></tscreen> <p> <!-- Note that I recommend 1.3.4 (which has no long options, like `--sport'), or 1.3.8 or above; these are very stable. --> 注記として、1.3.4 (`--sport' のような長いオプションがありません) か、 1.3.8 以降をお薦めします; これらは大変安定しています。 <p> <!-- ipchains has a fairly detailed manual page (<tt>man ipchains</tt>), and if you need more detail on particulars, you can check out the programming interface (<tt>man 4 ipfw</tt>), or the file <tt>net/ipv4/ip_fw.c</tt> in the 2.1.x kernel source, which is (obviously) authoritative. --> 個々の事項についてのもっと詳しい説明が必要なら、ipchains にはかなり詳しいマニュアルページ (<tt>man ipchains</tt>) があります。 特に詳しく内容を知りたいなら、プログラミングインターフェース(<tt>man 4 ipfw</tt>) か、或は 2.1.x のカーネルソース内の <tt>net/ipv4/ip_fw.c</tt> ファイルを調べると良いでしょう。 これらは (明らかに) 信頼できます。 <p> <!-- There is also an excellent quick reference card by Scott Bronson in the source package, in both A4 and US Letter PostScript(TM). --> ソースパッケージには Scott Bronson による素晴らしいクィックリファレンスカードもあります。 A4判または US レターサイズの PostScript(TM) の両方があります。 <p> <!-- There are several different things you can do with <tt>ipchains</tt>. First the operations to manage whole chains. You start with three built-in chains <tt>input</tt>, <tt>output</tt> and <tt>forward</tt> which you can't delete. --> <tt>ipchains</tt> を使って色々なことができます。 先ず、全体のチェインを管理する操作。 あなたは 3つの組み込み済みチェインである、 <tt>input</tt>, <tt>output</tt>, <tt>forward</tt> (これらは削除できません)から始めます。 <enum> <!-- <item> Create a new chain (-N). <item> Delete an empty chain (-X). <item> Change the policy for a built-in chain. (-P). <item> List the rules in a chain (-L). <item> Flush the rules out of a chain (-F). <item> Zero the packet and byte counters on all rules in a chain (-Z). --> <item> 新しいチェインを作る (-N) <item> 空のチェインを削除する (-X) <item> 組み込み済みチェインのポリシーを変更する (-P) <item> チェイン内のルールをリストアップする (-L) <item> チェインからルールを全て消し去る (-F) <item> チェイン内の全てのルールのパケットとバイトのカウンターをゼロにする (-Z) </enum> <!-- There are several ways to manipulate rules inside a chain: --> チェイン内のルールを操作するには様々な方法があります: <enum> <!-- <item> Append a new rule to a chain (-A). <item> Insert a new rule at some position in a chain (-I). <item> Replace a rule at some position in a chain (-R). <item> Delete a rule at some position in a chain (-D). <item> Delete the first rule that matches in a chain (-D). --> <item> チェインに新しいルールを追加する (-A) <item> チェイン内のある位置に新しいルールを挿入する (-I) <item> チェイン内のある位置のルールを置き換える (-R) <item> チェイン内のある位置のルールを削除する (-D) <item> チェイン内の適合した最初のルールを削除する (-D) </enum> <!-- from packet-filtering HOWTO by松田 --> <!-- There are a few operations for masquerading, which are in <tt>ipchains</tt> for want of a good place to put them: --> マスカレーディングに関する操作が少ないながらあります。 それらを配置するに相応しい場所の要望の為に <tt>ipchains</tt> に含まれています。 <enum> <!-- <item> List the currently masqueraded connections (-M -L). <item> Set masquerading timeout values (-M -S). (But see <ref id="no-timeout" name="I can't set masquerading timeouts!">). --> <item> 現在のマスカレードされた接続の一覧を表示する (-M -L) <item> マスカレーディングのタイムアウト値を設定する (-M -S) (でも <ref id="no-timeout" name="マスカレーディングのタイムアウト値を設定できません!"> を見て下さい。) </enum> <!-- The final (and perhaps the most useful) function allows you to check what would happen to a given packet if it were to traverse a given chain. --> 最後の (そして恐らく最も便利な) 機能は、指定したパケットが指定したチェインを通過するなら、そのパケットがどうなるのかを試しにチェックできることです。 <!-- <sect2> What You'll See When Your Computer Starts Up --> <sect2> あなたのコンピュータが起動する時に見るもの <p> <!-- Before any ipchains commands have been run (be careful: some distributions run ipchains in their initialization scripts), there will be no rules in any of the built-in chains (`input', `forward' and `output'), and each of the chains will have a policy of ACCEPT. This is as wide-open as you can get. --> ipchains コマンドが起動される前 (注意: 幾つかのディストリビューションでは初期化スクリプト内で ipchains を起動しています) は、組み込み済みのルール (`input', `forward' と `output') 以外には何もありません。 そして各々のチェインは ACCEPT (許可) のポリシーに設定されています。 これは全てを受け入れることと等価です。 <!-- <sect2> Operations on a Single Rule --> <sect2> 単一のルールでの操作 <p> <!-- This is the bread-and-butter of ipchains; manipulating rules. Most commonly, you will probably use the append (-A) and delete (-D) commands. The others (-I for insert and -R for replace) are simple extensions of these concepts. --> ルールを操作すること ― それは ipchains の基本です。 ほとんどの場合、普通、あなたは追加 (-A) と削除 (-D) コマンドを使うことになるでしょう。 残りのコマンド(挿入の -I と置換の -R )は、これらの概念を単純に(機能)拡張したものです。 <p> <!-- Each rule specifies a set of conditions the packet must meet, and what to do if it meets them (a `target'). For example, you might want to deny all ICMP packets coming from the IP address 127.0.0.1. So in this case our conditions are that the protocol must be ICMP and that the source address must be 127.0.0.1. Our target is `DENY'. --> 各々のルールには、パケットが満たすべき条件のセットと、条件が満たされたときにすること(‘ターゲット’)を指定します。 例えば、IP アドレス 127.0.0.1 からやって来る全ての ICMP パケットを破棄したいとします。 その場合の条件はプロトコルが ICMP で、ソースアドレスが 127.0.0.1 で、ターゲットは `DENY'(否定) です。 <p> <!-- 127.0.0.1 is the `loopback' interface, which you will have even if you have no real network connection. You can use the `ping' program to generate such packets (it simply sends an ICMP type 8 (echo request) which all cooperative hosts should obligingly respond to with an ICMP type 0 (echo reply) packet). This makes it useful for testing. --> 127.0.0.1 は `ループバック' インターフェイスで、それはあなたのマシンが実際のネットワークに繋がっていなくても存在します。 `ping' プログラムでそのようなパケット (ping は 単純に ICMP タイプ8 (エコー要求)を送り、全ての協力的なホストは親切にも ICMP タイプ 0 (エコー応答)のパケットでそれに応えます)を発生させるのに使います。 これはテストに役立ちます。 <tscreen><verb> # ping -c 1 127.0.0.1 PING 127.0.0.1 (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.2 ms --- 127.0.0.1 ping statistics --- 1 packets transmitted, 1 packets received, 0% packet loss round-trip min/avg/max = 0.2/0.2/0.2 ms # ipchains -A input -s 127.0.0.1 -p icmp -j DENY # ping -c 1 127.0.0.1 PING 127.0.0.1 (127.0.0.1): 56 data bytes --- 127.0.0.1 ping statistics --- 1 packets transmitted, 0 packets received, 100% packet loss # </verb></tscreen> <!-- You can see here that the first ping succeeds (the `-c 1' tells ping to only send a single packet). --> ご覧のとおり最初の ping が成功しています(`-c 1' は ping にパケットを 1個だけ送るように指示しています)。 <p> <!-- Then we append (-A) to the `input' chain, a rule specifying that for packets from 127.0.0.1 (`-s 127.0.0.1') with protocol ICMP (`-p ICMP') we should jump to DENY (`-j DENY'). --> 次にルールを `INPUT' チェインに追加 (-A) します。ルールの指定は、 127.0.0.1 から (`-s 127.0.0.1') でプロトコル ICMP (`-p icmp') のパケットは、DENY へジャンプする (`-j DENY') です。 <p> <!-- Then we test our rule, using the second ping. There will be a pause before the program gives up waiting for a response that will never come. --> それから 2番目の ping でルールをテストします。 帰って来ない応答を待つのを ping が止めるまで少しの間があるでしょう。 <p> <!-- We can delete the rule in one of two ways. Firstly, since we know that it is the only rule in the input chain, we can use a numbered delete, as in: --> ルールを削除するには 2通りの方法があります。 1番目は、例えば、 input チェインにはルールが 1個だけしかないのを分っている場合では、番号を使って以下のように削除できます: <tscreen><verb> # ipchains -D input 1 # </verb></tscreen> <!-- To delete rule number 1 in the input chain. --> INPUT チェインのルール番号 1 を削除。 <p> <!-- The second way is to mirror the -A command, but replacing the -A with -D. This is useful when you have a complex chain of rules and you don't want to have to count them to figure out that it's rule 37 that you want to get rid of. In this case, we would use: --> 2番目の方法は -A コマンドをそっくり写して -A を -D に置き換えたものです。 これはルールが複雑なチェインの場合で、例えば、取り除きたいのがルール 37 だと探し当てるためにルールを数えたくない場合に有効です。 この場合、次のように使います: <tscreen><verb> # ipchains -D input -s 127.0.0.1 -p icmp -j DENY # </verb></tscreen> <!-- The syntax of -D must have exactly the same options as the -A (or -I or -R) command. If there are multiple identical rules in the same chain, only the first will be deleted. --> -D の書き方は、 -A (または -I か -R) コマンドの時と正確に同じオプションでなければなりません。 もし、同一チェイン中に複数のマッチするルールがあったら、最初のものだけが削除されます。 <!-- <sect2>Filtering Specifications --> <sect2>フィルタリングの仕様 <p> <!-- We have seen the use of `-p' to specify protocol, and `-s' to specify source address, but there are other options we can use to specify packet characteristics. What follows is an exhaustive compendium. --> これまでに、プロトコルを指定する `-p' オプションと、ソースアドレスを指定する `-s' オプションを見てきましたが、この他にもパケットの特徴を指定する様々なオプションがあります。 これから、その概要をあますところなくお話します。 <!-- <sect3>Specifying Source and Destination IP Addresses --> <sect3>ソースと宛先 IP アドレスの指定 <p> <!-- Source (-s) and destination (-d) IP addresses can be specified in four ways. The most common way is to use the full name, such as `localhost' or `www.linuxhq.com'. The second way is to specify the IP address such as `127.0.0.1'. --> ソース (-s) 及び宛先 (-d) IP アドレスは 4通りの指定方法があります。 もっとも一般的な方法は完全に記述された名前(FQDN)を使うことで、例えば、`localhost' とか `www.linuxhq.com' です。 2番目の方法は `127.0.0.1'のような IP アドレスを指定する方法です。 <p> <!-- The third and fourth ways allow specification of a group of IP addresses, such as `199.95.207.0/24' or `199.95.207.0/255.255.255.0'. These both specify any IP address from 199.95.207.0 to 199.95.207.255 inclusive; the digits after the `/' tell which parts of the IP address are significant. `/32' or `/255.255.255.255' is the default (match all of the IP address). To specify any IP address at all `/0' can be used, like so: --> 3番目と 4番目の方法は IP アドレスのグループを指定する方法で、 `199.95.207.0/24' とか `199.95.207.0/255.255.255.0' のように書きます。 両方とも 199.95.207.0 から 199.95.207.255 までのどの IP アドレスも含まれる指定で、数字のあとの `/' は IP アドレスのどの部分まで有効かを示しています。 省略時は `/32' または `/255.255.255.255' (IP アドレスの完全一致)です。 どんな IP アドレスでもよい場合は、以下のように `/0' が使えます: <tscreen><verb> # ipchains -A input -s 0/0 -j DENY # </verb></tscreen> <!-- This is rarely used, as the effect above is the same as not specifying the `-s' option at all. --> 上記の効果は `-s' オプションを指定しないのと全く同じなので、こんな使 い方はめったにしません。 <!-- <sect3>Specifying Inversion --> <sect3>否定の指定 <p> <!-- Many flags, including the `-s' and `-d' flags can have their arguments preceded by `!' (pronounced `not') to match addresses NOT equal to the ones given. For example. `-s ! localhost' matches any packet not coming from localhost. --> `-s' と `-d' を含む多くのフラグは、`!' (否定の宣言) をその引数の前に 置くことができます。 `-s' や `-d' の場合は与えられたアドレスと等しくないアドレスとマッチ します。 例えば、 `-s ! localhost' はローカルホストからでない全てのパケットと マッチします。 <p> <!-- Don't forget the spaces around the `!': they really are needed. --> `!' の前後にスペースを入れるのを忘れないで下さい。本当に必要なのです。 <!-- <sect3>Specifying Protocol --> <sect3>プロトコルの指定 <p> <!-- The protocol can be specified with the `-p' flag. Protocol can be a number (if you know the numeric protocol values for IP) or a name for the special cases of `TCP', `UDP' or `ICMP'. Case doesn't matter, so `tcp' works as well as `TCP'. --> プロトコルは `-p' フラグで指定します。 プロトコルの値は番号(あなたが IP のプロトコルの数値番号を知って いる場合)か `TCP', `UDP' または `ICMP' という特定の名称で指定します。 大文字小文字の区別はしませんから、`tcp' も `TCP' と同じ働きをします。 <p> <!-- The protocol name can be prefixed by a `!', to invert it, such as `-p ! TCP'. --> プロトコル名称はそれを否定するために `!' を前に付けることができます。 例えば、`-p ! TCP' は TCP でないパケットを指定します。 <!-- <sect4>Specifying UDP and TCP Ports --> <sect4>UDP と TCP ポートの指定 <p> <!-- For the special case where a protocol of TCP or UDP is specified, there can be an extra argument indicating the TCP or UDP port, or an (inclusive) range of ports (but see <ref id="handling-fragments" name="Handling Fragments"> below). A range is represented using a `:' character, such as `6000:6010', which covers 11 port numbers, from 6000 to 6010 inclusive. If the lower bound is omitted, it defaults to 0. If the upper bound is omitted, it defaults to 65535. So to specify TCP connections coming from ports under 1024, the syntax would be as `-p TCP -s 0.0.0.0/0 :1023'. Port numbers can be specified by name, eg. `www'. --> 特別な場合である TCP 或は UDP のプロトコルが指定された時には、 TCP 或は UDP のポート、或は含まれるポートの範囲 (しかし、後述の <ref id="handling-fragments" name="フラグメントの処理">を参照して下さい) を指し示す拡張引数が存在し得ます。 範囲は文字 `:' で表現します。例えば `6000:6010' は 6000 から 6010 迄の 範囲に含まれる11個のポート番号を示します。 もし下限値が省略されれば、デフォルトの 0 を意味します。 上限値が省略されれば、デフォルトの 65535 を意味します。 ですから、1024番以下のポートの TCP 接続を指定するには、書き方は `-p TCP -s 0.0.0.0/0 :1023' とします。 ポート番号は `www' のように、名前でも指定できます。 <p> <!-- Note that the port specification can be preceded by a `!', which inverts it. So to specify every TCP packet BUT a WWW packet, you would specify --> 注記として、ポート指定の前には否定を意味する `!' を置くことができます。 ですから、 WWW パケット以外の全ての TCP パケットを指定するには、以下の ように指定します。 <verb> -p TCP -d 0.0.0.0/0 ! www </verb> <!-- It is important to realize that the specification --> 以下の指定と、 <verb> -p TCP -d ! 192.168.1.1 www </verb> <!-- is very different from --> 以下の指定は全く違うことをしっかり認識して下さい。 <verb> -p TCP -d 192.168.1.1 ! www </verb> <!-- The first specifies any TCP packet to the WWW port on any machine but 192.168.1.1. The second specifies any TCP connection to any port on 192.168.1.1 but the WWW port. --> 最初の例は、 192.168.1.1 以外の全てのマシンの WWW ポートへの TCP パケット を指定します。 次の例は、 WWW ポートを除く全てのポートにおける 192.168.1.1 への TCP 接続を指定します。 <p> <!-- Finally, this case means not the WWW port and not 192.168.1.1: --> 最後に、このケースは WWW ポートでなく、 192.168.1.1 でもないことを 意味します: <verb> -p TCP -d ! 192.168.1.1 ! www </verb> <!-- <sect4>Specifying ICMP Type and Code --> <sect4>ICMP タイプとコードの指定 <p> <!-- ICMP also allows an optional argument, but as ICMP doesn't have ports, (ICMP has a <bf>type</bf> and a <bf>code</bf>) they have a different meaning. --> ICMP にもまたオプション引数がありますが、 ICMP はポートを持ち得ません。 (ICMP には<bf>タイプ</bf>と<bf>コード</bf>があります) それらには異なる意味があります。 <p> <!-- You can specify them as ICMP names (use <tt>ipchains -h icmp</tt> to list the names) after the `-s' option, or as a numeric ICMP type and code, where the type follows the `-s' option and the code follows the `-d' option. --> `-s' オプションの後に ICMP ネームを用いる (<tt>ipchains -h icmp</tt> を用いて、 ネームを一覧表示します) か、 ICMP タイプとコードの数値を用いるかで、 それらを指定します。 タイプは `-s' オプションの後に、コードは `-d' オプションの後に指定し ます。 <p> <!-- The ICMP names are fairly long: you only need use enough letters to make the name distinct from any other. --> ICMP ネームはかなり長いです: 他とはっきり区別できる分だけの長い文字列 であれば十分です。 <p> <!-- Here is a small table of some of the most common ICMP packets: --> 最も一般的な ICMP パケットの小さな一覧を以下に示します: <!-- <tscreen><verb> Number Name Required by 0 echo-reply ping 3 destination-unreachable Any TCP/UDP traffic. 5 redirect routing if not running routing daemon 8 echo-request ping 11 time-exceeded traceroute </verb></tscreen> --> <tscreen><verb> 番号 ネーム 必要とされるもの 0 echo-reply ping 3 destination-unreachable 全ての TCP/UDP トラフィック 5 redirect ルーティングデーモンが動作していない時の ルーティング 8 echo-request ping 11 time-exceeded traceroute </verb></tscreen> <!-- Note that the ICMP names cannot be preceeded by `!' at the moment. --> ICMP ネームは `!' を置けないことに注意して下さい。 <p> <!-- DO NOT DO NOT DO NOT block all ICMP type 3 messages! (See <ref id="ICMP" name="ICMP Packets"> below). --> 絶対に絶対に絶対に、 ICMP タイプ3 メッセージの全部をブロックしないで!! (後述の<ref id="ICMP" name="ICMP パケット">を参照して下さい) <!-- <sect3>Specifying an Interface --> <sect3>インターフェイスの指定 <p> <!-- The `-i' option specifies the name of an <bf>interface</bf> to match. An interface is the physical device the packet came in on, or is going out on. You can use the <tt>ifconfig</tt> command to list the interfaces which are `up' (ie. working at the moment). --> `-i' オプションはマッチすべき<bf>インターフェイス</bf>の名前を指定します。 インターフェイスとは、パケットが入って来るか、または出て行く 物理デバイスです。<tt>ifconig</tt> コマンドを使って `up' である (すなわち、今動いている)インターフェイスをリストアップできます。 <p> <!-- The interface for incoming packets (ie. packets traversing the <tt>input</tt> chain) is considered to be the interface they came in on. Logically, the interface for outgoing packets (packets traversing the <tt>output</tt> chain) is the interface they will go out on. The interface for packets traversing the <tt>forward</tt> chain is also the interface they will go out on; a fairly arbitrary decision it seems to me. --> 入来するパケット (すなわち、 <tt>input</tt> チェインを通過するパケット) の インターフェースは、それらが流れ込んで来るインターフェースであるもの と見なされます。 論理的には、出て行くパケット (<tt>output</tt> チェインを通過するパケット) の インターフェースは、それらが出て行くであろうインターフェースでありま す。 <tt>forward</tt> チェインを通過するパケットのインターフェースもまた、それらが 出て行くであろうインターフェースです; 私には、これは全くの独断に思えます。 (訳注: ここで著者は forward チェインのインターフェースを出力インター フェースにしたことに抗議しているように思えます。 たぶん著者は入力と出力の両方指定できたほうがよいと思っていて、でも、 ipchains にはインターフェイスを指定するオプションが -i の1つしかない ので、どちらかにせざるおえなかった。と言う話だと思います。 ipchains の後継である iptables では、 FORWARD チェインで、入力と出力 の両方のインターフェイスを指定できるようになってます。) <p> <!-- It is perfectly legal to specify an interface that currently does not exist; the rule will not match anything until the interface comes up. This is extremely useful for dial-up PPP links (usually interface <tt>ppp0</tt>) and the like. --> 現在存在していないインターフェイスを指定することは全く問題がありません が、指定したインターフェイスが up して来るまでルールがマッチすることは ありません。これはダイアルアップ PPP リンク(通常インターフェイスは <tt>ppp0</tt> )や同様のものについて非常に有効です。 <!-- from packet-filtering HOWTO by松田 --> <p> <!-- As a special case, an interface name ending with a `+' will match all interfaces (whether they currently exist or not) which begin with that string. For example, to specify a rule which matches all PPP interfaces, the <tt>-i ppp+</tt> option would be used. --> 特別なケースとして、インターフェース名の最後が `+' で終わるものは、 (現在存在していようとなかろうと) その文字列から始まる全てのインター フェースにマッチします。 例えば、全ての PPP インターフェースにマッチするルールを指定するには、 <tt>-i ppp+</tt> オプションが使えます。 <!-- from packet-filtering HOWTO by松田 --> <p> <!-- The interface name can be preceded by a `!' to match a packet which does NOT match the specified interface(s). --> 指定したインターフェイスと一致<bf>しない</bf>パケットにマッチするように インターフェイス名の前には `!' を置くことができます。 <!-- from packet-filtering HOWTO by松田 --> <!-- <sect3>Specifying TCP SYN Packets Only --> <sect3>TCP SYN パケットのみを指定する <p> <!-- It is sometimes useful to allow TCP connections in one direction, but not the other. For example, you might want to allow connections to an external WWW server, but not connections from that server. --> 一方向だけ TCP コネクションを許可し、他方は許可しないようにすることは 往々にして有効です。例えば、あなたが外部の WWW サーバーと接続したいが、 そのサーバーからの接続を許可したくないときです。 <!-- from packet-filtering HOWTO by松田 --> <p> <!-- The naive approach would be to block TCP packets coming from the server. Unfortunately, TCP connections require packets going in both directions to work at all. --> そのサーバーから来る TCP パケットをブロックすることは自然な方法です。 残念なことに、TCP コネクションにはとにかく両方向のパケットが行き来する ことが必要です。 <!-- from packet-filtering HOWTO by松田 --> <p> <!-- The solution is to block only the packets used to request a connection. These packets are called <bf>SYN</bf> packets (ok, technically they're packets with the SYN flag set, and the FIN and ACK flags cleared, but we call them SYN packets). By disallowing only these packets, we can stop attempted connections in their tracks. --> その解決方法は、コネクション要求に用いられるパケットのみをブロックす ることです。 このようなパケットは <bf>SYN</bf> パケットと呼ばれます。 (技術的には、SYN フラグが設定されていて、 FIN と ACK フラグがクリア されているパケットを指しますが、我々はこれを SYN パケットと呼びます。) それらのパケットだけを許可しないことで、その場の接続要求を止められま す。 <!-- packet-filtering-HOWTO.sgml では、 「これらのパケットだけ許可しないようにすれば、パケットを逆にたどって 接続して来るのを止めることができます。」 と訳されていますが、 in one's tracks は「その場で/突然/すぐ」という 意味ですので、敢えて上述のように訳しました。 --> <p> <!-- The `-y' flag is used for this: it is only valid for rules which specify TCP as their protocol. For example, to specify TCP connection attempts from 192.168.1.1: --> `-y' フラグはこのために使われます: これは TCP プロトコルを指定されて いる場合においてのみ有効です。 例えば、 192.168.1.1 から要求される TCP コネクションを指定するには: <verb> -p TCP -s 192.168.1.1 -y </verb> <p> <!-- Once again, this flag can be inverted by preceding it with a `!', which means every packet other than the connection initiation. --> もう一度、このフラグはその前に `!' を置くことによって (訳注: ! -y として) 否定することができ、それは接続開始のパケットを除く全てのパケットを 意味します。 <!-- <sect3>Handling Fragments<label id="handling-fragments"> --> <sect3>フラグメントの処理<label id="handling-fragments"> <p> <!-- Sometimes a packet is too large to fit down a wire all at once. When this happens, the packet is divided into <bf>fragments</bf>, and sent as multiple packets. The other end reassembles the fragments to reconstruct the whole packet. --> 時に、一度にケーブルに送り出すにはパケットが大き過ぎることがあります。 こんなときは、パケットは<bf>フラグメント</bf>に分割され、複数のパケットで送られ ます。受信点でこれらのフラグメントを再び集めて完全なパケットに再構成 します。 <p> <!-- The problem with fragments is that some of the specifications listed above (in particular, source port, destinations port, ICMP type, ICMP code, or TCP SYN flag) require the kernel to peek at the start of the packet, which is only contained in the first fragment. --> フラグメントの問題点は、先程リストアップした仕様の幾つか (特に、ソースポート、宛先ポート、 ICMP タイプ、 ICMP コード、 或は TCP SYN フラグ) は、カーネルに、最初のフラグメントにだけ含まれている パケットの始めの部分を覗くように要求している点にあります。 <p> <!-- If your machine is the only connection to an external network, then you can tell the Linux kernel to reassemble all fragments which pass through it, by compiling the kernel with <tt>IP: always defragment</tt> set to `Y'. This sidesteps the issue neatly. --> あなたのマシンが外部ネットワークにのみ接続されるなら、カーネルの "IP: 常にデフラグメントする" を Y に設定してコンパイルすることにより、 通過する全てのフラグメントを再構築するように Linux カーネルに命ずる ことができます。 これは問題をうまく回避します。 <p> <!-- Otherwise, it is important to understand how fragments get treated by the filtering rules. Any filtering rule that asks for information we don't have will <em>not</em> match. This means that the first fragment is treated like any other packet. Second and further fragments won't be. Thus a rule <tt>-p TCP -s 192.168.1.1 www</tt> (specifying a source port of `www') will never match a fragment (other than the first fragment). Neither will the opposite rule <tt>-p TCP -s 192.168.1.1 ! www</tt>. --> そうでなければ、フィルタリングルールがフラグメントをどのように扱うか を理解することが重要です。 情報が無ければどんなフィルタリングルールもマッチ<em>しません</em>。 この意味するところは 1番目のフラグメントは他のパケットと同じように扱 われます。 2番目以降のフラグメントは異なります。 従って、 <tt>-p TCP -s 192.168.1.1 www</tt> というルール (ソースポートが `www' の指定)は、フラグメント(1番目のフラグメント以外)と決してマッチ しません。 同様に否定のルール <tt>-p TCP -s 192.168.1.1 ! www</tt> もマッチしません。 <p> <!-- However, you can specify a rule specifically for second and further fragments, using the `-f' flag. Obviously, it is illegal to specify a TCP or UDP port, ICMP type, ICMP code or TCP SYN flag in such a fragment rule. --> とはいえ、`-f' フラグを用いて、 2番目及びそれ以降のフラグメントに 合致するルールを指定できます。 明らかに、このようなフラグメントルールには TCP や UDP ポート、 ICMP タイプ、 ICMP コード或は TCP SYN フラグを指定するのは間違いで す。 <p> <!-- It is also legal to specify that a rule does <em>not</em> apply to second and further fragments, by preceding the `-f' with `!'. --> また、`!' を `-f' の前に付けて、 2番目以降のフラグメントと適合しな いルールの指定もできます。 <p> <!-- Usually it is regarded as safe to let second and further fragments through, since filtering will effect the first fragment, and thus prevent reassembly on the target host, however, bugs have been known to allow crashing of machines simply by sending fragments. Your call. --> 通常、フィルタリングは 1番目のフラグメントに効力があるので、目的の ホストでのフラグメントの再組み立てを妨げるため、2番目以降のフラグメント を通過させることは安全とみなされています。とはいえ、フラグメントを送る ことにより簡単にマシンをクラッシュさせることができるバグが知られて います。調べて下さいね。 <!-- Your call あなたの要求、から意訳。自信なし。 --> <!-- from packet-filtering HOWTO by松田 --> <p> <!-- Note for network-heads: malformed packets (TCP, UDP and ICMP packets too short for the firewalling code to read the ports or ICMP code and type) are treated as fragments as well. Only TCP fragments starting at position 8 are explicitly dropped by the firewall code (a message should appear in the syslog if this occurs). --> ネットワーク管理者のための注記: 異常なパケット(TCP, UDP および ICMP の パケットで短すぎてファイアーウォールのコードがポート番号または ICMP の コードと種類を読めないもの)は、フラグメントと同様に取り扱われます。 フラグメントの位置が 8 から始まるTCP パケットだけが明白にファイアウォー ルコードによって破棄されます。(これが発生すると syslog にメッセージが 現れます。) <p> <!-- As an example, the following rule will drop any fragments going to 192.168.1.1: --> 例えば、次のルールは 192.168.1.1 へ行くフラグメントはどれでも破棄します: <tscreen><verb> # ipchains -A output -f -d 192.168.1.1 -j DENY # </verb></tscreen> <!-- <sect2>Filtering Side Effects --> <sect2>フィルタリングの副次的効果 <p> <!-- OK, so now we know all the ways we can match a packet using a rule. If a packet matches a rule, the following things happen: --> さて、今我々はルールを用いてパケットにマッチさせる方法の全てを知り ました。 パケットがルールにマッチすると、以下に記すことが起こります: <enum> <!-- <item> The byte counter for that rule is increased by the size of the packet (header and all). --> <item> 該当するルールのバイトカウンタはパケットのサイズ(ヘッダとその他全て) によって増加します。 <!-- <item> The packet counter for that rule is incremented. --> <item> 該当するルールのパケットカウンタがパケットの数によって1 加算されます。 <!-- <item> If the rule requests it, the packet is logged. --> <item> ルールが要求するなら、パケットがログに記録されます。 <!-- <item> If the rule requests it, the packet's Type Of Service field is changed. --> <item> ルールが要求するなら、パケットの Type Of Service (TOS) フィールド が変更されます。 <!-- <item> If the rule requests it, the packet is marked (not in 2.0 kernel series). --> <item> ルールが要求するなら、パケットに印が付けられます。(2.0 カーネル シリーズにはありません。) <!-- <item> The rule target is examined to decide what to do to the packet next. --> <item> パケットに対し、次に何を行わせるかを決定するべく、ルールターゲット が検査されます。 </enum> <p> <!-- For variety, I'll address these in order of importance. --> これら以外の種類については、重要度に応じて手を付けたいと思います。 <!-- <sect3>Specifying a Target<label id="target-spec"> --> <sect3>ターゲットの指定<label id="target-spec"> <p> <!-- A <bf>target</bf> tells the kernel what to do with a packet that matches a rule. ipchains uses `-j' (think `jump-to') for the target specification. The target name must be less than 8 letters, and case matters: "RETURN" and "return" are completely different. --> <bf>ターゲット</bf>はルールにマッチするパケットに対し何をすべきかをカーネルに 指示します。 ipchains はターゲットの指定に `-j' を用います。(`ジャンプする'と考え て下さい) ターゲット名は 8文字以下でなければならず、また大小文字を区別します: "RETURN" と "return" は全く別物です。 <p> <!-- The simplest case is when there is no target specified. This type of rule (often called an `accounting' rule) is useful for simply counting a certain type of packet. Whether this rule matches or not, the kernel simply examines the next rule in the chain. For example, to count the number of packets from 192.168.1.1, we could do this: --> 最も単純なケースは指定されるターゲットが全くない場合です。 このルールのタイプ (しばしば `計数' ルールと呼ばれます) は単純に一定のパケットのタイプをカウントするのに便利です。 このルールにマッチするか否かにかかわらず、カーネルは単純にチェイン 内の次のルールを検査します。 例えば、 192.168.1.1 からのパケットの数を数えるには、以下のように できます: <tscreen><verb> # ipchains -A input -s 192.168.1.1 # </verb></tscreen> <p> <!-- (Using `ipchains -L -v' we can see the byte and packet counters associated with each rule). --> (`ipchains -L -v' を用いて、各々のルールに関連付けられたバイト及び パケットカウンタを見れます。) <p> <!-- There are six special targets. The first three, <tt>ACCEPT</tt>, <tt>REJECT</tt> and <tt>DENY</tt> are fairly simple. <tt>ACCEPT</tt> allows the packet through. <tt>DENY</tt> drops the packet as if it had never been received. <tt>REJECT</tt> drops the packet, but (if it's not an ICMP packet) generates an ICMP reply to the source to tell it that the destination was unreachable. --> 6つの特別なターゲットがあります。 最初の 3つの <tt>ACCEPT</tt>, <tt>REJECT</tt> と <tt>DENY</tt> はとても単純です。 <tt>ACCEPT</tt> はパケットの通過を許可します。 <tt>DENY</tt> はあたかもパケットを受け取っていないかのように破棄します。 <tt>REJECT</tt> はパケットを破棄しますが、(もしそれが ICMP パケットでないなら) 宛先は未到達であることを知らせる ICMP 返答を、ソースに対して生成 します。 <p> <!-- The next one, <tt>MASQ</tt> tells the kernel to masquerade the packet. For this to work, your kernel needs to be compiled with IP Masquerading enabled. For details on this, see the Masquerading-HOWTO and the Appendix <ref id="ipfwadm-diff" name="Differences between ipchains and ipfwadm">. This target is only valid for packets traversing the <tt>forward</tt> chain. --> 次の一つ、 <tt>MASQ</tt> はカーネルにパケットをマスカレードすることを知らせ ます。 これを動作させるには、カーネルが IP マスカレーディングを有効にして コンパイルされている必要があります。 詳細については、 Masquerading-HOWTO と、付録の<ref id="ipfwadm-diff" name="ipchains と ipfwadm との違い">を見て下さい。 このターゲットは <tt>forward</tt> チェインを通過するパケットにおいてのみ有 効です。 <p> <!-- The other major special target is <tt>REDIRECT</tt> which tells the kernel to send a packet to a local port instead of wherever it was heading. This can only be specified for rules specifying TCP or UDP as their protocol. Optionally, a port (name or number) can be specified following `-j REDIRECT' which will cause the packet to be redirected to that particular port, even if it was addressed to another port. This target is only valid for packets traversing the <tt>input</tt> chain. --> 他の主要な特別なターゲットは、カーネルに対して、何処から発生したかを 問わずにパケットをローカルポートへ送る、 <tt>REDIRECT</tt> です。 これはプロトコルに TCP または UDP を指定しているルールにおいてのみ指 定できます。 任意に、ポート (名前又は番号) は `-j REDIRECT' と指定できます。 これはパケットが他のポートへアドレスされていたとしても特定のポートへ 転送させる効果を持ちます。 このターゲットは <tt>input</tt> チェインを通過するパケットにおいてのみ有効です。 <p> <!-- The final special target is <tt>RETURN</tt> which is identical to falling off the end of the chain immediately. (See <ref id="policy" name="Setting Policy"> below). --> 最後の特別なターゲットは <tt>RETURN</tt> で、直ちにチェインの最後に落し込むこ とと等価です。(後述の<ref id="policy" name="ポリシーを設定する">を参照して下さい。) <p> <!-- Any other target indicates a user-defined chain (as described in <ref id="chain-ops" name="Operations on an Entire Chain"> below). The packet will begin traversing the rules in that chain. If that chain doesn't decide the fate of the packet, then once traversal on that chain has finished, traversal resumes on the next rule in the current chain. --> 他のターゲットはユーザー指定のチェインを示します。 (後述の<ref id="chain-ops" name="チェインの操作">で説明しています。) パケットはそのチェイン内のルールを通過し始めます。 そのユーザ定義チェインでの検査が全て終ってもパケットの運命が 決まらなければ、現在のチェインに戻り、その次のルールから検査 を再開します。 <p> <!-- Time for more ASCII art. Consider two (silly) chains: <tt>input</tt> (the built-in chain) and <tt>Test</tt> (a user-defined chain). --> ASCII アートの時間です。2つの(おばかさんな)チェイン: <tt>input</tt> (組み込み済みチェイン)と <tt>test</tt> (ユーザ定義チェイン)で考えま しょう。 <!-- from packet-filtering HOWTO by松田 --> <!-- <verb> `input' `Test' ---------------------------- ---------------------------- | Rule1: -p ICMP -j REJECT | | Rule1: -s 192.168.1.1 | |--------------------------| |--------------------------| | Rule2: -p TCP -j Test | | Rule2: -d 192.168.1.1 | |--------------------------| ---------------------------- | Rule3: -p UDP -j DENY | ---------------------------- </verb> --> <verb> `input' `test' ┌──────────────┐ ┌─────────────┐ │ルール 1: -p ICMP -j REJECT │ │ルール 1: -s 192.168.1.1 │ ├──────────────┤ ├─────────────┤ │ルール 2: -p TCP -j Test │ │ルール 2: -d 192.168.1.1 │ ├──────────────┤ └─────────────┘ │ルール 3: -p UDP -j DENY │ └──────────────┘ </verb> <!-- from packet-filtering HOWTO by松田 --> <p> <!-- Consider a TCP packet coming from 192.168.1.1, going to 1.2.3.4. It enters the <tt>input</tt> chain, and gets tested against Rule1 - no match. Rule2 matches, and its target is <tt>Test</tt>, so the next rule examined is the start of <tt>Test</tt>. Rule1 in <tt>Test</tt> matches, but doesn't specify a target, so the next rule is examined, Rule2. This doesn't match, so we have reached the end of the chain. We return to the <tt>input</tt> chain, where we had just examined Rule2, so we now examine Rule3, which doesn't match either. --> 192.168.1.1 から来て 1.2.3.4 へ向かう TCP パケットについて考えましょう。 パケットは <tt>input</tt> チェインに入り、まず、ルール 1 が検査されます ― マッチしません。 ルール 2 がマッチして、そのターゲットは <tt>Test</tt> なので、次に検査される ルールは <tt>Test</tt> の先頭です。 <tt>Test</tt> のルール 1 はマッチしますが、ターゲットを指定していないので、 次のルールであるルール 2 が検査されます。 これはマッチしないので、チェインの終わりに達しました。 先程検査したルール 2 のある <tt>input</tt> チェインに戻り、それで今度はルール 3 が検査されますが、これもまたマッチしません。 <!-- from packet-filtering HOWTO by松田 --> <p> <!-- So the packet path is: --> それで、パケットの経路は次のようになります: <!-- <verb> v __________________________ `input' | / `Test' v ------------------------|--/ -----------------------|---- | Rule1 | /| | Rule1 | | |-----------------------|/-| |----------------------|---| | Rule2 / | | Rule2 | | |--------------------------| -----------------------v---- | Rule3 /--+___________________________/ ------------------------|--- v </verb> --> <verb> v __________________________ `input' | / `Test' v ┌───────────|─/ ┌──────────|─┐ │ルール 1 | /│ │ルール 1 | │ ├───────────|/-┤ ├──────────|─┤ │ルール 2 / │ │ルール 2 | │ ├───────────-─┤ └──────────v─┘ │ルール 3 /─┼─\_______________________/ └───────────|─┘ v </verb> <!-- from packet-filtering HOWTO by松田 --> <p> <!-- See the section <ref id="organisation" name="How to Organise Your Firewall Rules"> for ways to use user-defined chains effectively. --> ユーザ定義チェインを効果的に使う方法は、<ref id="organisation" name="ファイアウォールルールをどのように構築するか">の章を参照して下さい。 <!-- <sect3>Logging Packets --> <sect3>パケットのログ記録 <p> <!-- This is a side effect that matching a rule can have; you can have the matching packet logged using the `-l' flag. You will usually not want this for routine packets, but it is a useful feature if you want to look for exceptional events. --> これはルールにマッチすることの副次的効果です; マッチしたパケットを `-l' フラグを用いてログに記録することができま す。 普通、通常のパケットにおいてログを記録したくはないでしょうけど、例 外的なイベントを見たい時に便利な特徴です。 <p> <!-- The kernel logs this information looking like: --> この情報のカーネルのログは以下のような感じです: <tscreen><verb> Packet log: input DENY eth0 PROTO=17 192.168.2.1:53 192.168.1.1:1025 L=34 S=0x00 I=18 F=0x0000 T=254 </verb></tscreen> <!-- This log message is designed to be terse, and contain technical information useful only to networking gurus, but it can be useful to the rest of us. It breaks down like so: --> このログメッセージは簡潔に設計されており、ネットワークの権威者の為 だけに便利な技術情報を含んでいますが、あとの我々にも有用です。 簡単に説明すると以下のようになります: <enum> <!-- <item> `input' is the chain which contained the rule which matched the packet, causing the log message. --> <item> `input' はパケットにマッチしたルールを含むチェインで、ログメッセージ を発生しています。 <!-- <item> `DENY' is what the rule said to do to the packet. If this is `-' then the rule didn't effect the packet at all (an accounting rule). --> <item> `DENY' はルールがパケットに何をするかを示しています。 もしこれが `-' なら、ルールはパケットに何も行いません。 (計数ルールです。) <!-- <item> `eth0' is the interface name. Because this was the input chain, it means that the packet came in `eth0'. --> <item> `eth0' はインターフェース名です. 何故ならばこれは input チェインであり, パケットは `eth0' から入って 来たことを意味するからです。 <!-- <item> `PROTO=17' means that the packet was protocol 17. A list of protocol numbers is given in `/etc/protocols'. The most common are 1 (ICMP), 6 (TCP) and 17 (UDP). --> <item> `PROTO=17' はパケットがプロトコル 17 であったことを意味します。 プロトコル番号のリストは /etc/protocols にて与えられます。 最も一般的なものは 1 (ICMP), 6 (TCP) と 17 (UDP) です。 <!-- <item> `192.168.2.1' means that the packet's source IP address was 192.168.2.1. --> <item> `192.168.2.1' はパケットのソース IP アドレスは 192.168.2.1 で あったことを意味します。 <!-- <item> `:53' means that the source port was port 53. Looking in `/etc/services' shows that this is the `domain' port (ie. this is probably an DNS reply). For UDP and TCP, this number is the source port. For ICMP, it's the ICMP type. For others, it will be 65535. --> <item> `:53' はソースポートはポート 53 番であったことを意味します。 `/etc/services' を見れば、これが `domain' ポートであることを開示 しています。(すなわち、これは恐らく DNS の返答です。) UDP と TCP においては、この番号はソースポートです。 ICMP においては、 ICMP タイプです。 それ以外では、 65535 になるでしょう。 <!-- <item> `192.168.1.1' is the destination IP address. --> <item> `192.168.1.1' は宛先 IP アドレスです。 <!-- <item> `:1025' means that the destination port was 1025. For UDP and TCP, this number is the destination port. For ICMP, it's the ICMP code. For others, it will be 65535. --> <item> `:1025' は宛先ポートは 1025 であったことを意味します。 UDP と TCP においては、この番号は宛先ポートです。 ICMPにおいては、 ICMP コードです。 それ以外では、 65535 になるでしょう。 <!-- <item> `L=34' means that packet was a total of 34 bytes long. --> <item> `L=34' は、パケットは合計 34 バイト長であったことを意味します。 <!-- <item> `S=0x00' means the Type of Service field (divide by 4 to get the Type of Service as used by ipchains). --> <item> `S=0x00' は TOS フィールドを意味します。 (4 で割って、 ipchains で用いられるサービスの型が得られます。) <!-- <item> `I=18' is the IP ID. --> <item> `I=18' は IP の ID です。 <!-- <item> `F=0x0000' is the 16-bit fragment offset plus flags. A value starting with `0x4' or `0x5' means that the Don't Fragment bit is set. `0x2' or `0x3' means the `More Fragments' bit is set; expect more fragments after this. The rest of the number is the offset of this fragment, divided by 8. --> <item> `F=0x0000' は 16 ビットのフラグメントオフセットとフラグの加算です。 `0x4' 又は `0x5' で始まる値は 「フラグメントしていない」ビットが設定 されていることを示します。 `0x2' 又は `0x3' は `更にフラグメントしている' ビットが設定されている ことを示します; この後に更なるフラグメントが予測されます。 残りの数値はこのフラグメントのオフセットで、それは 8 で割った値です。 <!-- <item> `T=254' is the Time To Live of the packet. One is subtracted from this value for every hop, and it usually starts at 15 or 255. --> <item> `T=254' はパケットの寿命時間です。 この値は全てのホップ毎に減じられ、大概 15 か 255 で始まります。 <!-- <item> `(#5)' there may be a final number in brackets on more recent kernels (perhaps after 2.2.9). This is the rule number which caused the packet log. --> <item> `(#5)' は、ブラケット内の最後の番号がそれより新しいカーネルであろう ことを示します。(恐らく 2.2.9 以降でしょう。) 最後に、より新しいカーネル(たぶん 2.2.9 以降)で、括弧で囲まれた番号 があるでしょう。 (訳注: 原文には This is the rule number which caused the packet log. と書かれていますが、これは finally there may be a number ... と思われます。) </enum> <p> <!-- On standard Linux systems, this kernel output is captured by klogd (the kernel logging daemon) which hands it to syslogd (the system logging daemon). The `/etc/syslog.conf' controls the behaviour of syslogd, by specifying a destination for each `facility' (in our case, the facility is "kernel") and `level' (for ipchains, the level used is "info"). --> 標準的な Linux システムでは、カーネルの出力は klogd (カーネルロギング デーモン) にて捕捉され、 syslogd (システムロギングデーモン) に渡され ます。 `/etc/syslog.conf' は、各々の `facility' (我々の場合は、facility は "カーネル"です) の宛先と、 `level' (ipchains の為に、使われる level は "info" です)を指定することによって、 syslogd の振る舞いを制御しま す。 <!-- `facility' って、良い訳が見つかりません…。 JM の syslog.conf も見たんですが、そのまま facility になってました。 ログ記録の対象をここに書くんですよね…? --> <p> <!-- For example, my (Debian) /etc/syslog.conf contains two lines which match `kern.info': --> 例えば、私の (Debian) /etc/syslog.conf は `kern.info' にマッチする 2行を含んでいます: <tscreen><verb> kern.* -/var/log/kern.log *.=info;*.=notice;*.=warn;\ auth,authpriv.none;\ cron,daemon.none;\ mail,news.none -/var/log/messages </verb></tscreen> <!-- These mean that the messags are duplicated in `/var/log/kern.log' and `/var/log/messages'. For more details, see `man syslog.conf'. --> これらはメッセージが `/var/log/kern.log' と `/var/log/messages' に 複製されることを示しています。 詳細は `man syslog.conf' を見て下さい。 <!-- <sect3>Manipulating the Type Of Service --> <sect3>サービスの型を操作する <p> <!-- There are four seldom-used bits in the IP header, called the <bf>Type of Service</bf> (TOS) bits. They effect the way packets are treated; the four bits are "Minimum Delay", "Maximum Throughput", "Maximum Reliability" and "Minimum Cost". Only one of these bits is allowed to be set. Rob van Nieuwkerk, the author of the TOS-mangling code, puts it as follows: --> IP ヘッダには滅多に使われない 4つのビットがあり、<bf>「サービスの型」</bf> (TOS) ビットと呼ばれています。 それらはパケットが取り扱われる用途に影響します; 4つのビットは "Minimum Delay"(最小遅延), "Maximum Throughput" (最大処理能力), "Maximum Reliability"(最大信頼値) そして "Minimum Cost" (最小コスト) です。 それらのビットの一つだけが設定を許されます。 TOS 操作コードの作者の Rob van Nieuwkerk は以下のように述べています: <quote> <!-- Especially the "Minimum Delay" is important for me. I switch it on for "interactive" packets in my upstream (Linux) router. I'm behind a 33k6 modem link. Linux prioritizes packets in 3 queues. This way I get acceptable interactive performance while doing bulk downloads at the same time. (It could even be better if there wasn't such a big queue in the serial driver, but latency is kept down 1.5 seconds now). --> 特に "Minimum Delay"(最小遅延) が私にとって重要です。 私は上流の (Linux) ルータで"対話型"パケットの為にこのスイッチをオン しています。 私のマシンは 33.6k モデムで外部と接続されています。 Linux はパケットに 3つのキューで優先順位を付けています。 この方法で私は大量のダウンロードと同時に許容できる対話的なパフォー マンスを得ています。 (これはシリアルドライバにそのような巨大なキューがなければ良いのです が、待ち時間は1.5秒に落されます。) </quote> <p> <!-- Note: obviously, you have no control over incoming packets; you can only control the priority of packets leaving your box. To negotiate priorities with the other end, a protocol like RSVP (which I know nothing about, so don't ask me) must be used. --> 注意: 明らかに、あなたは入って来るパケットに対して制御はできません。 あなたは自身の Linux box を去っていくパケットの優先順位だけを制御 できます。 他の方法で優先順位をやりくりするなら、 RSVP のようなプロトコルが 必要です。(これに関しては私は何も知らないので、私には聞かないで下 さい。) <p> <!-- The most common use is to set telnet & ftp control connections to "Minimum Delay" and FTP data to "Maximum Throughput". This would be done as follows: --> 最も一般的な使用方法は telnet と ftp のコントロールコネクションに "Minimum Delay" を設定し、 FTP データに "Maximum Throughput" を設 定するものです。 以下のようになります: <tscreen><verb> ipchains -A output -p tcp -d 0.0.0.0/0 telnet -t 0x01 0x10 ipchains -A output -p tcp -d 0.0.0.0/0 ftp -t 0x01 0x10 ipchains -A output -p tcp -s 0.0.0.0/0 ftp-data -t 0x01 0x08 </verb></tscreen> <p> <!-- The `-t' flag takes two extra parameters, both in hexadecimal. These allow complex twiddling of the TOS bits: the first mask is ANDed with the packet's current TOS, and then the second mask is XORed with it. If this is too confusing, just use the following table: --> `-t' フラグは 2つの特別なパラメータを持ち、それらは16進で指定します。 それらはTOS ビットを複雑にいじくり回します: 最初のマスクはパケットの現在の TOS に AND (論理積)されます。 2番目のマスクはそれに対して XOR (排他的論理和)されます。 これで激しく混乱するのでしたら、以下の一覧を使って下さい: <!-- <tscreen><verb> TOS Name Value Typical Uses Minimum Delay 0x01 0x10 ftp, telnet Maximum Throughput 0x01 0x08 ftp-data Maximum Reliability 0x01 0x04 snmp Minimum Cost 0x01 0x02 nntp </verb></tscreen> --> <tscreen><verb> TOS 名 値 一般的な用途 Minimum Delay 0x01 0x10 ftp, telnet Maximum Throughput 0x01 0x08 ftp-data Maximum Reliability 0x01 0x04 snmp Minimum Cost 0x01 0x02 nntp </verb></tscreen> <!-- Andi Kleen goes on to point out the following (mildly edited for posterity): --> Andi Kleen は以下のように指摘しています。 (後々に残すために表現を 軟らかくしています。) <quote> <!-- Maybe it would be useful to add an reference to the txqueuelen parameter of ifconfig to the discussion of TOS bits. The default device queue length is tuned for ethernet cards, on modems it is too long and makes the 3 band scheduler (which queues based on TOS) work suboptimally. It is a good idea to set it to a value between 4-10 on modem or single b channel ISDN links: on bundled devices a longer queue is needed. This is a 2.0 and 2.1 problem, but in 2.1 it is a ifconfig flag (with recent nettools), while in 2.0 it requires source patches in the device drivers to change. --> 多分、TOS ビットの議論については、 ifconfig の txqueuelen パラメータの参照を追加するのに便利でしょう。 デバイスのキュー長の初期値はイーサネットカードの為に調整され、モデムにおいてはそれは長すぎて、 (TOSに則ったキューの) 3バンドのスケジューラを作成し、それらの働きは微々たるものです。 モデムやシングル b チャネルの ISDN 接続において、この値を 4-10 の間に設定するのは良いと思います; 太いデバイスならより長いキューが必要です。 これはカーネルバージョン 2.0 と 2.1 の問題でしたが、 2.1 においてそれは (最新の nettools を用いて) ifconfig フラグで可能になり、 2.0 においてはデバイスドライバのソースにパッチを適用して可能になります。 </quote> <!-- So, to see maximal benifits of TOS manipulation for modem PPP links, do `ifconfig $1 txqueuelen' in your /etc/ppp/ip-up script. The number to use depends on the modem speed and the amount of buffering in the modem; here's Andi setting me straight again: --> ですので、モデムでの PPP 接続における TOS 操作の最大の恩恵を得るには、 あなたのマシンの /etc/ppp/ip-up スクリプト内で `ifconfig $1 txqueuelen' を実行することです。 これを使う際の値はモデムの速度とモデム内のバッファの総量に依存します; 以下に Andi の私への返答をそのまま再度掲載します: <quote> <!-- The best value for a given configuration needs experiment. If the queues are too short on a router then packets will get dropped. Also of course one gets benefits even without TOS rewriting, just that TOS rewriting helps to give the benefits to non cooperating programs (but all standard linux programs are cooperating). --> 与えられたコンフィギュレーションの最適値は経験が必要です。 もしルータ上のキューが短すぎると、パケットを取りこぼしてしまいます。 そして勿論 TOS の書き換えもなく効果を得ることになり、単に TOS の書き 換えは非協力的なプログラムに効果をもたらします。 (しかし全ての標準的な Linux システムプログラムは協力的です。) </quote> <!-- <sect3>Marking a Packet --> <sect3>パケットのマーキング <p> <!-- This allows complex and powerful interactions with Alexey Kuznetsov's new Quality of Service implementation, as well as the mark-based forwarding in later 2.1 series kernels. More news as it comes to hand. This option is ignored altogether in the 2.0 kernel series. --> これは Alexey Kuznetsov による新たな"高品質通信"の実装によって、複雑 で強力な相互作用を有効にします。 2.1 シリーズカーネル以降のmarkベースのフォワーディングと同様に良好で す。 更なるニュースとしてはこれが使えるようになったことです。 このオプションは 2.0 カーネルシリーズでは全く無視されます。 (訳注: Quality of Service は、 QoS と略され、ネットワーク流量制限を 指します。これはカーネルのコンフィギュレーションスイッチに CONFIG_NET_QOS として存在します。) <!-- …と、偉そうに説明しちゃって良いものかどうか…? この機能を有効にするなら、 CONFIG_NET_QOS をオンにしてカーネルを make しなきゃならないんじゃないのかな…? --> <!-- <sect3>Operations on an Entire Chain<label id="chain-ops"> --> <sect3>チェインの操作<label id="chain-ops"> <p> <!-- A very useful feature of ipchains is the ability to group related rules into chains. You can call the chains whatever you want, as long as the names don't clash with the built-in chains (<tt>input</tt>, <tt>output</tt> and <tt>forward</tt>) or the targets (<tt>MASQ</tt>, <tt>REDIRECT</tt>, <tt>ACCEPT</tt>, <tt>DENY</tt>, <tt>REJECT</tt> or <tt>RETURN</tt>). I suggest avoiding upper-case labels entirely, since I may use these for future extensions. The chain name can be up to 8 characters long. --> ipchains のとても有効な特徴は、チェイン中の関連するルールをグループ 化できることです。 お望みのチェインは何でも呼び出せますが、組み込み済みチェイン (<tt>input</tt>, <tt>output</tt> と <tt>forward</tt>) やターゲット (<tt>MASQ</tt>, <tt>REDIRECT</tt>, <tt>ACCEPT</tt>, <tt>DENY</tt>, <tt>REJECT</tt> 或は <tt>RETURN</tt>) を壊さない為に、十分長い名前を使って下さい。 将来の拡張に備えて、ラベル名の全部に大文字を使わないことをお勧めします。 チェインの名前は最大 8文字まで使えます。 <!-- <sect3>Creating a New Chain --> <sect3>新しいチェインを作る <p> <!-- Let's create a new chain. Because I am such an imaginative fellow, I'll call it <tt>test</tt>. --> 新しいチェインを作りましょう。私はとっても創造力に富んだ野郎なので、 それを <tt>test</tt> と名付けます。 <!-- from packet-filtering HOWTO by松田 --> <tscreen><verb> # ipchains -N test # </verb></tscreen> <p> <!-- It's that simple. Now you can put rules in it as detailed above. --> これは簡単です。 さて、あなたはこれまで詳細に述べてきたように、これにルールを入れる ことができます。 <!-- from packet-filtering HOWTO by松田 --> <!-- <sect3>Deleting a Chain --> <sect3>チェインを削除する <p> <!-- Deleting a chain is simple as well. --> チェインを削除するのも同様に簡単です。 <tscreen><verb> # ipchains -X test # </verb></tscreen> <!-- Why `-X'? Well, all the good letters were taken. --> なぜ `-X' かって? うーん、よい文字が全て取られてしまったのです。 <!-- from packet-filtering HOWTO by松田 --> <p> <!-- There are a couple of restrictions to deleting chains: they must be empty (see <ref id="flushing" name="Flushing a Chain"> below) and they must not be the target of any rule. You can't delete any of the three built-in chains. --> チェインを削除するには 2つの制限があります: そのチェインは空である必要があり(後述の<ref id="flushing" name="チェインを空にする">を見て下さい)、しかも、決してどのルールのターゲットにもなっていないことです。 組み込み済みの 3つのチェインはどれも削除できません。 <!-- from packet-filtering HOWTO by松田 --> <!-- <sect3> Flushing a Chain<label id="flushing"> --> <sect3> チェインを空にする<label id="flushing"> <p> <!-- There is a simple way of emptying all rules out of a chain, using the `-F' command. --> チェインから全てのルールを取り去り空にするのは簡単で、`-F' コマンド を使います。 <!-- from packet-filtering HOWTO by松田 --> <tscreen><verb> # ipchains -F forward # </verb></tscreen> <p> <!-- If you don't specify a chain, then <em>all</em> chains will be flushed. --> もし、チェイン名を指定しなければ、<em>全ての</em>チェインを空にします。 <!-- <sect3>Listing a Chain --> <sect3>チェインの内容をリストアップする <p> <!-- You can list all the rules in a chain by using the `-L' command. --> チェイン中の全てのルールをリストアップするには、`-L' コマンドを使い ます。 <!-- from packet-filtering HOWTO by松田 --> <tscreen><verb> # ipchains -L input Chain input (refcnt = 1): (policy ACCEPT) target prot opt source destination ports ACCEPT icmp ----- anywhere anywhere any # ipchains -L test Chain test (refcnt = 0): target prot opt source destination ports DENY icmp ----- localnet/24 anywhere any # </verb></tscreen> <p> <!-- The `refcnt' listed for <tt>test</tt> is the number of rules which have <tt>test</tt> as their target. This must be zero (and the chain be empty) before this chain can be deleted. --> <tt>test</tt> に表示されている `refcnt' は、<tt>test</tt> をターゲットに指定している ルールの数です。 この数が 0 でないと(かつチェインが空であること)、そのチェインを削除 することはできません。 <!-- from packet-filtering HOWTO by松田 --> <p> <!-- If the chain name is omitted, all chains are listed, even empty ones. --> もし、チェイン名を指定しなければ、空のも含めて全てのチェインについて リストアップされます。 <!-- from packet-filtering HOWTO by松田 --> <p> <!-- There are three options which can accompany `-L'. The `-n' (numeric) option is very useful as it prevents <tt>ipchains</tt> from trying to lookup the IP addresses, which (if you are using DNS like most people) will cause large delays if your DNS is not set up properly, or you have filtered out DNS requests. It also causes ports to be printed out as numbers rather than names. --> `-L' には 3つのオプションがあります。 (大抵の人々は DNS を使っていますが) DNS が適切に設定 されていない場合や DNS の要求をフィルターアウトしている場合は、 <tt>ipchains</tt> が IP アドレスを調べようとするときに長く待たされます。 それを防ぐのに `-n' (数値)オプションはとても有効です。 このオプションは TCP や UDP ポートについても名前ではなく番号で表示 します。 <!-- from packet-filtering HOWTO by松田 --> <p> <!-- The `-v' options shows you all the details of the rules, such as the the packet and byte counters, the TOS masks, the interface, and the packet mark. Otherwise these values are omitted. For example: --> `-v' オプションはルールの詳細を全て、例えば、パケットやバイトの カウンター、TOS マスク、インターフェイス、そしてパケットマークを 表示します。 このオプションを指定しなければ、これらの値は省略されます。 <!-- from packet-filtering HOWTO by松田 --> <tscreen><verb> # ipchains -v -L input Chain input (refcnt = 1): (policy ACCEPT) pkts bytes target prot opt tosa tosx ifname mark source destination ports 10 840 ACCEPT icmp ----- 0xFF 0x00 lo anywhere anywhere any </verb></tscreen> <p> <!-- Note that the packet and byte counters are printed out using the suffixes `K', `M' or `G' for 1000, 1,000,000 and 1,000,000,000 respectively. Using the `-x' (expand numbers) flag as well prints the full numbers, no matter how large they are. --> 注記として、パケットとバイトのカウンターは、1000, 1,000,000 および 1,000,000,000 を、それぞれ `K', `M' および `G' の接尾辞を使って表示 します。 `-x' (拡張数値)オプションを使うと、値の大きさにかかわらず完全な数値 を同様に表示します。 <!-- from packet-filtering HOWTO by松田 --> <!-- <sect3>Resetting (Zeroing) Counters --> <sect3>カウンターを(ゼロに)リセットする <p> <!-- It is useful to be able to reset the counters. This can be done with the `-Z' (zero counters) option. For example: --> カウンターをリセットできると便利です。これは `-Z' (カウンタをゼロにする) オプションでできます。例えば: <!-- from packet-filtering HOWTO by松田 --> <tscreen><verb> # ipchains -v -L input Chain input (refcnt = 1): (policy ACCEPT) pkts bytes target prot opt tosa tosx ifname mark source destination ports 10 840 ACCEPT icmp ----- 0xFF 0x00 lo anywhere anywhere any # ipchains -Z input # ipchains -v -L input Chain input (refcnt = 1): (policy ACCEPT) pkts bytes target prot opt tosa tosx ifname mark source destination ports 0 0 ACCEPT icmp ----- 0xFF 0x00 lo anywhere anywhere any # </verb></tscreen> <p> <!-- The problem with this approach is that sometimes you need to know the counter values immediately before they are reset. In the above example, some packets could pass through between the `-L' and `-Z' commands. For this reason, you can use the `-L' and `-Z' <em>together</em>, to reset the counters while reading them. Unfortunately, if you do this, you can't operate on a single chain: you have to list and zero all the chains at once. --> このやり方では、リセットする直前のカウンタ値を知る必要があるときに 問題になります。 上記の方法では、`-L' から `-Z' コマンドまでの間にいくつかのパケット が通過するかもしれません。 そのため、カウンターを読むと同時にリセットするには、`-L' と `-Z' を <em>同時に</em>使います。 残念ながら、あなたがこれを使うと、単一のチェインを操作できません: 一旦全てのチェインをリストアップしてゼロにする必要があります。 <tscreen><verb> # ipchains -L -v -Z Chain input (policy ACCEPT): pkts bytes target prot opt tosa tosx ifname mark source destination ports 10 840 ACCEPT icmp ----- 0xFF 0x00 lo anywhere anywhere any Chain forward (refcnt = 1): (policy ACCEPT) Chain output (refcnt = 1): (policy ACCEPT) Chain test (refcnt = 0): 0 0 DENY icmp ----- 0xFF 0x00 ppp0 localnet/24 anywhere any # ipchains -L -v Chain input (policy ACCEPT): pkts bytes target prot opt tosa tosx ifname mark source destination ports 10 840 ACCEPT icmp ----- 0xFF 0x00 lo anywhere anywhere any Chain forward (refcnt = 1): (policy ACCEPT) Chain output (refcnt = 1): (policy ACCEPT) Chain test (refcnt = 0): 0 0 DENY icmp ----- 0xFF 0x00 ppp0 localnet/24 anywhere any # </verb></tscreen> <!-- <sect3>Setting Policy<label id="policy"> --> <sect3>ポリシーを設定する<label id="policy"> <p> <!-- We glossed over what happens when a packet hits the end of a built-in chain when we discussed how a packet walks through chains in <ref id="target-spec" name="Specifying a Target"> above. In this case, the <bf>policy</bf> of the chain determines the fate of the packet. Only built-in chains (<tt>input</tt>, <tt>output</tt> and <tt>forward</tt>) have policies, because if a packet falls off the end of a user-defined chain, traversal resumes at the previous chain. --> 以前にパケットがどのようにチェインを通り抜けるのかを、前述の <ref id="target-spec" name="ターゲットの指定">にて論じたとき、パケット が組み込み済みチェインの終わりに達した時に何が起きるのかを大体述べまし た。 この場合、チェインの<bf>ポリシー</bf>がそのパケットの運命を決定します。 組み込み済みチェイン(<tt>input</tt>, <tt>output</tt> および <tt>forward</tt>)だけがポリシーを持っ ています。 なぜなら、パケットがユーザ定義チェインの終わりまで下り落ちると、前の チェインに戻って行くからです。 <!-- from packet-filtering HOWTO by松田 --> <p> <!-- The policy can be any of the first four special targets: <tt>ACCEPT</tt>, <tt>DENY</tt>, <tt>REJECT</tt> or <tt>MASQ</tt>. <tt>MASQ</tt> is only valid for the `forward' chain. --> ポリシーは最初から 4つまでの特別なターゲットのいずれかです: <tt>ACCEPT</tt>, <tt>DENY</tt>, <tt>REJECT</tt> 或は <tt>MASQ</tt> です。 <tt>MASQ</tt> は `forward' チェインにおいてのみ有効です。 <p> <!-- It is also important to note that a <tt>RETURN</tt> target in a rule in one of the built-in chains is useful to explicitly target the chain policy when a packet matches a rule. --> また、重要な注意点として、組み込み済みチェイン中のルールにおける <tt>RETURN</tt> ターゲットは、パケットがルールにマッチした時に明示的にチェインのポリシー をターゲットにするため便利です。 <!-- <sect2>Operations on Masquerading --> <sect2>マスカレーディングの操作 <p> <!-- There are several parameters you can tweak for IP Masquerading. They are bundled with <tt>ipchains</tt> because it's not worth writing a separate tool for them (although this will change). --> IP マスカレーディングを微調整する幾つかのパラメータがあります。 それらは <tt>ipchains</tt> に組み込まれています。 何故なら、その機能の為に別のツールを書くのは良くないからです。 (しかしこれは変更されるでしょう。) <p> <!-- The IP Masquerading command is `-M', and it can be combined with `-L' to list currently masqueraded connections, or `-S' to set the masquerading parameters. --> IP マスカレーディングのコマンドは `-M' で、今マスカレードされている コネクションをリストアップするために `-L' と組み合わせられ、マスカ レーディングの値を調整するために `-S' と組み合わせられます。 <p> <!-- The `-L' command can be accompanied by `-n' (show numbers instead of hostnames and port names) or `-v' (show deltas in sequence numbers for masqueraded connection, just in case you care). --> `-L' コマンドは `-n' (ホスト名やポート名ではなく、数値を表示します。) か、または `-v' (まさにあなたが注意する、マスカレードコネクションの シーケンス番号の詳細を表示します。)を伴います。 <p> <!-- The `-S' command should be followed by three timeout values, each in seconds: for TCP sessions, for TCP sessions after a FIN packet, and for UDP packets. If you don't want to change one of these values, simply give a value of `0'. --> `-S' コマンドは以下の 3つのタイムアウト値を設定します、それらは 秒単位です: TCP セッション、 FIN パケット後の TCP セッションと、 UDP パケット です。 もしそれらの値の一つを変更したくないならば、単純に `0' が与えられ ます。 <p> <!-- The default values are listed in `/usr/src/linux/include/net/ip_masq.h', currently 15 minutes, 2 minutes and 5 minutes respectively. --> 既定値は `/usr/src/linux/include/net/ip_masq.h' にリストアップさ れており、 現在はそれぞれ 15 秒、 2秒 そして 5秒です。 <p> <!-- The most common value to change is the first one, for FTP (see <ref id="ftp" name="FTP Nightmares"> below). --> 変更される最も一般的な値は、 ftp の為に変更する最初の値です。 (後述の<ref id="ftp" name="FTP の悪夢">を参照して下さい。) <p> <!-- Note the problems with setting timeouts listed in <ref id="no-timeout" name="I can't set masquerading timeouts!">. --> <ref id="no-timeout" name="マスカレーディングのタイムアウト値を設定できません!">に列挙したタイムアウトの設定に関する問題に注意して下さい。 <!-- <sect2>Checking a Packet --> <sect2>パケットをチェックする <p> <!-- Sometimes you want to see what happens when a certain packet enters your machine, such as for debugging your firewall chains. <tt>ipchains</tt> has the `-C' command to allow this, using the exact same routines that the kernel uses to diagnose real packets. --> 時にあなたのマシンに一定のパケットが入り込む際に何が起こるのかを 見たいと思うことでしょう。 あなたのファイアウォールチェインをデバッグする時など。 <tt>ipchains</tt> はこれを有効にさせる `-C' コマンドを装備しています。 その際、カーネルが本当のパケットを診断するのに用いるルーチンと正 確に同じルーチンを用います。 <p> <!-- You specify which chain to test the packet on by following the `-C' argument with its name. Whereas the kernel always starts traversing on the <tt>input</tt>, <tt>output</tt> or <tt>forward</tt> chains, you are allowed to begin traversing on any chain for testing purposes. --> パケットをテストするチェインは、引数 `-C' の後にパケットのテストを するチェインの名前を指定します。 カーネルは常に <tt>input</tt>, <tt>output</tt> または <tt>forward</tt> チェイン、と移って行き ますが、テストはどのチェインからでも始めることができます。 <p> <!-- The details of the `packet' are specified using the same syntax used to specify firewall rules. In particular, a protocol (`-p'), source address (`-s'), destination address (`-d') and interface (`-i') are compulsory. If the protocol is TCP or UDP, then a single source and a single destination port must be specified, and a ICMP type and code must be specified for the ICMP protocol (unless the `-f' flag is specified to indicate a fragment rule, in which case these options are illegal). --> `packet' の詳細は、ファイアウォールルールを指定する為に用いられる のと同じ書き方を用いて指定します。 特に、プロトコル (`-p') 、ソースアドレス (`-s') 、宛先アドレス (`-d') とインターフェース (`-i')は必須です。 もしプロトコルが TCP 又は UDP なら、単一のソースと単一の宛先ポート が指定されなければなりませんし、 ICMP プロトコルにおいては ICMP タ イプが指定されなければなりません。 (フラグメントを示す `-f' フラグを指定していなければ。指定している場合は これらのオプションは不正です。) <p> <!-- If the protocol is TCP (and the `-f' flag is not specified), the `-y' flag may be specified, to indicate that the test packet should have the SYN bit set. --> プロトコルが TCP ならば (そして `-f' フラグがしていされていなけ れば) 、テストパケットに SYN ビットをセットするのに `-y' フラグを指定 してもよいでしょう。 <p> <!-- Here is an example of testing a TCP SYN packet from 192.168.1.1 port 60000 to 192.168.1.2 port www, coming in the eth0 interface, entering the `input' chain. (This is a classic incoming WWW connection initiation): --> 以下は 192.168.1.1 の60000 ポートから 192.168.1.2 の www ポートへ、 eth0 インターフェースに入り、 `input' チェインに到達する TCP SYN パケットをテストする例です。 (これは典型的な WWW の接続開始の入来です) <tscreen><verb> # ipchains -C input -p tcp -y -i eth0 -s 192.168.1.1 60000 -d 192.168.1.2 www packet accepted # </verb></tscreen> <!-- <sect2>Multiple Rules at Once and Watching What Happens --> <sect2>一度に複数のルールと何が起こるのかを見る <p> <!-- Sometimes a single command line can result in multiple rules being effected. This is done in two ways. Firstly, if you specify a hostname which resolves (using DNS) to multiple IP addresses, <tt>ipchains</tt> will act as if you had typed multiple commands with each combination of addresses. --> 時に単一のコマンドラインが複数のルールに影響させることができます。 これには二つの方法があります。 最初に、(DNS を用いて)複数の IP アドレスに解決するホスト名を指定 すると、 <tt>ipchains</tt> はあなたが各々のアドレスの組み合わせに対して複 数のコマンドを発行したのと同じように振る舞います。 <p> <!-- So if the hostname `www.foo.com' resolves to three IP addresses, and the hostname `www.bar.com' resolves to two IP addresses, then the command `ipchains -A input -j reject -s www.bar.com -d www.foo.com' would append six rules to the <tt>input</tt> chain. --> ですから、もしホスト名 `www.foo.com' が 3つの IP アドレスに解決 し、ホスト名 `www.bar.com' が 2つの IP アドレスに解決する場合、 コマンド `ipchains -A input -j reject -s www.bar.com -d www.foo.com' は、 <tt>input</tt> チェインに 6つのルールを追加することとなります。 <p> <!-- The other way to have <tt>ipchains</tt> perform multiple actions is to use the bidirectional flag (`-b'). This flag makes <tt>ipchains</tt> behave as if you had typed the command twice, the second time with the `-s' and `-d' arguments reversed. So, to avoid forwarding either to or from 192.168.1.1, you could do the following: --> <tt>ipchains</tt> に複数の動作を行わせるもう一つの方法は、双方向フラグ(`-b') を用います。 このフラグは、 <tt>ipchains</tt> にコマンドを 2回入力させたのと同様に振 る舞わせます。 その際の 2回目のコマンドは `-s' と `-d' の引数を反転させたこと になります。 ですので、 192.168.1.1 に相互にフォワードさせることを禁じさせる には、以下のようにできます: <tscreen><verb> # ipchains -b -A forward -j reject -s 192.168.1.1 # </verb></tscreen> <p> <!-- Personally, I don't like the `-b' option much; if you want convenience, see <ref id="ipchains-save" name="Using ipchains-save"> below. --> 個人的には、 `-b' オプションは好きでないです; もっと便利にしたいなら、後述の<ref id="ipchains-save" name="ipchains-save を使う">を見て下さい。 <p> <!-- The -b option can be used with the insert (`-I'), delete (`-D') (but not the variation which takes a rule number), append (`-A') and check (`-C') commands. --> -b オプションは 挿入 (`-I') 、 削除 (`-D') (でもルールナンバーの 拡張ではありません。) 、追加 (`-A') とチェック (`-C') コマンドと 共に使えます。 <p> <!-- Another useful flag is `-v' (verbose) which prints out exactly what <tt>ipchains</tt> is doing with your commands. This is useful if you are dealing with commands that may effect multiple rules. For example, here we check the behaviour of fragments between 192.168.1.1 and 192.168.1.2. --> もう一つの便利なフラグに `-v' (冗長な) があります。 これは <tt>ipchains</tt> があなたのコマンドによって何をしているのかを正確 にプリントアウトします。 あなたが複数のルールをコマンドを施しているのなら、これが便利です。 例えば、以下は 192.168.1.1 と 192.168.1.2 との間でフラグメントの 振る舞いをチェックする例です。 <tscreen><verb> # ipchains -v -b -C input -p tcp -f -s 192.168.1.1 -d 192.168.1.2 -i lo tcp opt ---f- tos 0xFF 0x00 via lo 192.168.1.1 -> 192.168.1.2 * -> * packet accepted tcp opt ---f- tos 0xFF 0x00 via lo 192.168.1.2 -> 192.168.1.1 * -> * packet accepted # </verb></tscreen> <!-- <sect1> Useful Examples --> <sect1> 実例集 <p> <!-- I have a dialup PPP connection (<tt>-i ppp0</tt>). I grab news (<tt>-p TCP -s news.virtual.net.au nntp</tt>) and mail (<tt>-p TCP -s mail.virtual.net.au pop-3</tt>) every time I dial up. I use Debian's FTP method to update my machine regularly (<tt>-p TCP -y -s ftp.debian.org.au ftp-data</tt>). I surf the web through my ISP's proxy while this is going on (<tt>-p TCP -d proxy.virtual.net.au 8080</tt>), but hate the ads from doubleclick.net on the Dilbert Archive (<tt>-p TCP -y -d 199.95.207.0/24</tt> and <tt>-p TCP -y -d 199.95.208.0/24</tt>). --> 私の PC はインターネットへダイヤルアップ PPP 接続されます。 (<tt>-i ppp0</tt>) 私はダイヤルアップの度毎にネットニュース (<tt>-p TCP -s news.virtual.net.au nntp</tt>) とメール (<tt>-p TCP -s mail.virtual.net.au pop-3</tt>) を PC に取り込みます。 私は Debian の FTP による PC の更新作業を定期的に行います。 (<tt>-p TCP -y -s ftp.debian.org.au ftp-data</tt>) 私は ISP のプロキシを介して web へのアクセスを行います (<tt>-p TCP -d proxy.virtual.net.au 8080</tt>) が、 Dilbert アーカイヴ上の doubleclick.net からの広告バナーを嫌い ます。 (<tt>-p TCP -y -d 199.95.207.0/24</tt> と <tt>-p TCP -y -d 199.95.208.0/24</tt>) <p> <!-- I don't mind people trying to ftp to my machine while I'm online (<tt>-p TCP -d $LOCALIP ftp</tt>), but don't want anyone outside pretending to have an IP address of my internal network (<tt>-s 192.168.1.0/24</tt>). This is commonly called IP spoofing, and there is a better way to protect yourself from it in the 2.1.x kernels and above: see <ref id="antispoof" name="How do I set up IP spoof protection?">. --> 私は PC がオンラインの際に誰かが私の PC に対して ftp を試みる ことに関しては気にしません。 (<tt>-p TCP -d $LOCALIP ftp</tt>) けれども、外部の誰かに私の内部ネットワーク (<tt>-s 192.168.1.0/24</tt>) の IP アドレスを偽装されたくありません。 これは通常、 IP スプーフィング (訳注: 偽装) と呼ばれ、バージョン 2.1.x 以降のカーネルにはこれを防ぐ良い方法があります: <ref id="antispoof" name="IP 偽装保護(IP Spoof Protection)を、どのように設定したらよいですか?">を参照して下さい。 <p> <!-- This setup is fairly simple, because there are currently no other boxes on my internal network. --> このセットアップはとても単純で、何故なら今私の内部ネットワーク上 には他にマシンがないからです。 <p> <!-- I don't want any local process (ie. Netscape, lynx etc.) to connect to doubleclick.net: --> 私はあらゆるローカルプロセス(すなわち、ネットスケープ、 lynx 等) を doubleclick.net に接続させたくありません。 <tscreen><verb> # ipchains -A output -d 199.95.207.0/24 -j REJECT # ipchains -A output -d 199.95.208.0/24 -j REJECT # </verb></tscreen> <p> <!-- Now I want to set priorities on various outgoing packets (there isn't much point in doing it on incoming packets). Since I have a fair number of these rules, it makes sense to put them all in a single chain, called <tt>ppp-out</tt>. --> さて、私は外へ出て行く様々なパケットに優先順位を設定したいです。 (入って来るパケットに対してこれを行う多くのメリットはありません。) これらのルールが多数あるので、<tt>ppp-out</tt> と名付けたチェインにそれら全てを 入れることは意味のあることです。 <tscreen><verb> # ipchains -N ppp-out # ipchains -A output -i ppp0 -j ppp-out # </verb></tscreen> <p> <!-- Minimum delay for web traffic & telnet. --> web のトラフィックと telnet へ最小遅延を設定します。 <tscreen><verb> # ipchains -A ppp-out -p TCP -d proxy.virtual.net.au 8080 -t 0x01 0x10 # ipchains -A ppp-out -p TCP -d 0.0.0.0/0 telnet -t 0x01 0x10 # </verb></tscreen> <p> <!-- Low cost for ftp data, nntp, pop-3: --> ftp データ, nntp, pop-3 に低コストを設定します: <tscreen><verb> # ipchains -A ppp-out -p TCP -d 0.0.0.0/0 ftp-data -t 0x01 0x02 # ipchains -A ppp-out -p TCP -d 0.0.0.0/0 nntp -t 0x01 0x02 # ipchains -A ppp-out -p TCP -d 0.0.0.0/0 pop-3 -t 0x01 0x02 # </verb></tscreen> <p> <!-- There are a few restrictions on packets coming in the ppp0 interface: let's create a chain called `ppp-in': --> ppp0 インターフェースに入って来るパケットには幾つかの制限があります: `ppp-in' というチェインを作りましょう: <tscreen><verb> # ipchains -N ppp-in # ipchains -A input -i ppp0 -j ppp-in # </verb></tscreen> <p> <!-- Now, no packets coming in <tt>ppp0</tt> should be claiming a source address of 192.168.1.*, so we log and deny them: --> さて、 <tt>ppp0</tt> に入って来るパケットは 192.168.1.* のソースアドレス を主張するべきではありません。 ですから、我々はそれらをログに記録して否定 (deny) します: <tscreen><verb> # ipchains -A ppp-in -s 192.168.1.0/24 -l -j DENY # </verb></tscreen> <p> <!-- I allow UDP packets in for DNS (I run a caching nameserver which forwards all requests to 203.29.16.1, so I expect DNS replies from them only), incoming ftp, and return ftp-data only (which should only be going to a port above 1023, and not the X11 ports around 6000). --> 私は DNS の UDP パケット (私は全ての要求を 203.29.16.1 へ転送する キャッシュネームサーバを動かしているので、それらの要求からその DNS だけが返答することを予測します。) と 入って来る ftp と帰って来る ftp-data (これらは1023番以上のポートのみが使われ、且つ6000番近辺の X11 ポー トを使いません。) の TCP パケットのみを許可します。 <tscreen><verb> # ipchains -A ppp-in -p UDP -s 203.29.16.1 -d $LOCALIP dns -j ACCEPT # ipchains -A ppp-in -p TCP -s 0.0.0.0/0 ftp-data -d $LOCALIP 1024:5999 -j ACCEPT # ipchains -A ppp-in -p TCP -s 0.0.0.0/0 ftp-data -d $LOCALIP 6010: -j ACCEPT # ipchains -A ppp-in -p TCP -d $LOCALIP ftp -j ACCEPT # </verb></tscreen> <p> <!-- I allow TCP reply packets back in --> 帰ってくる TCP の返答パケットを許可します。 <tscreen><verb> # ipchains -A ppp-in -p TCP ! -y -j ACCEPT # </verb></tscreen> <p> <!-- Finally, local-to-local packets are OK: --> 最後に、ローカルとローカル同士のパケットは OK です: <tscreen><verb> # ipchains -A input -i lo -j ACCEPT # </verb></tscreen> <p> <!-- Now, my default policy on the <tt>input</tt> chain is <tt>DENY</tt>, so everything else gets dropped: --> さて、私の <tt>input</tt> チェインにおける既定ポリシーは <tt>DENY</tt> (否定) です ので、上述のもの以外は全て破棄します: <tscreen><verb> # ipchains -P input DENY # </verb></tscreen> <p> <!-- NOTE: I wouldn't set up my chains in this order, as packets might get through while I'm setting up. Safest is usually to set the policy to DENY first, then insert the rules. Of course, if your rules require DNS lookups to resolve hostnames, you could be in trouble. --> 注意: 私はこの順番でチェインをセットアップしませんでした。 セットアップの最中にパケットが入り込んで来るからです。 最も安全なのは最初に DENY のポリシーを設定することです。 勿論、あなたのルールがホスト名を解決する為に DNS の参照を 要求するなら、問題が発生することでしょう。 <!-- <sect2> Using ipchains-save<label id="ipchains-save"> --> <sect2> ipchains-save を使う<label id="ipchains-save"> <p> <!-- Setting up firewall chains just the way you want them, and then trying to remember the commands you used so you can do them next time is a pain. --> まさにあなたのお望み通りのファイアウォールチェインをセットアップし、 そして次回にやったことを思い出そうとするのは辛いことです。 <p> <!-- So, <tt>ipchains-save</tt> is a script which reads your current chains setup and saves it to a file. For the moment I'll keep you in suspense with regards to what <tt>ipchains-restore</tt> does. --> そこで、今セットアップしたあなたのチェインを読み、ファイルに保存す る、 <tt>ipchains-save</tt> というスクリプトです。 <tt>ipchains-restore</tt> が何をするかに関してはちょっと待ってて下 さいね。 <p> <!-- <tt>ipchains-save</tt> can save a single chain, or all chains (if no chain name is specified). The only option currently permitted is `-v' which prints the rules (to stderr) as they are saved. The policy of the chain is also saved for <tt>input</tt>, <tt>output</tt> and <tt>forward</tt> chains. --> <tt>ipchains-save</tt> は単一のチェイン又は (チェイン名が指定されなければ) 全てのチェインをセーブできます。 オプションとしては `-v' のみが許され、これはセーブされたルールを (標準エラー出力に) プリントします。 <tt>input</tt>, <tt>output</tt> そして <tt>forward</tt> チェインのポリシーも同様にセーブされ ます。 <tscreen><verb> # ipchains-save > my_firewall Saving `input'. Saving `output'. Saving `forward'. Saving `ppp-in'. Saving `ppp-out'. # </verb></tscreen> <!-- <sect2> Using ipchains-restore --> <sect2> ipchains-restore を使う <p> <!-- <tt>ipchains-restore</tt> restores chains as saved with <tt>ipchains-save</tt>. It can take two options: `-v' which describes each rule as it is added, and `-f' which forces flushing of user-defined chains if they exist, as described below. --> <tt>ipchains-restore</tt> は <tt>ipchains-save</tt> で保存されたチェインを復元します。 これは 2つのオプションを持ち得ます: `-v' は各々のルールが追加されるように説明します。 そして `-f' は以下に説明するように、既に存在するユーザー定義チェイン を強制的に消去します。 <p> <!-- If a user-defined chain is found in the input, <tt>ipchains-restore</tt> checks if that chain already exists. If it does, then you will be prompted whether the chains should be flushed (cleared of all rules) or whether restoring this chain should be skipped. If you specified `-f' on the command line, you will not be prompted; the chain will be flushed. --> もし、 input チェイン内にユーザー定義チェインがあれば、 <tt>ipchains-restore</tt> はそれが既存のチェインなのかをチェックします。 そうであれば、プロンプトが表示され、チェインを消去する (全てのルール を消去する) か、処理をスキップして現在の設定を保持するかの選択を求め られます。 もしコマンドラインに `-f' を指定すれば、プロンプトは表示されません: チェインは消去されます。 <p> <!-- For example: --> 例: <tscreen><verb> # ipchains-restore < my_firewall Restoring `input'. Restoring `output'. Restoring `forward'. Restoring `ppp-in'. Chain `ppp-in' already exists. Skip or flush? [S/f]? s Skipping `ppp-in'. Restoring `ppp-out'. Chain `ppp-out' already exists. Skip or flush? [S/f]? f Flushing `ppp-out'. # </verb></tscreen> <!-- 4章 Hiroyuki YAMAMORI <h-yamamo@db3.so-net.ne.jp> Setoguchi Takashi <setzer@mx3.tiki.ne.jp> MIZUHARA Bun <mizuhara@acm.org> TAKEI Nobumitsu <takei@webmasters.gr.jp> Daisuke KATO <daisuke@terra.dti.ne.jp> --> <!-- 4章ここまで by松田 --> <!-- 5章ここから by中谷 --> <!-- <sect> Miscellaneous. --> <sect>その他の情報 <p> <!-- This section contains all the information and FAQs that I couldn't fit inside the structure above. --> この項は上述の説明からもれたすべての情報と FAQ 集があります。 <!-- <sect1>How to Organize Your Firewall Rules<label id="organisation"> --> <sect1>ファイアウォールルールをどのように構築するか<label id="organisation"> <p> <!-- This question requires some thought. You can try to organize them to optimize speed (minimize the number of rule-checks for the most common packets) or to increase manageability. --> この問題にはある種の方針が必要です。速度を最適化(最も普通のパケットに対するルールチェックを最小限にとどめる)して構築するか、管理性を高めて構築することもできます。 <p> <!-- If you have an intermittent link, say a PPP link, you might want to set the first rule in the input chain to be set to `-i ppp0 -j DENY' at boot time, then have something like this in your <tt>ip-up</tt> script: --> PPP リンクと言う間欠的なリンクを使っているなら、起動時に input チェインの最初のルールを `-i ppp0 -jDENY' に設定したいと思うかもしれません。 その場合は、 <tt>ip-up</tt> スクリプトファイルで次のようにします。 (訳注: デバイス ppp0 からのパケットを破棄する。ダイヤルアップ回線などからの侵入を防止した場合に設定する。) <!-- <tscreen><verb> # Re-create the `ppp-in' chain. ipchains-restore -f < ppp-in.firewall # Replace DENY rule with jump to ppp-handling chain. ipchains -R input 1 -i ppp0 -j ppp-in </verb></tscreen> --> <tscreen><verb> # `ppp-in' チェインを再生成する。 ipchains-restore -f < ppp-in.firewall # ppp-handling チェインに割り込んで DENY ルールを置き換える。 ipchains -R input 1 -i ppp0 -j ppp-in </verb></tscreen> <p> <!-- Your <tt>ip-down</tt> script would look like: --> <tt>ip-down</tt> は次のようになります。 <tscreen><verb> ipchains -R input 1 -i ppp0 -j DENY </verb></tscreen> <!-- <sect1> What Not To Filter Out --> <sect1>フィルタリングで破棄してはいけないパケット <p> <!-- There are some things you should be aware of before you start filtering out everything you don't want. --> 必要でないパケットをフィルタリングで破棄する前に注意しておかなければいけない事があります。 <!-- <sect2> ICMP packets<label id="ICMP"> --> <sect2> ICMP パケット<label id="ICMP"> <p> <!-- ICMP packets are used (among other things) to indicate failure for other protocols (such as TCP and UDP). `destination-unreachable' packets in particular. Blocking these packets means that you will never get `Host unreachable' or `No route to host' errors; any connections will just wait for a reply that never comes. This is irritating, but rarely fatal. --> ICMP パケットは、(TCP や UDP のような)別のプロトコルに対して、失敗を表示 (その他数あるもののなかで) するのに使われています。 とりわけ `目的地に到達しない' パケットを表示します。 これらのパケットをブロックすると、 `ホストに到達しません' や `ホストへの経路がありません' というエラーを受け取ることができなくなります。 どのような接続も来るはずのない返答を待つだけになります。 これはいらいらしますが致命的ではありません。 <p> <!-- A worse problem is the role of ICMP packets in MTU discovery. All good TCP implementations (Linux included) use MTU discovery to try to figure out what the largest packet that can get to a destination without being fragmented (fragmentation slows performance, especially when occasional fragments are lost). MTU discovery works by sending packets with the "Don't Fragment" bit set, and then sending smaller packets if it gets an ICMP packet indicating "Fragmentation needed but DF set" (`fragmentation-needed'). This is a type of `destination-unreachable' packet, and if it is never received, the local host will not reduce MTU, and performance will be abysmal or non-existent. --> さらに悪いことは MTU 検出での ICMP パケットの役割です。 すべての良好な TCP の実装(Linux を含めた)は、分割されない状態で(分割されるとパフォーマンスを低下させ、とりわけ、ときどき分割された断片が失われるとさらに低下します)目的地に到達する最大のパケットサイズを割り出すために MTU 検出を使っています。 MTU 検出は、まずパケットを "分割不可" のビットを設定して送り、 '分割が必要だが分割しない設定(DF)をしている'というエラーを示す ICMP パケットを受け取ったら、先ほどのものより小さいサイズのパケットを送り直す、というやりかたで動作します。 これは、`目的地へ到達不能' パケットのタイプで、もし受けないなら、ローカルホストは MTU を低下させないで、実行はひどく悪くなるか、存在しないことになるでしょう。 訳注: <descrip> <tag>ICMP: Internet Control Message Protocol </tag> IP 相互接続ネットワーク内のノードでエラー通達、診断、制御のための メッセージを送るプロトコル <tag>MTU: maximum transmission unit</tag> ネットワークインターフェースが一度に送ることができる最大のデータ量 </descrip> <p> <!-- Note that it is common to block all ICMP redirect messages (type 5); these can be used to manipulate routing (although good IP stacks have safeguards), and so are often seen as slightly risky. --> すべての ICMP 経路変更要求メッセージ(type 5)をブロックするのは普通だということに注意して下さい。 これらは、経路を手動設定する為に使うことが出来ますが(良好な IP スタックは安全装置を持っています)、しばしばやや危険だと知られています。 <!-- <sect2> TCP Connections to DNS (nameservers) --> <sect2> DNS (ネームサーバー) への TCP 接続 <p> <!-- If you're trying to block outgoing TCP connections, remember that DNS doesn't always use UDP; if the reply from the server exceeds 512 bytes, the client uses a TCP connection (still going to port number 53) to get the data. --> 外向きの TCP 接続をブロックするようにしているなら、 DNS はいつも UDP を使わないことに注意して下さい。 サーバからの返答が 512 バイトを越えると、クライアントはデータを得るのに TCP 接続(やはり 53 番ポート番号) を使います。 訳注: <descrip> <tag>UDP: User Datagram Protocol </tag> データパケットの転送を行うプログラム。UDP は TCP に比べると高速で すが、信頼性が低く、パケットの到達順序が保証されません。 </descrip> <p> <!-- This can be a trap because DNS will `mostly work' if you disallow such TCP transfers; you may experience strange long delays and other occasional DNS problems if you do. --> TCP 転送を禁止していても、 DNS が `ほとんど動く' のでハマリます。 そのようにしているなら、不可解な長い遅延やその他のときどき発生する DNS の問題を経験することになるでしょう。 <p> <!-- If your DNS queries are always directed at the same external source (either directly by using the <tt>nameserver</tt> line in <tt>/etc/resolv.conf</tt> or by using a caching nameserver in forward mode), then you need only allow TCP connections to port <tt>domain</tt> on that nameserver from the local <tt>domain</tt> port (if using a caching nameserver) or from a high port (> 1023) if using <tt>/etc/resolv.conf</tt>. --> DNS の問い合わせが、いつも同一の外部のソース(<tt>/etc/resolv.conf</tt> に書かれた行の<tt>ネームサーバ</tt>を直接使うか、フォワードモードでキャッシュのネームサーバーを使うかのどちらか)にしているなら、(キャッシュを使っているなら)ローカル <tt>domain</tt> ポートから、 <tt>/etc/resolv.conf</tt> を使っているならハイポート(>1023)から、そのネームサーバの <tt>domain</tt> ポートへの TCP 接続を許可する必要だけでかまいません。 訳注: domain は /etc/services に次の項目が定義されているかを確認しておきます。 次のようにして調べることができます。 <tscreen><verb> $ grep domain /etc/services domain 53/tcp nameserver # name-domain server domain 53/udp nameserver </verb></tscreen> <!-- <sect2> FTP Nightmares<label id="ftp"> --> <sect2> FTP の悪夢<label id="ftp"> <p> <!-- The classic packet filtering problem is FTP. FTP has two <bf>modes</bf>; the traditional one is called <bf>active mode</bf> and the more recent one is called <bf>passive mode</bf>. Web browsers usually default to passive mode, but command-line FTP programs usually default to active mode. --> 典型的なパケットフィルタリングの問題は FTP です。FTP には2つの<bf>モード</bf>があります。 伝統的なものは <bf>アクティブモード</bf> と言われるもので、より最近のものは、 <bf>パッシブモード</bf> と言われます。 Web ブラウザは通常パッシブモードがデフォルトですが、コマンドの FTP プログラムは通常アクティブモードがデフォルトです。 <p> <!-- In active mode, when the remote end wants to send a file (or even the results of an <tt>ls</tt> or <tt>dir</tt> command) it tries to open a TCP connection to the local machine. This means you can't filter out these TCP connections without breaking active FTP. --> アクティブモードでは、リモートホストがファイルを送信したいとき(あるいは、 <tt>ls</tt> や <tt>dir</tt> コマンドの結果でさえ)、ローカルマシンへの TCP 接続をオープンしようとします。 これはアクティブ FTP を切断しないなら、これらの TCP 接続を排除できないということです。 <p> <!-- If you have the option of using passive mode, then fine; passive mode makes data connections from client to server, even for incoming data. Otherwise, it is recommended that you only allow TCP connections to ports above 1024 and not between 6000 and 6010 (6000 is used for X-Windows). --> パッシブモードを使うオプションがあるなら、良いことです。 パッシブモードは入力データに対しても、クライアントからサーバにデータ接続を作ります。 パッシブモードが使えないなら、TCP 接続に 1024 を越え、6000 から 6010 の範囲に無いポートに対して TCP 接続を許可することを推奨します。(6000 は X-Window System に使われています。) <!-- <sect1> Filtering out Ping of Death --> <sect1> Ping of Death を排除する <p> <!-- Linux boxes are now immune to the famous <bf>Ping of Death</bf>, which involves sending an illegally-large ICMP packet which overflows buffers in the TCP stack on the receiver and causes havoc. --> Linux マシンはいまや有名な<bf> Ping of Death </bf>を心配することはありません。 Ping of Death は不法に大きな ICMP パケットを送信し、それは受け取り側で TCP スタックにあるバッファーを溢れさせ、破壊の原因になります。 <p> <!-- If you are protecting boxes which might be vulnerable, you could simply block ICMP fragments. Normal ICMP packets aren't large enough to require fragmentation, so you won't break anything except big pings. I have heard (unconfirmed) reports that some systems required only the last fragment of an oversize ICMP packet to corrupt them, so blocking only the first fragment is not recommended. --> 脆弱なマシンを保護するなら、単純に ICMP フラグメントをブロックできます。 通常の ICMP パケットは分割を要求するほど大きくはありませんから、大きな ping を排除する以外他には影響を与えません。 (不確かですが)私は、ICMP フラグメントを落すために、サイズオーバーの ICMP パケットの最後のフラグメントだけを要求し、その結果、最初のフラグメントだけをブロックするシステムがあるという報告を聞いたことがありますが、最初のフラグメントだけをブロックするようなシステムはお勧めできません。 <p> <!-- While the exploit programs I have seen all use ICMP, there is no reasons that TCP or UDP fragments (or an unknown protocol) could not be used for this attack, so blocking ICMP fragments is only a temporary solution. --> 私は ICMP を使うすべてのプログラムを見てきましたが、TCP や UDP フラグメント(あるいは不明のプロトコル)は、このような攻撃に対して使うことができないという理由がないので、 ICMP フラグメントをブロックするのは、間に合わせの解決でしかありません。 <!-- <sect1> Filtering out Teardrop and Bonk --> <sect1> Teardrop と Bonk を排除する <p> <!-- Teardrop and Bonk are two attacks (mainly against Microsoft Windows NT machines) which rely on overlapping fragments. Having your Linux router do defragmentation, or disallowing all fragments to your vulnerable machines are the other options. --> Teardrop と Bonk と言われるものは、重複するフラグメントを目的にしている 2種類の攻撃(おもにMicrosoft Windows NT マシンに対して)です。 Linux ルータがデフラグ機能を持っているか、攻撃されやすいマシンにすべてのフラグメントを禁止するのは別のオプションです。 <!-- <sect1> Filtering out Fragment Bombs --> <sect1> フラグメント爆撃を排除する <p> <!-- Some less-reliable TCP stacks are said to have problems dealing with large numbers of fragments of packets when they don't receive all the fragments. Linux does not have this problem. You can filter out fragments (which might break legitimate uses) or compile your kernel with `IP: always defragment' set to `Y' (only if your Linux box is the only possible route for these packets). --> 信頼性の低い TCP スタックは、パケットが多数のフラグメントになっていて、それらをすべて受信できないとき、大量のフラグメントを扱うのに問題を持っているものがあると言われています。 Linux はこのような問題がありません。 フラグメントを破棄(正当に使用されたものも壊すかもしれません)するか、または、 `IP: always defragment' を `Y' と(あなたの Linux マシンがこれらのパケットに対して唯一取り得る経路である場合のみ)選択したカーネルをコンパイルすることで排除できます。 <!-- <sect1> Changing Firewall Rules --> <sect1>ファイアウォールルールを変更する <p> <!-- There are some timing issues involved in altering firewall rules. If you are not careful, you can let packets through while you are half-way through your changes. A simplistic approach is to do the following: --> ファイアウォールルールを変更するとき、タイミングの問題があります。 不手際があると、変更の途中でにパケットを通してしまいます。 安易なやりかたとしては次のような方法があります: <!-- <tscreen><verb> # ipchains -I input 1 -j DENY # ipchains -I output 1 -j DENY # ipchains -I forward 1 -j DENY . make changes ... # ipchains -D input 1 # ipchains -D output 1 # ipchains -D forward 1 # </verb></tscreen> --> <tscreen><verb> # ipchains -I input 1 -j DENY # ipchains -I output 1 -j DENY # ipchains -I forward 1 -j DENY . 変更します ... # ipchains -D input 1 # ipchains -D output 1 # ipchains -D forward 1 # </verb></tscreen> <!-- This drops all packets for the duration of the changes. --> 変更している間、すべてのパケットが破棄されます。 <p> <!-- If your changes are restricted to a single chain, you might want to create a new chain with the new rules, and then replace (`-R') the rule that pointed to the old chain with one that points to the new chain: then you can delete the old chain. This replacement will occur atomically. --> <!-- 変更が単一のチェインに限定されたものなら、新しいルールで新しいチェインを作りたいかもしれません。 新しいチェインを示すものと、古いチェインを示すルールを置き換えます(`-R')。 そうすれば、古いチェインを削除できます。この置き換えは他のものには影響しないで行われます。 --> <!-- Modified by [yoh] <yoh@coolmail.net> --> 変更が単一のチェインに限定されたものなら、新しいルールで新しいチェインを作りたいかもしれません。 新しいチェインを示すものと、古いチェインを示すルールを置き換えます(`-R')。 そうすれば、古いチェインを削除できます。 この置き換えはアトミックに(他のものには影響しないで)行われます。 <!-- <sect1> How Do I Set Up IP Spoof Protection?<label id="antispoof"> --> <sect1>IP 偽装保護(IP Spoof Protection)を、どのように設定したらよいですか?<label id="antispoof"> <p> <!-- IP spoofing is a technique where a host sends out packets which claim to be from another host. Since packet filtering makes decisions based on this source address, IP spoofing is uses to fool packet filters. It is also used to hide the identity of attackers using SYN attacks, Teardrop, Ping of Death and the like (don't worry if you don't know what they are). --> IP 偽装は、ホストが別のホストから請求されるパケットを送り出す技術です。 パケットフィルタリングは、このソースアドレスをもとに判定するので、 IP 偽装はパケットフィルターをごまかすために使うものです。 SYN 攻撃やしずく(Teardrop)、また命取りの Ping(Ping of Death) やそれに似たもの(それらが何者かを知らないなら心配は不用です)を使っている攻撃者の身元を隠すためにもまた使われます。 <p> <!-- The best way to protect from IP spoofing is called Source Address Verification, and it is done by the routing code, and not firewalling at all. Look for a file called <tt>/proc/sys/net/ipv4/conf/all/rp_filter</tt>. If this exists, then turning on Source Address Verification at every boot is the right solution for you. To do that, insert the following lines somewhere in your init scripts, before any network interfaces are initialized: --> IP 偽装を防御するもっともよい方法は、ソースアドレス認証(Source Address Verification)と言われるもので、それはルーティングコードによって行われるもので、全くファイアウォールではありません。 <tt>/proc/sys/net/ipv4/conf/all/rp_filter</tt> というファイルを探して下さい。 これがあるなら、始動するたびにソースアドレス認証(Source Address Verification)を有効することが正しい解決になります。 このようにするため、いずれかのネットワークインターフェースが初期化される前に、お使いの init スクリプトのどこかに次の行を加えます。 <!-- <tscreen><verb> # This is the best method: turn on Source Address Verification and get # spoof protection on all current and future interfaces. if [ -e /proc/sys/net/ipv4/conf/all/rp_filter ]; then echo -n "Setting up IP spoofing protection..." for f in /proc/sys/net/ipv4/conf/*/rp_filter; do echo 1 > $f done echo "done." else echo PROBLEMS SETTING UP IP SPOOFING PROTECTION. BE WORRIED. echo "CONTROL-D will exit from this shell and continue system startup." echo # Start a single user shell on the console /sbin/sulogin $CONSOLE fi </verb></tscreen> --> <tscreen><verb> # これがもっとも良い方法です: ソースアドレス認証 # (Source Address Verification) を有効にし、現在あるものとこれから # 使うすべてのインターフェースに偽装保護をします。 if [ -e /proc/sys/net/ipv4/conf/all/rp_filter ]; then echo -n "Setting up IP spoofing protection..." for f in /proc/sys/net/ipv4/conf/*/rp_filter; do echo 1 > $f done echo "done." else echo PROBLEMS SETTING UP IP SPOOFING PROTECTION. BE WORRIED. echo "CONTROL-D will exit from this shell and continue system startup." echo # コンソール上でシングルユーザシェルを起動します。 /sbin/sulogin $CONSOLE fi </verb></tscreen> <p> <!-- If you cannot do this, you can manually insert rules to protect every interface. This requires knowledge of each interface. The 2.1 kernels automatically reject packets claiming to come from the 127.* addresses (reserved for the local loopback interface, <tt>lo</tt>). --> これができないなら、すべてのインターフェースを保護するために手動でルールを書き加えます。 この場合はそれぞれのインターフェースについての知識が必要です。 カーネル 2.1 は自動的に127.* のアドレス(ローカルループバックインターフェース <tt>lo</tt> に予約されたもの)から要求するパケットを拒否します。 <!-- <p>For example, say we have three interfaces, <tt>eth0</tt>, <tt>eth1</tt> and <tt>ppp0</tt>. We can use <tt>ifconfig</tt> to tell us the address and netmask of the interfaces. Say <tt>eth0</tt> was attached to a network 192.168.1.0 with netmask 255.255.255.0, <tt>eth1</tt> was attached to a network 10.0.0.0 with netmask 255.0.0.0, and <tt>ppp0</tt> connected to the Internet (where any address except the reserved private IP addresses are allowed), we would insert the following rules: --> <p>例えば <tt>eth0</tt>, <tt>eth1</tt> そして <tt>ppp0</tt> の 3つのインター フェースがあります。 インターフェースのアドレスとネットマスクを知るために <tt>ifconfig</tt> を使うことができます。 例えば、 <tt>eth0</tt> がネットマスク 255.255.255.0 のネットワーク 192.168.1.0 にアタッチされ、 <tt>eth1</tt> はネットマスク 255.0.0.0 のネットワーク 10.0.0.0 にアタッチされ、 <tt>ppp0</tt> がインターネット(予約されたプライベート IP アド レスを除いて、どんなアドレスでも許されます)。次のようなルールを加えるとよいでしょう。 <tscreen><verb> # ipchains -A input -i eth0 -s ! 192.168.1.0/255.255.255.0 -j DENY # ipchains -A input -i ! eth0 -s 192.168.1.0/255.255.255.0 -j DENY # ipchains -A input -i eth1 -s ! 10.0.0.0/255.0.0.0 -j DENY # ipchains -A input -i ! eth1 -s 10.0.0.0/255.0.0.0 -j DENY # </verb></tscreen> <p> <!-- This approach is not as good as the Source Address Verification approach, because if your network changes, you have to change your firewalling rules to keep up. --> この方法はお使いのネットワークが変わると、いままでのその状態を維持するためにあなたはファイアウォールルールを変更しなければいけないので、ソースアドレス認証(Source Address Verification)で行うほど良くありません。 <p> <!-- If you are running a 2.0 series kernel, you might want to protect the loopback interface as well, using a rule like this: --> 2.0 系のカーネルをお使いなら、次に示すようなルールを使って、ループバックインターフェースもまた保護したいかもしれません。 次のようにルールを使います: <tscreen><verb> # ipchains -A input -i ! lo -s 127.0.0.0/255.0.0.0 -j DENY # </verb></tscreen> <!-- <sect1> Advanced Projects --> <sect1> 最新のプロジェクト <p> <!-- There is a userspace library I have written which is included with the source distribution called `libfw'. It uses the ability of IP Chains 1.3 and above to copy a packet to userspace (using the IP_FIREWALL_NETLINK config option). --> <!-- 原文ですが、たぶん、ipchains > 1.3 and above to copy a packet to userspace (using the version (1.3 or above) だろうと思います。.--> 私はユーザスペースライブラリを書いており、それは`libfw' と呼ばれるソースディストリビューションを含んでいます。 それは ipchains のバージョン 1.3 以上の能力を使用して(IP_FIREWALL_NETLINK のコンフィグオプションを使って)ユーザスペースにパケットをコピーします。 <p> <!-- The mark value can be used to specify the Quality of Service parameters for packets, or to specify how packets should be port-forwarded. I've never used either, but if you want to write about it, please contact me. --> マーク値はパケットのための Service の質 (QoS) パラメータを決めるために使うか、あるいは、パケットがどのようにポートに中継されるかを決めるために使うことができます。 私はどちらも利用していませんが、あなたがそれについて書いてみようと思うなら、どうぞ私に連絡をして下さい。 <!-- <p>Things such as <bf>stateful inspection</bf> (I prefer the term dynamic firewalling) can be implemented in userspace using this library. Other nifty ideas include controlling packets on a per-user basis by doing a lookup in a userspace daemon. This should be pretty easy. --> <p><bf>状態観察(stateful inspection)</bf>(私はダイナミックファイアウォールという言葉を提唱します)のようなことは、このライブラリを使うユーザスペースで実装されるでしょう。 その他の素晴らしいアイディアは、ユーザスペースデーモンで探すことでユーザごとの基盤上でパケットをコントロールします。 これはとても簡単でなければなりません。 <!-- <sect2> SPF: Stateful Packet Filtering --> <sect2> SPF: ステートフルパケットフィルタリング <!-- <p><url url="ftp://ftp.interlinx.bc.ca/pub/spf" name="ftp://ftp.interlinx.bc.ca/pub/spf"> is the site of Brian Murrell's SPF project, which does connection tracking in userspace. It adds significant security for low-bandwidth sites. --> <p><url url="ftp://ftp.interlinx.bc.ca/pub/spf" name="ftp://ftp.interlinx.bc.ca/pub/spf"> 上記は、 Brian Murrell の SPF プロジェクトのサイトで、それはユーザスペースで接続の追跡をします。 低バンド幅のサイトに重要なセキュリティを追加しています。 <!-- <p>There's little documentation at present, but here's a post to the mailing list in which Brian answered some questions: --> <p>現在、SPF についての文書はほとんどありませんが、次のものは Brian が質問に答えたものをメーリングリストに投稿したものです。 <!-- <tscreen><verb> > I believe it does exactly what I want: Installing a temporary > "backward"-rule to let packets in as a response to an > outgoing request. Yup, that is exactly what it does. The more protocols it understands, the more "backward" rules it gets right. Right now it has support for (from memory, please excuse any errors or omissions) FTP (both active and passive, in and out), some RealAudio, traceroute, ICMP and basic ICQ (inbound from the ICQ servers, and direct TCP connections, but alas the secondary direct TCP connections for things like file transfer, etc. are not there yet) > Is it a replacement for ipchains or a supplement? It is a supplement. Think of ipchains as the engine to allow and prevent packets from travelling across a Linux box. SPF is the driver, constantly monitoring traffic and telling ipchains how to change it's policies to reflect the changes in traffic patterns. </verb></tscreen> --> <tscreen><verb> > それこそが正に私の望むことを行なうと信じています。 > 外部への要求のレスポンスとしてパケットを通すように > 一時的な''逆流(backward)''のルールをインストールしています。 はい、その通りです。 プロトコルについて理解すればするほど、 "逆流(backward)" のルールはもっと正しくなります。 今のところは、 (覚えで書いています、エラーや手抜かりがあっても許して下さい) FTP(アクティブとパッシブ、内側と外側の両方)、RealAudio、 traceroute、 ICMP そして初歩的な ICQ( ICQ サーバから入るもの、そして、直接的な TCP 接続からのもの、しかしながらファイル転送のようなことに関する第2 の直接的な TCP 接続などはまだありませんが)をサポートしています。 > SPF は ipchains を置き換えるのですか、それとも補足するのですか。 補足するものです。 ipchains は Linux マシンを越えて伝わるパケットを許可したり、防いだりする道具です。 SPF はドライバであり、トラフィックをたえず監視して、どのように変更するかを ipchains に伝え、 ipchains は、変更をトラフィックパターンに伝えます。 </verb></tscreen> <!-- <sect2> Michael Hasenstein's ftp-data hack --> <sect2> Michael Hasenstein の ftp-data ハック <!-- <p> Michael Hasenstein of SuSE has written a kernel patch which adds ftp connection tracking to ipchains. It can currently be found at --> <p> SuSE の Michael Hasenstein は ipchains に ftp 接続の追跡機能を追加するカーネルパッチを書いています。 次のところにあります。 <url url="http://www.suse.de/~mha/patch.ftp-data-2.gz" name="http://www.suse.de/~mha/patch.ftp-data-2.gz"> <!-- <sect1> Future Enhancements --> <sect1> 今後の課題 <p> <!-- Firewalling and NAT have being redesigned for 2.4. Plans and discussions are available on the netfilter list (see <url url="http://lists.samba.org" name="http://lists.samba.org">). These enhancements should clear up many outstanding usability issues (really, firewalling and masquerading shouldn't be <em>this hard</em>), and allow growth for far more flexible firewalling. --> ファイアウォールと NAT は 2.4 で再設計されています。 計画と議論は netfilter のメーリングリストで利用できます。 ( <url url="http://lists.samba.org" name="http://lists.samba.org">を見て下さい) このような強化は多くの利便性の問題を解決し、(実際、ファイアウォールやマスカレードは<em>このような困難</em> はないはずです)、そしてもっとはるかに柔軟性のあるファイアウォールの発展を促すはずです。 <!-- 5章ここまで by中谷 --> <!-- 6章ここから by中谷 --> <!-- <sect> Common Problems --> <sect> 一般的な問題 <p> <!-- <sect1> ipchains -L Freezes! --> <!-- <sect1>ipchains -L を使うとフリーズします。 --> <!-- Modified by [yoh] <yoh@coolmail.net> --> <sect1>ipchains -L を使うとフリーズします! <p> <!-- You're probably blocking DNS lookups; it will eventually time out. Try using the `-n' (numeric) flag to ipchains, which suppresses the lookup of names. --> DNS 検索を受け付けないのでしょう。結局はタイムアウトになってしまいます。 ipchains に対して `-n' (数値)フラグを使ってみましょう。 `-n' は、ネームでの検索を行いません。 <p> <!-- <sect1> Inverse doesn't work! --> <!-- <sect1> 反転ができません。 --> <!-- Modified by [yoh] <yoh@coolmail.net> --> <sect1> 反転ができません! <p> <!-- You must put the `!' option by itself, with spaces either side. A classic mistake (warned about in 1.3.10) is: --> `!'オプションの両側にスペースをおいて、`!' オプションを単独で使わなければいけません。 (4.1.4.1 で注意しました)典型的な間違いです。 <!--英文では1.3.10 でとなっていますが、4.1.4.1 に変更になっています。--> <tscreen><verb> # ipchains -A input -i !eth0 -j DENY # </verb></tscreen> <!-- There will never be an interface called `!eth0', but ipchains doesn't know that. --> `!eth0' と呼ばれるインターフェースは存在しませんが、 ipchains はそれがわからないのです。 (訳注: `!' の使い方に関する注意は、 4章を参照。 `!' オプションの前後のスペースを忘れないで下さい。) <p> <!-- <sect1> Masquerading/Forwarding Doesn't Work! --> <!-- <sect1>Masquerading または Forwarding が動きません。 --> <!-- Modified by [yoh] <yoh@coolmail.net> --> <sect1>Masquerading または Forwarding が動きません! <p> <!-- Make sure that packet forwarding is enabled (in recent kernels it is disabled by default, meaning that packets never even try to traverse the `forward' chain). You can override this (as root) by typing --> パケットの forwarding が可能になっているのかどうかを確認して下さい(最近のカーネルでは、デフォルトで `使用しない'になっています。パケットは `forward' chain を越えることすらないということです)。 root 権限で次のように入力すれば変更できます。 <tscreen><verb> # echo 1 > /proc/sys/net/ipv4/ip_forward # </verb></tscreen> <p> <!-- If this works for you, you can put this somewhere in your bootup scripts so it is enabled every time; you'll want to set up your firewalling before this command runs though, otherwise there's an opportunity for packets to slip through. --> これでうまくいくなら、毎回、可能になるように、お使いの起動スクリプトのどこかにこの行を書いておくことができます。 このコマンドが動く前にファイアウォールを設定したいはずです。 そうしないと、(破棄すべき)パケットを通過させてしまう機会を与えてしまいます。 <p> <!-- <sect1> -j REDIR doesn't work! --> <!-- <sect1> -j REDIR が動きません。 --> <!-- Modified by [yoh] <yoh@coolmail.net> --> <sect1> -j REDIR が動きません! <p> <!-- You must allow forwarding packets (see above) for redirect to work; otherwise the routing code drops the packet. So if you are just using redirect, and don't have any forwarding at all, you should be aware of that. --> リダイレクトを動かすためにはパケットの forwarding (上述を見て下さい)を許可しなければいけません。 そうしないと、ルーティングのコードはパケットを落します。 そこで、リダイレクトのみを使っていてフォワーディングは全然使っていないならば、このことに注意して下さい。 <p> <!-- Note that REDIR (being in the input chain) doesn't effect connections from a local process. --> REDIRECT (input チェインにある)は、ローカルプロセスからの接続には効果がないことに注意して下さい。 (訳注: ipchains のオプションについては、man ipchains で確認して下さい。) <!-- <sect1> Wildcard Interfaces Don't Work! --> <!-- <sect1> ワイルドカードインターフェースが動きません。 --> <!-- Modified by [yoh] <yoh@coolmail.net> --> <sect1> ワイルドカードインターフェースが動きません! <p> <!-- There was a bug in versions 2.1.102 and 2.1.103 of the kernel (and some old patches I produced) which made ipchains commands which specified a wildcard interface (such as <tt>-i ppp+</tt>) fail. --> カーネルの 2.1.102 と 2.1.103 版(そして私が作ったいくつかの古いパッチ)にはバグがありました。 それらのカーネルでは、(-i ppp+ のような)ワイルドカードインターフェースがうまくいかないエラーを明示する ipchains コマンドを生成しました。 <p> <!-- This is fixed in recent kernels, and in the 2.0.34 patch on the web site. You can also fix it by hand in the kernel source by changing line 63 or so in include/linux/ip_fw.h: --> この件は、最新のカーネルと web サイトにある 2.0.34 のパッチでは修正されています。 カーネルソースを手で修正するなら、 include/linux/ip_fw.h ファイルの 63行あたりを次のように変更します: <tscreen><verb> #define IP_FW_F_MASK 0x002F /* All possible flag bits mask */ </verb></tscreen> <p> <!-- This should read ``0x003F''. Fix this and recompile the kernel. --> これは ``0x003F'' を読むべきです。これを修正し、カーネルを再構築します。 <!-- <sect1> TOS Doesn't Work! --> <!-- <sect1> TOS (Type of Service) が動きません。 --> <!-- Modified by [yoh] <yoh@coolmail.net> --> <sect1> TOS (Type of Service) が動きません! <p> <!-- This was my mistake: setting the Type of Service field did not actually set the Type of Service in kernel versions 2.1.102 through 2.1.111. This problem was fixed in 2.1.112. --> これは私の間違いでした。 Service field のタイプを設定は、 2.1.102 から 2.1.111 版のカーネルでは実際には Service のタイプを設定できないのです。 この問題は、2.1.112 では修正されました。 <!-- <sect1> ipautofw and ipportfw Don't Work! --> <!-- <sect1> ipautofw とipportfw が動きません。 --> <!-- Modified by [yoh] <yoh@coolmail.net> --> <sect1> ipautofw とipportfw が動きません! <p> <!-- For 2.0.x, this is true; I haven't time to create and maintain a jumbo patch for ipchains and ipautofw/ipportfw. --> 2.0.x では動きません。 ipchains とipautofw あるいは ipportfw に対する大きなパッチを作成し、維持する時間がありません。 <p> <!-- For 2.1.x, download Juan Ciarlante's ipmasqadm from --> 2.1.x に対しては、次のところから Juan Ciarlante の ipmasqadm をダウンロードして下さい。 <url url="http://juanjox.linuxhq.com/" name="http://juanjox.linuxhq.com/"> <!-- and use it exactly as you would have used <tt>ipautofw</tt> or <tt>ipportfw</tt>, except instead of <tt>ipportfw</tt> you type <tt>ipmasqadm portfw</tt>, and instead of <tt>ipautofw</tt> you type <tt>ipmasqadm autofw</tt>. --> そして、<tt>ipautofw</tt> や<tt>ipportfw</tt> を使うとき、 <tt>ipportfw</tt> のかわりに <tt>ipmasqadm portfw</tt> を入力し、そして、 <tt>ipautofw</tt> のかわりに<tt>ipmasqadm autofw</tt> を入力して、きちんと使って下さい。 <!-- <sect1> xosview is Broken! --> <!-- <sect1> xosview が壊れています。 --> <!-- Modified by [yoh] <yoh@coolmail.net> --> <sect1> xosview が壊れています! <p> <!-- Upgrade to version 1.6.0 or above, which doesn't require any firewall rules at all for 2.1.x kernels. This seems to have broken again in the 1.6.1 release; please bug the author (it's not my fault!). --> 1.6.0 版か、それ以降のものにして下さい。それらの版では、カーネル 2.1.x に対してどのような firewall rule も要求しません。 これは 1.6.1 でまだ壊れていると思われるなら、その場合は著者にバグ報告をして下さい(それは、私の失敗ではありません)。 <!-- <sect1> Segmentation Fault With `-j REDIRECT'! --> <!-- <sect1> `-j REDIRECT'! で Segmentation エラーになります! --> <!-- Modified by [yoh] <yoh@coolmail.net> --> <sect1> `-j REDIRECT' で Segmentation エラーになります! <p> <!-- This was a bug in ipchains version 1.3.3. Please upgrade. --> これは ipchains 1.3.3 版のバグですので、新しい版にアップグレードして下さい。 <p> <!-- <sect1> I Can't Set Masquerading Timeouts!<label id="no-timeout"> --> <!-- <sect1> Masquerading Timeouts を設定できません。 --> <!-- Modified by [yoh] <yoh@coolmail.net> --> <sect1> マスカレーディングのタイムアウト値を設定できません!<label id="no-timeout"> <p> <!-- True (for 2.1.x kernels) up to 2.1.123. In 2.1.124, trying to set the masquerading timeouts causes a kernel lockup (change <tt>return</tt> to <tt>ret =</tt> on line 1328 of net/ipv4/ip_fw.c). In 2.1.125, it works fine. --> <!-- (カーネル 2.1.x に対して)2.1.123 にしましょう。 2.1.124 で設定してみると、 masquerading timeouts はカーネルをロックしてしまいます (net/ipv4/ip_fw.c ファイルの 1328 行にある <tt>ret = </tt> に <tt>return</tt> に変更します)。 --> <!-- Modified by [yoh] <yoh@coolmail.net> --> (カーネル 2.1.x において) 2.1.123 以降では動きません。 2.1.124 で設定してみると、 masquerading timeouts はカーネルをロックしてしまいます (net/ipv4/ip_fw.c ファイルの 1328 行にある <tt>return</tt> を <tt>ret = </tt> に変更して下さい)。 2.1.125 では、ちゃんと動きます。 注: 4.1.1 も見て下さい。 <!-- <sect1> I Want to Firewall IPX! --> <!-- <sect1>IPX をファイアウォールしたいのですが。 --> <!-- Modified by [yoh] <yoh@coolmail.net> --> <sect1>IPX をファイアウォールしたいです! <p> <!-- So do a number of others, it seems. My code only covers IP, unfortunately. On the good side, all the hooks are there to firewall IPX! You just need to write the code; I will happily help where possible. --> 他にも同じようなご希望があると思います。 残念ながら、私のコードは IP をすべて網羅しているだけですが、幸いなことに、IPXをファイアウオールするのに必要な機能はすべてそろっています。 それを利用してあなたご自身でコードを書く必要がありますが、可能な範囲で私は喜んでお手伝いしましょう。 訳注: IPX というのは、Novell による MS-DOS 上のネットワークプロトコルです。 IPX については、IPX-HOWTOを参照して下さい。 <htmlurl url="http://www.linux.or.jp/JF/JFdocs/IPX-HOWTO.html" name="http://www.linux.or.jp/JF/JFdocs/IPX-HOWTO.html"> <!-- 6章ここまで by中谷 --> <!-- 7章ここから by加藤 --> <!-- <sect>A Serious Example. --> <sect>実用的な例 <!-- <p> This example was extracted from Michael Neuling and my March 1999 LinuxWorld Tutorial; this is not the only way to solve the given problem, but it is probably the simplest. I hope you will find it informative. --> <p> この範例は、1999 年の 3 月に開催された LinuxWorld で Michael Neuling と私が発表したチュートリアルから引用しました。これは、与えられた問 題を解決するための唯一の方法ではないですが、多分最も単純なものです。 この範例を有益なものだと思って頂ければ幸いです。 <!-- <p> <sect1>The Arrangement --> <p> <sect1>構成 <!-- <p> <itemize> <item> Masqueraded internal network (various operating systems), which we call &dquot;GOOD&dquot;. <item> Exposed servers in a separate network (called &dquot;DMZ&dquot; for Demilitarized Zone). <item> PPP Connection to the Internet (called &dquot;BAD&dquot;). </itemize> --> <p> <itemize> <item>マスカレードされた内部ネットワーク(様々な OS が存在しています) が存在し、&dquot;GOOD&dquot; と呼びます。 <item>分離されたネットワーク上に公開サーバが存在しています(非武装化 地帯 &dquot;Demilitarized Zone&dquot; ということで &dquot;DMZ&dquot; と呼びます)。 <item>インターネットへ PPP 接続しています( &dquot;BAD&dquot; と呼びます)。 </itemize> <!-- <p> <tscreen><verb> External Network (BAD) | | ppp0| --------------- | 192.84.219.1| Server Network (DMZ) | |eth0 | |---------------------------------------------- | |192.84.219.250 | | | | | | | | |192.168.1.250| | | | --------------- -------- ------- ------- | eth1 | SMTP | | DNS | | WWW | | -------- ------- ------- | 192.84.219.128 192.84.219.129 192.84.218.130 | Internal Network (GOOD) </verb></tscreen> --> <p> <tscreen><verb> 外部ネットワーク (BAD) │ │ ppp0│ ┌───────┐ │192.84.219.1 │ サーバネットワーク (DMZ) │ │eth0 │ │───────┬──────┬──────┬─ │ │192.84.219.250│ │ │ │ │ │ │ │ │192.168.1.250 │ │ │ │ └───────┘ ┌───┐ ┌───┐ ┌───┐ │ eth1 │ SMTP │ │ DNS │ │ WWW │ │ └───┘ └───┘ └───┘ │ 192.84.219.128 192.84.219.129 192.84.218.130 │ 内部ネットワーク (GOOD) </verb></tscreen> <!-- <sect1>Goals <p> --> <sect1>目的 <p> <!-- Packet Filter box: --> パケットフィルターマシン: <!-- <descrip> <tag>PING any network</tag> This is really useful to tell if a machine is down. --> <descrip> <tag>全てのネットワークに対して PING が可能</tag> マシンがダウンしているかどうかを知るのに大変役に立ちます。 <!-- <tag>TRACEROUTE any network</tag> Once again, useful for diagnosis. --> <tag>全てのネットワークに対して TRACEROUTE が可能</tag> これもまた、原因分析に役に立ちます。 <!-- <tag>Access DNS</tag> To make ping and DNS more useful. </descrip> --> <tag>DNS へのアクセスが可能</tag> ping と DNS をより使いやすくするためです。 </descrip> <!-- <p> Within the DMZ: --> <p> DMZ 内: <!-- <p>Mail server <itemize> <item> SMTP to external <item> Accept SMTP from internal and external <item> Accept POP-3 from internal </itemize> --> <p>メールサーバ <itemize> <item> 外部ネットワークへの SMTP が可能 <item> 内部と外部ネットワークからの SMTP のアクセプト(受け入れ)が可能 <item> 内部ネットワークからの POP-3 のアクセプトが可能 </itemize> <!-- <p>Name Server <itemize> <item> Send DNS to external <item> Accept DNS from internal, external and packet filter box </itemize> --> <p>ネームサーバ <itemize> <item> 外部ネットワークへの DNS の要求が可能 <item> 内部と外部ネットワーク、パケットフィルターマシンからの DNS の アクセプトが可能 </itemize> <!-- <p> Web server <itemize> <item> Accept HTTP from internal and external <item> Rsync access from internal </itemize> --> <p>ウェブサーバ <itemize> <item> 内部と外部ネットワークからの HTTP のアクセプトが可能 <item> 内部ネットワークからの Rsync によるアクセスが可能 </itemize> <!-- <p> Internal: --> <p> 内部ネットワーク: <!-- <descrip> <tag>Allow WWW, ftp, traceroute, ssh to external</tag> These are fairly standard things to allow: some places start by allowing the internal machines to do just about everything, but here we're being restrictive. --> <descrip> <tag>外部ネットワークへの WWW, ftp ,traceroute, ssh を許可する</tag> これらは、許可の対象としてはかなり標準的なことです。内部ネッ トワーク上のマシンに対してほぼ全てを許可することから始めます が、ここでは制限をかけています。 <!-- <tag>Allow SMTP to Mail server </tag> Obviously, we want them to be able to send mail out. --> <tag>メールサーバへの SMTP を許可する </tag> 当然、メールは外部へ送信できるようにしたいです。 <!-- <tag> Allow POP-3 to Mail server </tag> This is how they read their mail. --> <tag> メールサーバへの POP-3 を許可する </tag> メールを読む方法です。 <!-- <tag> Allow DNS to Name server </tag> They need to be able to look up external names for WWW, ftp, traceroute and ssh. --> <tag> ネームサーバへの DNS を許可する </tag> WWW と ftp, traceroute, ssh を利用する際に、外部ネームの検索 をするのに必要です。 <!-- <tag> Allow rsync to Web server </tag> This is how they synchronize the external web server with the internal one. --> <tag> ウェブサーバへの rsync を許可する </tag> 外部向けウェブサーバと内部ウェブサーバを同期させる方法です。 <!-- <tag> Allow WWW to Web server </tag> Obviously, they should be able to connect to our external web server. --> <tag> ウェブサーバへの WWW を許可する </tag> 当然、外部向けウェブサーバへ接続できるべきです。 <!-- <tag> Allow ping to packet filter box </tag> This is a courteous thing to allow: it means that they can test if the firewall box is down (so we don't get blamed if an external site is broken). </descrip> --> <tag> パケットフィルターマシンへの ping を許可する </tag> これは、一般的に広く容認されていることです。つまりファイア ウォールマシンがダウンしているかどうかを、確認できるように するためです(それで外部サイトが壊れていた場合は、非難されま せんので)。 </descrip> <!-- <sect1>Before Packet Filtering --> <sect1>パケットフィルタリングを行う前に <!-- <p> <itemize> <item> Anti-spoofing <p> Since we don't have any asymmetric routing, we can simply turn on anti-spoofing for all interfaces. <p> <tscreen><verb> # for f in /proc/sys/net/ipv4/conf/*/rp_filter; do echo 1 > $f; done # </verb></tscreen> --> <p> <itemize> <item> IP 偽装保護 (Anti-spoofing) <p> いかなる非対称のルーティングも持っていないので、全てのインター フェースに対して IP 偽装保護を単にオンできます。 <tscreen><verb> # for f in /proc/sys/net/ipv4/conf/*/rp_filter; do echo 1 > $f; done # </verb></tscreen> <!-- <item> Set filtering rules to DENY all: <p> We still allow local loopback traffic, but deny anything else. <p> <tscreen><verb> # ipchains -A input -i ! lo -j DENY # ipchains -A output -i ! lo -j DENY # ipchains -A forward -j DENY </verb></tscreen> --> <item> フィルタリングのルールとして全てを拒否にする <p> 今まで通りローカルのループバックトラフィックは許可しますが、それ以外 の全てを拒否します。 <p> <tscreen><verb> # ipchains -A input -i ! lo -j DENY # ipchains -A output -i ! lo -j DENY # ipchains -A forward -j DENY # </verb></tscreen> <!-- <item> Set Up Interfaces <p> This is usually done in the boot scripts. Make sure the above steps are done before the interfaces are configured, to prevent packet leakage before the rules are set up. --> <item> インターフェースのセットアップ <p> インターフェースのセットアップは、大抵ブート時のスクリプト で実行されます。フィルタリングのルールが適用される前にパケット が漏れだすことを防ぐ為に、インターフェースが設定される前に上記 のステップが実行されていることを確認して下さい。 <!-- <item> Insert per-protocol masquerading modules. <p> We need to insert the masquerading module for FTP, so that active and passive FTP `just work' from the internal network. <p> <tscreen><verb> # insmod ip_masq_ftp # </verb></tscreen> </itemize> --> <item> プロトコル別にマスカレードモジュールを組み込む <p> FTP を利用する際には、マスカレードモジュールを組み込む必要があ ります。そうすることで、内部ネットワークからのアクティブとパッ シブ FTP が `ちゃんと動作します'。 <p> <tscreen><verb> # insmod ip_masq_ftp # </verb></tscreen> </itemize> <!-- <sect1>Packet Filtering for Through Packets --> <sect1>パケットを通過させるためのパケットフィルタリング <!-- <p> With masquerading, it's best to filter in the forward chain. <p> Split forward chain into various user chains depending on source/dest interfaces; this breaks the problem down into managable chunks. <tescreen><verb> ipchains -N good-dmz ipchains -N bad-dmz ipchains -N good-bad ipchains -N dmz-good ipchains -N dmz-bad ipchains -N bad-good </verb></tscreen> --> <p> マスカレードを使用して、forward チェインでフィルターをかけることは 最良の方法です。 <p> forward チェインをソース/あて先 インターフェースに合わせて様々なユ ーザ定義チェインに分割して下さい。つまり、問題を取扱いやすい単位 に分解するのです。 <tscreen><verb> ipchains -N good-dmz ipchains -N bad-dmz ipchains -N good-bad ipchains -N dmz-good ipchains -N dmz-bad ipchains -N bad-good </verb></tscreen> <!-- ACCEPTing standard error ICMPs is a common thing to do, so we create a chain for it. <tscreen><verb> ipchains -N icmp-acc </verb></tscreen> --> ICMP の標準エラーをアクセプトすることは、共通の内容です。したがって、 そのためのチェインを作ります。 <tscreen><verb> ipchains -N icmp-acc </verb></tscreen> <!-- <sect2> Set Up Jumps From forward Chain --> <sect2> forward チェインからジャンプさせる <!-- <p> Unfortunately, we only know (in the forward chain) the outgoing interface. Thus, to figure out what interface the packet came in on, we use the source address (the anti-spoofing prevents address faking). --> <p> 残念なことに、(forward チェインでは)出力インターフェースしか分かり ません。したがって、パケットがどのインターフェースから入ってくるか を見抜くために、ソースアドレスを使用します(偽装保護がアドレスのな りすましを防いでいるので大丈夫です)。 <!-- <p> Note that we log anything which doesn't match any of these (obviously, this should never happen). <tscreen><verb> ipchains -A forward -s 192.168.1.0/24 -i eth0 -j good-dmz ipchains -A forward -s 192.168.1.0/24 -i ppp0 -j good-bad ipchains -A forward -s 192.84.219.0/24 -i ppp0 -j dmz-bad ipchains -A forward -s 192.84.219.0/24 -i eth1 -j dmz-good ipchains -A forward -i eth0 -j bad-dmz ipchains -A forward -i eth1 -j bad-good ipchains -A forward -j DENY -l </verb></tscreen> --> <p> これらのいずれにもマッチしないパケット(明らかに、そのようなことは起 こらないはずですが)は全てログを取ることに注意して下さい。 <tscreen><verb> ipchains -A forward -s 192.168.1.0/24 -i eth0 -j good-dmz ipchains -A forward -s 192.168.1.0/24 -i ppp0 -j good-bad ipchains -A forward -s 192.84.219.0/24 -i ppp0 -j dmz-bad ipchains -A forward -s 192.84.219.0/24 -i eth1 -j dmz-good ipchains -A forward -i eth0 -j bad-dmz ipchains -A forward -i eth1 -j bad-good ipchains -A forward -j DENY -l </verb></tscreen> <!-- <sect2> Define the icmp-acc Chain --> <sect2> icmp-acc チェインを定義する <!-- <p> Packets which are one of the error ICMPs get ACCEPTed, otherwise, control will pass back to the calling chain. <p> <tscreen><verb> ipchains -A icmp-acc -p icmp --icmp-type destination-unreachable -j ACCEPT ipchains -A icmp-acc -p icmp --icmp-type source-quench -j ACCEPT ipchains -A icmp-acc -p icmp --icmp-type time-exceeded -j ACCEPT ipchains -A icmp-acc -p icmp --icmp-type parameter-problem -j ACCEPT </verb></tscreen> --> <p> パケットが(以下の)エラー ICMP のいずれかならアクセプトされます。 さもなければ、マッチしなかったパケットに対する制御は icmp-acc チェイン から抜けて、呼出し元のチェインに戻されることになります。 <p> <tscreen><verb> ipchains -A icmp-acc -p icmp --icmp-type destination-unreachable -j ACCEPT ipchains -A icmp-acc -p icmp --icmp-type source-quench -j ACCEPT ipchains -A icmp-acc -p icmp --icmp-type time-exceeded -j ACCEPT ipchains -A icmp-acc -p icmp --icmp-type parameter-problem -j ACCEPT </verb></tscreen> <!-- <sect2> Good (Internal) to DMZ (Servers) --> <sect2> GOOD (内部ネットワーク) から DMZ (サーバネットワーク) <!-- <p> Internal restrictions: <itemize> <item> Allow WWW, ftp, traceroute, ssh to external <item> <bf>Allow SMTP to Mail server</bf> <item> <bf>Allow POP-3 to Mail server</bf> <item> <bf>Allow DNS to Name server</bf> <item> <bf>Allow rsync to Web server</bf> <item> <bf>Allow WWW to Web server<bf> <item> Allow ping to packet filter box --> <p> 内部ネットワークに対する制限 : <itemize> <item> 外部ネットワークへの WWW, ftp, traceroute, ssh を許可する <item> <bf>メールサーバへの SMTP を許可する</bf> <item> <bf>メールサーバへの POP-3 を許可する</bf> <item> <bf>ネームサーバへの DNS を許可する</bf> <item> <bf>ウェブサーバへの rsync を許可する</bf> <item> <bf>ウェブサーバへの WWW を許可する</bf> <item> パケットフィルターマシンへの ping を許可する </itemize> <!-- Could do masquerading from internal network into DMZ, but here we don't. Since noone in the internal network should be trying to do evil things, we log any packets that get denied. --> 内部ネットワークから DMZ の際にマスカレードはできますが、ここでは行 いません。内部ネットワーク上のどのマシンも悪意のあることをしないは ずなので、拒否される全てのパケットのログを取ります。 <!-- <p> Note that old versions of Debian called `pop3' `pop-3' in /etc/services, which disagrees with RFC1700. <tscreen><verb> ipchains -A good-dmz -p tcp -d 192.84.219.128 smtp -j ACCEPT ipchains -A good-dmz -p tcp -d 192.84.219.128 pop3 -j ACCEPT ipchains -A good-dmz -p udp -d 192.84.219.129 domain -j ACCEPT ipchains -A good-dmz -p tcp -d 192.84.219.129 domain -j ACCEPT ipchains -A good-dmz -p tcp -d 192.84.218.130 www -j ACCEPT ipchains -A good-dmz -p tcp -d 192.84.218.130 rsync -j ACCEPT ipchains -A good-dmz -p icmp -j icmp-acc ipchains -A good-dmz -j DENY -l </verb></tscreen> --> <p> Debian の古いバージョンでは、/etc/services 上の `pop3' を`pop-3' と 呼ぶので注意して下さい。このことは RFC1700 と一致していません。 <tscreen><verb> ipchains -A good-dmz -p tcp -d 192.84.219.128 smtp -j ACCEPT ipchains -A good-dmz -p tcp -d 192.84.219.128 pop3 -j ACCEPT ipchains -A good-dmz -p udp -d 192.84.219.129 domain -j ACCEPT ipchains -A good-dmz -p tcp -d 192.84.219.129 domain -j ACCEPT ipchains -A good-dmz -p tcp -d 192.84.218.130 www -j ACCEPT ipchains -A good-dmz -p tcp -d 192.84.218.130 rsync -j ACCEPT ipchains -A good-dmz -p icmp -j icmp-acc ipchains -A good-dmz -j DENY -l </verb></tscreen> <!-- <sect2> Bad (external) to DMZ (servers). --> <sect2> BAD (外部ネットワーク)から DMZ (サーバネットワーク) <!-- <p> <itemize> <item> DMZ restrictions: <itemize> <item> Mail server <itemize> <item> <bf>SMTP to external</bf> <item> <bf>Accept SMTP from</bf> internal and <bf>external</bf> <item> Accept POP-3 from internal <itemize> <item> Name server <itemize> <item> <bf>Send DNS to external</bf> <item> <bf>Accept DNS</bf> from internal, <bf>external</bf> and packet filter box </itemize> <item> Web server <itemize> <item> <bf>Accept HTTP from<bf> internal and <bf>external</bf> <item> Rsync access from internal </itemize> </itemize> <item> Things we allow from external network to DMZ. <itemize> <item> Don't log violations, as they may happen. </itemize> <tscreen><verb> ipchains -A bad-dmz -p tcp -d 192.84.219.128 smtp -j ACCEPT ipchains -A bad-dmz -p udp -d 192.84.219.129 domain -j ACCEPT ipchains -A bad-dmz -p tcp -d 192.84.219.129 domain -j ACCEPT ipchains -A bad-dmz -p tcp -d 192.84.218.130 www -j ACCEPT ipchains -A bad-dmz -p icmp -j icmp-acc ipchains -A bad-dmz -j DENY </verb></tscreen> </itemize> --> <p> <itemize> <item> DMZ に対する制限: <itemize> <item> メールサーバ <itemize> <item> <bf>外部ネットワークへの SMTP が可能</bf> <item> 内部と<bf>外部ネットワークからの SMTP のアクセプトが可能</bf> <item> 内部ネットワークからの POP-3 のアクセプトが可能 </itemize> <item> ネームサーバ <itemize> <item> <bf>外部ネットワークへの DNS の要求が可能</bf> <item> 内部と<bf>外部ネットワーク</bf>、パケットフィルターマシン<bf>から の DNS のアクセプトが可能</bf> </itemize> <item> ウェブサーバ <itemize> <item> 内部と<bf>外部ネットワークからの HTTP のアクセプトが可能</bf> <item> 内部ネットワークからの Rsync のアクセプトが可能 </itemize> </itemize> <item> 外部ネットワークから DMZ へ許可すること <itemize> <item> 侵害行為については、ログはとらずそのままにする </itemize> <tscreen><verb> ipchains -A bad-dmz -p tcp -d 192.84.219.128 smtp -j ACCEPT ipchains -A bad-dmz -p udp -d 192.84.219.129 domain -j ACCEPT ipchains -A bad-dmz -p tcp -d 192.84.219.129 domain -j ACCEPT ipchains -A bad-dmz -p tcp -d 192.84.218.130 www -j ACCEPT ipchains -A bad-dmz -p icmp -j icmp-acc ipchains -A bad-dmz -j DENY </verb></tscreen> </itemize> <!-- <sect2> Good (internal) to Bad (external). --> <sect2> GOOD (内部ネットワーク)から BAD (外部ネットワーク) <!-- <p> <itemize> <item> Internal restrictions: <itemize> <item> <bf>Allow WWW, ftp, traceroute, ssh to external</bf> <item> Allow SMTP to Mail server <item> Allow POP-3 to Mail server <item> Allow DNS to Name server <item> Allow rsync to Web server <item> Allow WWW to Web server <item> Allow ping to packet filter box </itemize> <item> Many people allow everything from the internal to external networks, then add restrictions. We're being fascist. <itemize> <item> Log violations. <item> Passive FTP handled by masq. module. <item> UDP destination ports 33434 and up are used by traceroute. </itemize> <tscreen><verb> ipchains -A good-bad -p tcp --dport www -j MASQ ipchains -A good-bad -p tcp --dport ssh -j MASQ ipchains -A good-bad -p udp --dport 33434:33500 -j MASQ ipchains -A good-bad -p tcp --dport ftp -j MASQ ipchains -A good-bad -p icmp --icmp-type ping -j MASQ ipchains -A good-bad -j REJECT -l </verb></tscreen> </itemize> --> <p> <itemize> <item> 内部ネットワークに対する制限: <itemize> <item> <bf>外部ネットワークへの WWW, ftp ,traceroute, ssh を許可する</bf> <item> メールサーバへの SMTP を許可する <item> メールサーバへの POP-3 を許可する <item> ネームサーバへの DNS を許可する <item> ウェブサーバへの rsync を許可する <item> ウェブサーバへの WWW を許可する <item> パケットフィルターマシンへの ping を許可する </itemize> <item> 一般に、内部ネットワークから外部ネットワークに対しては、 全てを許可し、それから制限を加えます。我々は、ファシストなのです。 <itemize> <item> 侵害行為のログを取る <item> パッシブ FTP は、マスカレードモジュールで処理する <item> UDP の あて先ポート 33434 以降 は traceroute で使用される </itemize> <tscreen><verb> ipchains -A good-bad -p tcp --dport www -j MASQ ipchains -A good-bad -p tcp --dport ssh -j MASQ ipchains -A good-bad -p udp --dport 33434:33500 -j MASQ ipchains -A good-bad -p tcp --dport ftp -j MASQ ipchains -A good-bad -p icmp --icmp-type ping -j MASQ ipchains -A good-bad -j REJECT -l </verb></tscreen> </itemize> <!-- <sect2>DMZ to Good (internal). --> <sect2>DMZ から GOOD (内部ネットワーク) <!-- <p> <itemize> <item> Internal restrictions: <itemize> <item> Allow WWW, ftp, traceroute, ssh to external <item> <bf>Allow SMTP to Mail server</bf> <item> <bf>Allow POP-3 to Mail server</bf> <item> <bf>Allow DNS to Name server</bf> <item> <bf>Allow rsync to Web server</bf> <item> <bf>Allow WWW to Web server</bf> <item> Allow ping to packet filter box </itemize> <item> If we were masquerading from the internal network to the DMZ, simply refuse any packets coming the other way. As it is, only allow packets which might be part of an established connection. <tscreen><verb> ipchains -A dmz-good -p tcp ! -y -s 192.84.219.128 smtp -j ACCEPT ipchains -A dmz-good -p udp -s 192.84.219.129 domain -j ACCEPT ipchains -A dmz-good -p tcp ! -y -s 192.84.219.129 domain -j ACCEPT ipchains -A dmz-good -p tcp ! -y -s 192.84.218.130 www -j ACCEPT ipchains -A dmz-good -p tcp ! -y -s 192.84.218.130 rsync -j ACCEPT ipchains -A dmz-good -p icmp -j icmp-acc ipchains -A dmz-good -j DENY -l </verb></tscreen> </itemize> --> <p> <itemize> <item> 内部ネットワークに対する制限: <itemize> <item> 外部ネットワークへの WWW, ftp ,traceroute, ssh を許可する <item> <bf>メールサーバへの SMTP を許可する</bf> <item> <bf>メールサーバへの POP-3 を許可する</bf> <item> <bf>ネームサーバへの DNS を許可する</bf> <item> <bf>ウェブサーバへの rsync を許可する</bf> <item> <bf>ウェブサーバへの WWW を許可する</bf> <item> パケットフィルターマシンへの ping を許可する </itemize> <item> 内部ネットワークから DMZ の際にマスカレードする場合、単にそれ以 外のパケットを拒否して下さい。実のところ、単にコネクションが 確立された一部のパケットのみ許可するだけです。 <tscreen><verb> ipchains -A dmz-good -p tcp ! -y -s 192.84.219.128 smtp -j ACCEPT ipchains -A dmz-good -p udp -s 192.84.219.129 domain -j ACCEPT ipchains -A dmz-good -p tcp ! -y -s 192.84.219.129 domain -j ACCEPT ipchains -A dmz-good -p tcp ! -y -s 192.84.218.130 www -j ACCEPT ipchains -A dmz-good -p tcp ! -y -s 192.84.218.130 rsync -j ACCEPT ipchains -A dmz-good -p icmp -j icmp-acc ipchains -A dmz-good -j DENY -l </verb></tscreen> </itemize> <!-- <sect2>DMZ to bad (external). --> <sect2>DMZ から BAD (外部ネットワーク) <!-- <p> <itemize> <item> DMZ restrictions: <itemize> <item> Mail server <itemize> <item> <bf>SMTP to external</bf> <item> <bf>Accept SMTP from</bf> internal and <bf>external</bf> <item> Accept POP-3 from internal </itemize> <item> Name server <itemize> <item> <bf>Send DNS to external</bf> <item> <bf>Accept DNS from</bf> internal, <bf>external</bf> and packet filter box </itemize> <item> Web server <itemize> <item> <bf>Accept HTTP from</bf> internal and <bf>external</bf> <item> Rsync access from internal </itemize> </itemize> <item> <tscreen><verb> ipchains -A dmz-bad -p tcp -s 192.84.219.128 smtp -j ACCEPT ipchains -A dmz-bad -p udp -s 192.84.219.129 domain -j ACCEPT ipchains -A dmz-bad -p tcp -s 192.84.219.129 domain -j ACCEPT ipchains -A dmz-bad -p tcp ! -y -s 192.84.218.130 www -j ACCEPT ipchains -A dmz-bad -p icmp -j icmp-acc ipchains -A dmz-bad -j DENY -l </verb></tscreen> </itemize> --> <p> <itemize> <item> DMZ に対する制限: <itemize> <item> メールサーバ <itemize> <item> <bf>外部ネットワークへの SMTP が可能</bf> <item> 内部と<bf>外部ネットワークからの SMTP のアクセプトが可能</bf> <item> 外部ネットワークからの POP-3 のアクセプトが可能 </itemize> <item> ネームサーバ <itemize> <item> <bf>外部ネットワークへの DNS の送信が可能</bf> <item> 内部と<bf>外部ネットワーク</bf>、パケットフィルターマシン<bf>から の DNS のアクセプトが可能</bf> </itemize> <item> ウェブサーバ <itemize> <item> 内部と<bf>外部ネットワークからの HTTP のアクセプトが可能</bf> <item> 内部ネットワークからの Rsync のアクセプトが可能 </itemize> </itemize> <item> <tscreen><verb> ipchains -A dmz-bad -p tcp -s 192.84.219.128 smtp -j ACCEPT ipchains -A dmz-bad -p udp -s 192.84.219.129 domain -j ACCEPT ipchains -A dmz-bad -p tcp -s 192.84.219.129 domain -j ACCEPT ipchains -A dmz-bad -p tcp ! -y -s 192.84.218.130 www -j ACCEPT ipchains -A dmz-bad -p icmp -j icmp-acc ipchains -A dmz-bad -j DENY -l </verb></tscreen> </itemize> <!-- <sect2>Bad (external) to Good (internal). --> <sect2>BAD (外部ネットワーク)から GOOD (内部ネットワーク) <!-- <p> <itemize> <item> We don't allow anything (non-masqueraded) from the external network to the internal network <tscreen><verb> ipchains -A bad-good -j REJECT </verb><tscreen> </itemize> --> <p> <itemize> <item> 外部ネットワークから内部ネットワークへ入って来るもの全て(マスカ レードされていないもの)を許可しません。 <tscreen><verb> ipchains -A bad-good -j REJECT </verb></tscreen> </itemize> <!-- <sect2>Packet Filtering for the Linux Box Itself --> <sect2>Linux マシン自身に対するパケットフィルタリング <!-- <p> <itemize> <item> If we want to use packet filtering on packets coming into the box itself, we need to do filtering in the input chain. We create one chain for each destination interface: <tscreen><verb> ipchains -N bad-if ipchains -N dmz-if ipchains -N good-if </verb></tscreen> --> <p> <itemize> <item> パケットフィルターマシン自身に入って来るパケッットにも、パケッ トフィルタリングを行いたいなら、input チェインでパケットフィル タリングを行う必要があります。あて先インターフェース毎に、一つ チェインを作ります。 <tscreen><verb> ipchains -N bad-if ipchains -N dmz-if ipchains -N good-if </verb></tscreen> <!-- <item> Create jumps to them: <tscreen><verb> ipchains -A input -d 192.84.219.1 -j bad-if ipchains -A input -d 192.84.219.250 -j dmz-if ipchains -A input -d 192.168.1.250 -j good-if </verb></tscreen> </itemize> --> <item> 作ったチェインにジャンプさせます。 <tscreen><verb> ipchains -A input -d 192.84.219.1 -j bad-if ipchains -A input -d 192.84.219.250 -j dmz-if ipchains -A input -d 192.168.1.250 -j good-if </verb></tscreen> </itemize> <!-- <sect3>Bad (external) interface. --> <sect3>BAD (外部ネットワーク) インターフェース <!-- <p> <itemize> <item> Packet Filter box: <itemize> <item> <bf>PING any network</bf> <item> <bf>TRACEROUTE any network</bf> <item> Access DNS </itemize> <item> External interface also receives replies to masqueraded packets (masquerading uses source ports 61000 to 65095) and ICMP errors for them and PING replies. <tscreen><verb> ipchains -A bad-if -i ! ppp0 -j DENY -l ipchains -A bad-if -p TCP --dport 61000:65095 -j ACCEPT ipchains -A bad-if -p UDP --dport 61000:65095 -j ACCEPT ipchains -A bad-if -p ICMP --icmp-type pong -j ACCEPT ipchains -A bad-if -j icmp-acc ipchains -A bad-if -j DENY </verb></tscreen> </itemize> --> <p> <itemize> <item> パケットフィルターマシン: <itemize> <item> <bf>全てのネットワークに対して PING が可能</bf> <item> <bf>全てのネットワークに対して TRACEROUTE が可能</bf> <item> DNS へのアクセスが可能 </itemize> <item> また外部ネットワーク用のインターフェースは、マスカレードされた パケット(マスカレードは、ソースポートとして 61000 から 65095 を 使用します)へのリプライと ICMP エラー、PING のリプライも受け入 れます。 <tscreen><verb> ipchains -A bad-if -i ! ppp0 -j DENY -l ipchains -A bad-if -p TCP --dport 61000:65095 -j ACCEPT ipchains -A bad-if -p UDP --dport 61000:65095 -j ACCEPT ipchains -A bad-if -p ICMP --icmp-type pong -j ACCEPT ipchains -A bad-if -j icmp-acc ipchains -A bad-if -j DENY </verb></tscreen> </itemize> <!-- <sect3>DMZ interface. --> <sect3>DMZ インタフェース <!-- <p> <itemize> <item> Packet Filter box restrictions: <itemize> <item> <bf>PING any network</bf> <item> <bf>TRACEROUTE any network</bf> <item> <bf>Access DNS</bf> </itemize> <item> DMZ interface receives DNS replies, ping replies and ICMP errors. <tscreen><verb> ipchains -A dmz-if -i ! eth0 -j DENY ipchains -A dmz-if -p TCP ! -y -s 192.84.219.129 53 -j ACCEPT ipchains -A dmz-if -p UDP -s 192.84.219.129 53 -j ACCEPT ipchains -A dmz-if -p ICMP --icmp-type pong -j ACCEPT ipchains -A dmz-if -j icmp-acc ipchains -A dmz-if -j DENY -l </verb></tscreen> </itemize> --> <p> <itemize> <item> パケットフィルターマシンに対する制限: <itemize> <item> <bf>全てのネットワークに対して PING が可能</bf> <item> <bf>全てのネットワークに対して TRACEROUTE が可能</bf> <item> <bf>DNS へのアクセスが可能</bf> </itemize> <item>DMZ インターフェースは、DNS からのリプライと ping のリプライ、 エラー ICMP を受け入れます。 <tscreen><verb> ipchains -A dmz-if -i ! eth0 -j DENY ipchains -A dmz-if -p TCP ! -y -s 192.84.219.129 53 -j ACCEPT ipchains -A dmz-if -p UDP -s 192.84.219.129 53 -j ACCEPT ipchains -A dmz-if -p ICMP --icmp-type pong -j ACCEPT ipchains -A dmz-if -j icmp-acc ipchains -A dmz-if -j DENY -l </verb></tscreen> </itemize> <!-- <sect3>Good (internal) interface. --> <sect3>GOOD (内部ネットワーク)インターフェース <!-- <p> <itemize> <item> Packet Filter box restrictions: <itemize> <item> <bf>PING any network</bf> <item> <bf>TRACEROUTE any network</bf> <item> <bf>Access DNS</bf> </itemize> <item> Internal restrictions: <itemize> <item> Allow WWW, ftp, traceroute, ssh to external <item> Allow SMTP to Mail server <item> Allow POP-3 to Mail server <item> Allow DNS to Name server <item> Allow rsync to Web server <item> Allow WWW to Web server <item> <bf>Allow ping to packet filter box</bf> </itemize> <item> Internal interface receives pings, ping replies and ICMP errors. <tscreen><verb> ipchains -A good-if -i ! eth1 -j DENY ipchains -A good-if -p ICMP --icmp-type ping -j ACCEPT ipchains -A good-if -p ICMP --icmp-type pong -j ACCEPT ipchains -A good-if -j icmp-acc ipchains -A good-if -j DENY -l </verb></tscreen> </itemize> --> <p> <itemize> <item> パケットフィルターマシンに対する制限: <itemize> <item> <bf>全てのネットワークに対して PING が可能</bf> <item> <bf>全てのネットワークに対して TRACEROUTE が可能</bf> <item> <bf>DNS へのアクセスが可能</bf> </itemize> <item>内部ネットワークに対する制限: <itemize> <item> 外部ネットワークへの WWW, ftp ,traceroute, ssh を許可する <item> メールサーバへの SMTP を許可する <item> メールサーバへの POP-3 を許可する <item> ネームサーバへの DNS を許可する <item> ウェブサーバへの rsync を許可する <item> ウェブサーバへの WWW を許可する <item> <bf>パケットフィルターマシンへの ping を許可する</bf> </itemize> <item>内部ネットワークインターフェースは、ping と ping のリプライ、 エラー ICMP を受け入れます。 <tscreen><verb> ipchains -A good-if -i ! eth1 -j DENY ipchains -A good-if -p ICMP --icmp-type ping -j ACCEPT ipchains -A good-if -p ICMP --icmp-type pong -j ACCEPT ipchains -A good-if -j icmp-acc ipchains -A good-if -j DENY -l </verb></tscreen> </itemize> <!-- <sect1>Finally --> <sect1>最後に <!-- <p> <itemize> <item> Delete blocking rules: <tscreen><verb> ipchains -D input 1 ipchains -D forward 1 ipchains -D output 1 </verb></tscreen> </itemize> --> <p> <itemize> <item>ブロッキングのルールを削除します。 <tscreen><verb> ipchains -D input 1 ipchains -D forward 1 ipchains -D output 1 </verb></tscreen> </itemize> <!-- 7 章にコメントをいただいた方々 Hiroyuki YAMAMORI <h-yamamo@db3.so-net.ne.jp> Masaharu Goto <magotou@fubyshare.gr.jp> --> <!-- 7章ここまで by加藤 --> <!-- 8章ここから by松田 --> <!-- <sect> Appendix: Differences between ipchains and ipfwadm.<label id="ipfwadm-diff"> --> <sect> 付録: ipchains と ipfwadm との違い<label id="ipfwadm-diff"> <p> <!-- Some of these changes are a result of kernel changes, and some a result of <tt>ipchains</tt> being different from <tt>ipfwadm</tt>. --> これらの変更の幾つかはカーネルの変更の結果であり、また幾つかは <tt>ipchains</tt> と <tt>ipfwadm</tt> との違いの結果です。 <p> <enum> <!-- <item> Many arguments have been remapped: capitals now indicates a command, and lower case now indicates an option. --> <item> 多くの引数は再配置されました: 現在、大文字はコマンドを示し、小文字はオプションを示します。 <!-- <item> Arbitrary chains are supported, so even built-in chains have full names instead of flags (eg. `input' instead of `-I'). --> <item> 任意のチェインがサポートされましたので、組み込みチェインも同様にフラグではなくフルネームで記載する必要があります。 (例. `-I' ではなく `input' と記載します). <!-- <item> The `-k' option has vanished: use `! -y'. --> <item> `-k' オプションはなくなりました。 `! -y' を使って下さい。 <!-- <item> The `-b' option actually inserts/appends/deletes two rules, rather than a single `bidirectional' rule. --> <item> `-b' オプションは、単一の `双方向' ルールというよりも、むしろ実際には2つのルールに対して挿入/追加/削除を行います。 <!-- <item> The `-b' option can be passed to `-C' to do two checks (one in each direction). --> <item> `-b' オプションは 2つのチェックを行うために、 `-C' オプションにて無効化されます。(各々の方向の1つ) <!-- 「各々の方向の一つ」?どういう意味でしょう?^^; --> <!-- <item> The `-x' option to `-l' has been replaced by `-v'. --> <item> `-l' に対する `-x' オプションは `-v' に変更されました。 <!-- <item> Multiple source and destination ports are not supported anymore. Hopefully being able to negate the port range will somewhat make up for that. --> <item> もう、複数の送信側と受信側のポートはサポートされません。 望ましくは、ポート幅を否定できることで、多少はその目的を補うでしょう。 <!-- <item> Interfaces can only be specified by name (not address). The old semantics got silently changed in the 2.1 kernel series anyway. --> <item> インターフェースは(アドレスでなく)名前によってのみ指定できます。 まぁ、どのみち、以前の意味付けは 2.1 カーネルシリーズで静かに変更されたことですし。 <!-- <item> Fragments are examined, not automatically allowed through. --> <item> パケットの断片化は検査されますので、自動的には素通りしません。 <!-- <item> Explicit accounting chains have been done away with. --> <item> 明示的な計数チェインは廃止されました。 <!-- 「明示的な説明するチェイン」?どういう意味でしょう?^^; --> <!-- <item> Arbitrary protocols over IP can be tested for. --> <item> IP上の任意のプロトコルがテストできます。 <!-- <item> The old behavior of SYN and ACK matching (which was previously ignored for non-TCP packets) has changed; the SYN option is not valid for non-TCP-specific rules. --> <item> SYN と ACK の組合せに対する以前の振舞い (以前は非 TCP パケットは無視していました) は変更されました; SYN オプションは、非 TCP 独特のルールに対しては無効です。 <!-- <item> Counters are now 64-bit on 32-bit machines, not 32-bit. --> <item> 現在、32ビットマシン上のカウンタは 64ビットであり、32ビットではありません。 <!-- <item> Inverse options are now supported. --> <item> 現在、反転オプションがサポートされています。 <!-- <item> ICMP codes are now supported. --> <item> 現在、 ICMP コードがサポートされています。 <!-- <item> Wildcard interfaces are now supported. --> <item> 現在、ワイルドカードインターフェースがサポートされています。 <!-- <item> TOS manipulations are now sanity-checked: the old kernel code would silently stop you from (illegally) manipulating the `Must Be Zero' TOS bit; ipchains now returns an error if you try, as well as for other illegal cases. --> <item> 現在、TOS 操作は分別チェックされます: 古いカーネルコードは `ゼロでなければならない' TOS ビットを(不当に)操作されることで、静かに止まってしまっていました; 現在、 ipchains は そのような試みに対して、他の不当な場合と同様にエラーを返します。 </enum> <!-- <sect1> Quick-Reference table. --> <sect1> クィックリファレンス一覧 <p> <!-- [ Mainly, command arguments are UPPER CASE, and option arguments are lower case ] --> [ 主に、コマンド引数は大文字で、オプション引数は小文字です。] <p> <!-- One thing to note, masquerading is specified by `-j MASQ'; it is completely different from `-j ACCEPT', and not treated as merely a side-effect, unlike <tt>ipfwadm</tt> does. --> 注意すべき一点として、 マスカレーディングは `-j MASQ' と記載します; これは `-j ACCEPT' と全く異なり、また <tt>ipfwadm</tt> のような副次的効果としては取り扱いません。 <p> <!-- <verb> ================================================================ | ipfwadm | ipchains | Notes ---------------------------------------------------------------- | -A [both] | -N acct | Create an `acct' chain | |& -I 1 input -j acct | and have output and input | |& -I 1 output -j acct | packets traverse it. | |& acct | ---------------------------------------------------------------- | -A in | input | A rule with no target ---------------------------------------------------------------- | -A out | output | A rule with no target ---------------------------------------------------------------- | -F | forward | Use this as [chain]. ---------------------------------------------------------------- | -I | input | Use this as [chain]. ---------------------------------------------------------------- | -O | output | Use this as [chain]. ---------------------------------------------------------------- | -M -l | -M -L | ---------------------------------------------------------------- | -M -s | -M -S | ---------------------------------------------------------------- | -a policy | -A [chain] -j POLICY | (but see -r and -m). ---------------------------------------------------------------- | -d policy | -D [chain] -j POLICY | (but see -r and -m). ---------------------------------------------------------------- | -i policy | -I 1 [chain] -j POLICY| (but see -r and -m). ---------------------------------------------------------------- | -l | -L | ---------------------------------------------------------------- | -z | -Z | ---------------------------------------------------------------- | -f | -F | ---------------------------------------------------------------- | -p | -P | ---------------------------------------------------------------- | -c | -C | ---------------------------------------------------------------- | -P | -p | ---------------------------------------------------------------- | -S | -s | Only takes one port or | | | range, not multiples. ---------------------------------------------------------------- | -D | -d | Only takes one port or | | | range, not multiples. ---------------------------------------------------------------- | -V | <none> | Use -i [name]. ---------------------------------------------------------------- | -W | -i | ---------------------------------------------------------------- | -b | -b | Now actually makes 2 rules. ---------------------------------------------------------------- | -e | -v | ---------------------------------------------------------------- | -k | ! -y | Doesn't work unless | | | -p tcp also specified. ---------------------------------------------------------------- | -m | -j MASQ | ---------------------------------------------------------------- | -n | -n | ---------------------------------------------------------------- | -o | -l | ---------------------------------------------------------------- | -r [redirpt] | -j REDIRECT [redirpt] | ---------------------------------------------------------------- | -t | -t | ---------------------------------------------------------------- | -v | -v | ---------------------------------------------------------------- | -x | -x | ---------------------------------------------------------------- | -y | -y | Doesn't work unless | | | -p tcp also specified. ---------------------------------------------------------------- </verb> --> <verb> ================================================================ | ipfwadm | ipchains | 注意 ---------------------------------------------------------------- | -A [both] | -N acct | `acct' チェインを生成し、 | |& -I 1 input -j acct | 出力と入力パケットをそれ | |& -I 1 output -j acct | に通過させます。 | |& acct | ---------------------------------------------------------------- | -A in | input | ターゲットなしのルール ---------------------------------------------------------------- | -A out | output | ターゲットなしのルール ---------------------------------------------------------------- | -F | forward | [チェイン]として用います。 ---------------------------------------------------------------- | -I | input | [チェイン]として用います。 ---------------------------------------------------------------- | -O | output | [チェイン]として用います。 ---------------------------------------------------------------- | -M -l | -M -L | ---------------------------------------------------------------- | -M -s | -M -S | ---------------------------------------------------------------- | -a policy | -A [chain] -j POLICY | (でも -r と -m も見て下 | | | さい). ---------------------------------------------------------------- | -d policy | -D [chain] -j POLICY | (でも -r と -m も見て下 | | | さい). ---------------------------------------------------------------- | -i policy | -I 1 [chain] -j POLICY| (でも -r と -m も見て下 | | | さい). ---------------------------------------------------------------- | -l | -L | ---------------------------------------------------------------- | -z | -Z | ---------------------------------------------------------------- | -f | -F | ---------------------------------------------------------------- | -p | -P | ---------------------------------------------------------------- | -c | -C | ---------------------------------------------------------------- | -P | -p | ---------------------------------------------------------------- | -S | -s | 1ポートまたはレンジに対 | | | してのみ機能し、複数で | | | はありません。 ---------------------------------------------------------------- | -D | -d | 1ポートまたはレンジに対 | | | してのみ機能し、複数で | | | はありません。 ---------------------------------------------------------------- | -V | <none> | -i [名前] で用います。 ---------------------------------------------------------------- | -W | -i | ---------------------------------------------------------------- | -b | -b | 現在、実際には2ルールを | | | 作成します。 ---------------------------------------------------------------- | -e | -v | ---------------------------------------------------------------- | -k | ! -y | -p tcp と共に指定しない | | | と機能しません。 ---------------------------------------------------------------- | -m | -j MASQ | ---------------------------------------------------------------- | -n | -n | ---------------------------------------------------------------- | -o | -l | ---------------------------------------------------------------- | -r [redirpt] | -j REDIRECT [redirpt] | ---------------------------------------------------------------- | -t | -t | ---------------------------------------------------------------- | -v | -v | ---------------------------------------------------------------- | -x | -x | ---------------------------------------------------------------- | -y | -y | -p tcp と共に指定しない | | | と機能しません。 ---------------------------------------------------------------- </verb> <!-- <sect1> Examples of translated ipfwadm commands --> <sect1> ipfwadm コマンドの変換例 <p> <!-- Old command: ipfwadm -F -p deny New command: ipchains -P forward DENY <p> Old command: ipfwadm -F -a m -S 192.168.0.0/24 -D 0.0.0.0/0 New command: ipchains -A forward -j MASQ -s 192.168.0.0/24 -d 0.0.0.0/0 <p> Old command: ipfwadm -I -a accept -V 10.1.2.1 -S 10.0.0.0/8 -D 0.0.0.0/0 New command: ipchains -A input -j ACCEPT -i eth0 -s 10.0.0.0/8 -d 0.0.0.0/0 --> 旧コマンド: ipfwadm -F -p deny 新コマンド: ipchains -P forward DENY <p> 旧コマンド: ipfwadm -F -a m -S 192.168.0.0/24 -D 0.0.0.0/0 新コマンド: ipchains -A forward -j MASQ -s 192.168.0.0/24 -d 0.0.0.0/0 <p> 旧コマンド: ipfwadm -I -a accept -V 10.1.2.1 -S 10.0.0.0/8 -D 0.0.0.0/0 新コマンド: ipchains -A input -j ACCEPT -i eth0 -s 10.0.0.0/8 -d 0.0.0.0/0 <!-- (Note that there is no equivalent for specifying interfaces by address: use the interface name. On this machine, 10.1.2.1 corresponds to eth0). --> (インターフェースをアドレスによって指定するのとは違うことに注意して下さい: インターフェース名を用いて下さい。 このマシン上では、 10.1.2.1 は eth0 に相当します)。 <!-- 8章ここまで by松田 --> <!-- 9章ここから by松田 --> <!-- <sect>Appendix: Using the ipfwadm-wrapper script.<label id="upgrade"> --> <sect>付録: ipfwadm-wrapper スクリプトを使う<label id="upgrade"> <p> <!-- The <tt>ipfwadm-wrapper</tt> shell script should be a plug-in replacement of <tt>ipfwadm</tt> for backwards compatibility with ipfwadm 2.3a. --> <tt>ipfwadm-wrapper</tt> シェルスクリプトは、ipfwadm とプラグインにて置換される為にあり、 <tt>ipfwadm</tt> 2.3a との下位互換性があります。 <p> <!-- The only feature it can't really handle is the `-V' option. When this is used, a warning is given. If the `-W' option is also used, the `-V' option is ignored. Otherwise, the script tries to find the interface name associated with that address, using <tt>ifconfig</tt>. If that fails (such as for an interface which is down) then it will exit with an error message. --> 唯一、どうしても処理できない機能は `-V' オプションです。これが用いられる時は、ワーニングが出力されます。 `-W' オプションも使われるなら、 `-V' オプションは無視されます。 他の点では、スクリプトは <tt>ifconfig</tt> を用いて、インターフェース名を割り当てられているアドレスから見つけようとします。 もしそれに失敗すれば(例えばインターフェースがダウンしている場合)、エラーメッセージを伴って終了します。 <p> <!-- This warning can be suppressed by either changing the `-V' to a `-W', or directing the standard output of the script to /dev/null. --> このワーニングは `-V' を `-W' に変更するか、スクリプトの標準出力を /dev/null に送れば抑えられます。 <p> <!-- If you should find any mistakes in this script, or any changes between the real ipfwadm and this script, <em>please</em> report a bug to me: send an EMail to rusty@linuxcare.com with "BUG-REPORT" in the subject. Please list your old version of <tt>ipfwadm</tt> (<tt>ipfwadm -h</tt>), your version of <tt>ipchains</tt> (<tt>ipchains --version</tt>), the version of the ipfwadm wrapper script (<tt>ipfwadm-wrapper --version</tt>). Also send the output of <tt>ipchains-save</tt>. Thanks in advance. --> このスクリプトのミスや ipfwadm との相違点を発見したら、<em>是非とも</em>、バグレポートを私に下さい: サブジェクトに "BUG-REPORT" と書いて、 rusty@linuxcare.com 宛にメールを下さい。 お手持ちの古い <tt>ipfwadm</tt> のバージョン (<tt>ipfwadm -h</tt>) と、 <tt>ipchains</tt> のバージョン (<tt>ipchains --version</tt>) と、 ipfwadm wrapper スクリプトのバージョン (<tt>ipfwadm-wrapper --version</tt>) を列挙して下さい。 同時に、 <tt>ipchains-save</tt> の出力も送って下さい。 宜しくお願いします。 <p> <!-- Mix <tt>ipchains</tt> with this <tt>ipfwadm-wrapper</tt> script at your own peril. --> この <tt>ipfwadm-wrapper</tt> スクリプトを <tt>ipchains</tt> と混用する際には、自己責任にてお願いします。 <!-- 9章ここまで by松田 --> <!-- 10章ここから by松田 --> <!-- <sect>Appendix: Thanks. --> <sect>付録: 謝辞 <p> <!-- Many thanks have to go to Michael Neuling, who wrote the first releasable cut of the IP chains code while working for me. Public apologies for nixing his result-caching idea, which Alan Cox later proposed and I have finally begun implementing, having seen the error of my ways. --> Michael Neuling に多くの感謝をしなければなりません。彼は私のために最初の IP チェインのコードを書いてくれました。 彼のリザルトキャッシュのアイディアを拒否したことについて、ここに公式に謝罪致します。 実は後に Alan Cox が同じアイディアを提案し、間違いに気づいた私は結局、実装にとりかかることになったのです。 <p> <!-- Thanks to Alan Cox for his 24-hour EMail tech support, and encouragement. --> Alan Cox の24時間体制のメールによる技術サポートと激励に感謝します。 <p> <!-- Thanks to all the authors of the ipfw and ipfwadm code, especially Jos Vos. Standing on the shoulders of giants and all that... This applies to Linus Torvalds and all the kernel and userspace hackers as well. --> ipfw と ipfwadm のコードの作者全てに感謝します。特に Jos Vos。 巨人の肩の上に立ち、そして全て…。これは Linus Torvalds とカーネルやユーザー空間のハッカー全てに当てはまります。 (訳注:「巨人の肩の上に立つ」というのは、ニュートンが言った有名な言葉です。 私が万有引力の発見という業績を成し遂げられたのは、巨人 (先駆者) たちの 肩の上に立っていたからにすぎない、と。日本人も真っ青の謙譲の美徳ですね。) <p> <!-- Thanks to the diligent beta testers and bughunters, especially Jordan Mendelson, Shaw Carruthers, Kevin Moule, Dr. Liviu Daia, Helmut Adams, Franck Sicard, Kevin Littlejohn, Matt Kemner, John D. Hardin, Alexey Kuznetsov, Leos Bitto, Jim Kunzman, Gerard Gerritsen, Serge Sivkov, Andrew Burgess, Steve Schmidtke, Richard Offer, Bernhard Weisshuhn, Larry Auton, Ambrose Li, Pavel Krauz, Steve Chadsey, Francesco Potorti`, Alain Knaff, Casper Boden-Cummins and Henry Hollenberg. --> 念入りなベータテスターとバグハンターに感謝します、特に Jordan Mendelson, Shaw Carruthers, Kevin Moule, Dr. Liviu Daia, Helmut Adams, Franck Sicard, Kevin Littlejohn, Matt Kemner, John D. Hardin, Alexey Kuznetsov, Leos Bitto, Jim Kunzman, Gerard Gerritsen, Serge Sivkov, Andrew Burgess, Steve Schmidtke, Richard Offer, Bernhard Weisshuhn, Larry Auton, Ambrose Li, Pavel Krauz, Steve Chadsey, Francesco Potorti`, Alain Knaff, Casper Boden-Cummins, そして Henry Hollenberg に。 <!-- <sect1>Translations --> <sect1>翻訳 <p> <!-- People who do translations should put themselves at the <em>top</em> of the Thanks page, like so: `Special thanks to XXX, for translating everything exactly from my English.'. Then tell me about your translation so I can include it here. --> 翻訳する人は謝辞ページの冒頭に翻訳者一覧を掲載して下さい。例えば: `私の英語から全てを正確に翻訳してくれたXXXさんに感謝します。' そして、私がこの文書に含められる様に、あなたの翻訳文を教えて下さい。 <p> Arnaud Launay, asl@launay.org: <url url="http://www.freenix.fr/unix/linux/HOWTO/IPCHAINS-HOWTO.html" name="http://www.freenix.fr/unix/linux/HOWTO/IPCHAINS-HOWTO.html"> <p> Giovanni Bortolozzo, borto@pluto.linux.it: <url url="http://www.pluto.linux.it/ildp/HOWTO/IPCHAINS-HOWTO.html" name="http://www.pluto.linux.it/ildp/HOWTO/IPCHAINS-HOWTO.html"> <p> Herman Rodr��uez, herman@maristas.dhis.org: <url url="http://netfilter.kernelnotes.org/ipchains/spanish/HOWTO.html" name="http://netfilter.kernelnotes.org/ipchains/spanish/HOWTO.html"> <p> JF Project, jf@linux.or.jp: <url url="http://www.linux.or.jp/JF/JFdocs/IPCHAINS-HOWTO.html" name="http://www.linux.or.jp/JF/JFdocs/IPCHAINS-HOWTO.html"> <sect>日本語訳について <p> 日本語訳 初版: 2000年 11月 21日 <newline> JF Project 「チーム ipchains」 翻訳者一覧(敬称略、50音順): <itemize> <item>加藤大典 <daisuke@terra.dti.ne.jp> 7章 <item>後藤雅晴 <magotou@fubyshare.gr.jp> 2,3章 <item>中谷千絵 <jeanne@mbox.kyoto-inet.or.jp> 5,6章 <item>奈古屋広昭 <nagoya@cc.hit-u.ac.jp> 1〜4章 <item>松田陽一 <yoh@coolmail.net> 1,4,8〜10章及びまとめ </itemize> <p> この文書を翻訳するにあたり、山森浩幸さん <h-yamamo@db3.so-net.ne.jp> の <url url="http://www.linux.or.jp/JF/JFdocs/packet-filtering-HOWTO.html" name="Linux 2.4 Packet Filtering HOWTO 日本語訳"> から多くを引用致しました。 また、赤松徹さん <akamatsu@kobedenshi.ac.jp> の、 LinuxJAPAN への投稿記事を参考にさせて頂きました。 <p> この文書を翻訳及び編集するにあたり、以下の方々からアドバイスを頂きました。(50音順) <newline> 本当にありがとうございました。 <itemize> <item>伊藤祐一さん <kade@kadesoft.com> <item>加茂智之さん <kto@interlink.or.jp> <item>日下部陽一さん <void@merope.pleiades.or.jp> <item>柴田尚明さん <shibata@luky.org> <item>瀬戸口崇さん <setzer@mx3.tiki.ne.jp> <item>千旦裕司さん <ysenda@pop01.odn.ne.jp> <item>武井伸光さん <takei@webmasters.gr.jp> <item>西田亙さん <wnishida@skyfree.org> <item>水原文さん <mizuhara@acm.org> <item>山森浩幸さん <h-yamamo@db3.so-net.ne.jp> </itemize> </article>