TCPD(8) TCPD(8)
名前
tcpd - internet services のためのアクセスコントロール機能
説明
tcpd プログラムは、telnet, finger, ftp, exec, rsh, rlogin, tftp, talk,
comsat や、その他、実行ファイルと一対一にマップされたサービスに対するリ
クエストを監視するために設定するものである。
プ ログラムは 4.3BSD スタイルの sockets と System V.4 スタイルの TLI の
両方をサポートしている。ただし、TLI の元にあるプロトコルがインターネ ッ
トのプロトコルでない場合、機能は制限される可能性がある。
そ の仕組みは次のようになっている: サービスを求めるリクエストが届くと、
inetd デーモンは、要求されたサービスを起動する代わりに、 tcpd に役目 を
交替する。tcpd はリクエストをログに記録し、いくつかのチェックを実行する
。すべてよしとなれば、tcpd は適切なサーバプログラムを起動し、そして姿を
消す。
オ プショナルな機能として: パターン形式のアクセスコントロール、 RFC 931
などのプロトコルに基づく、クライアントのユーザ名の探査、別のホスト名 を
装 っているホストからの防御、そして、別のネットワークアドレスを装ってい
るホストからの防御、などがある。
ログの記録
tcpd によって監視の対象となる接続は、 syslog(3) 機能を通して報告され る
。 どの記録も、時刻、クライアントホストの名前、要求されたサービス名を含
んでいる。この情報は、特にログファイル中に複数のホストの情報が混在し て
いる場合でも、好ましからざる行動を察知するには有用である。
あなたのログがどこに記録されるのか調べるためには、syslog の設定ファイル
(大抵の場合は /etc/syslog.conf) を参照すること。
アクセスの制御
オプションとして、 tcpd は、パターンマッチングに基づくアクセスコント ロ
ー ルのシンプルな書式をサポートしている。アクセスコントロールのソフトウ
ェアは、パターンに合致した時に、シェルコマンドを実行するためのフック を
提供している。詳細は hosts_access(5) のマニュアルを参照のこと。
ホスト名の検証
いくつかのプロトコル (rlogin, rsh) の認証の仕組みは、ホストの名前に頼っ
ている。ある実装は、ランダムなネームサーバから得たホスト名を信用する よ
う になっている。別の実装ではもっと注意深いが、欠陥のあるアルゴリズムを
使っている。
tcpd は、アドレス→名前の翻訳を行なう DNS サーバから返答されるクライ ア
ントのホスト名と、名前→アドレスの翻訳を行なう DNS サーバから返答される
ホスト名とを突き合わせ、確認を行う。何らかの矛盾が発覚すると、 tcpd は
、 これはどこかよそのホストの名前を偽装しているホストとの取り引きである
、と判定する。ソースが -DPARANOID でコンパイルされているなら、 tcpd は
、ホスト名/アドレスの不一致がある場合、接続を切断することになる。さもな
くば、しかるべき行動がとられたのちに、ホスト名を PARANOID のワイルド カ
ードにマッチさせることができる。
ホストアドレスの詐称
オ プ シ ョ ンとして、 tcpd は、取り引きする接続のたびに source-routing
socket option を無効にできる。これによって、よそのネットワークに属す る
ア ドレスを偽装しているホストからの、大抵の攻撃に備えることができるだろ
う。UDP サービスについては、この防御は役に立たない。この機能について は
、コンパイル時に有効になっていなければならない。
RFC 931
RFC 931 などに基づく問い合わせが有効な場合 (これはコンパイル時のオプシ
ョン設定)、tcpd はクライアントユーザの名前を検証しようと試みる。これ は
、クライアントホストが RFC 931 互換のデーモンを動作させている場合にだけ
成功する。このクライアントユーザ名の問い合わせは、データ指向の高いコ ネ
ク ションに対しては機能せず、またパーソナルシステム(PCs) からの接続の場
合は、著しく遅くなるかも知れない。
例
tcpd の利用法の詳細は、コンパイル時にプログラムの中に入れられ た path-
name に依存する。
例 1
この例では、tcpd は、オリジナルのネットワークデーモンが別の場所に移動さ
れることを期待している。
finger サービスへのアクセスを監視するためには、オリジナルの finger デー
モ ンは別の場所へと移動し、元々 finger デーモンがいた場所には tcpd をイ
ンストールする。設定ファイルへの変更は必要ない。
# mkdir /other/place
# mv /usr/etc/in.fingerd /other/place
# cp tcpd /usr/etc/in.fingerd
この例では、ネットワークデーモンは /usr/etc にあるものとする。システ ム
によっては、ネットワークデーモンは /usr/sbin または /usr/libexec に置か
れていたり、名前の頭に ‘in.´ という文字を持っていなかったりする。
例 2
この例で tcpd は、ネットワークデーモンは、そのオリジナルの場所に置か れ
ている事を想定している。
finger サ ー ビスへのアクセスを監視するためには、次に示すような変更を
inetd の設定ファ イ ル ( 大 抵 の 場 合 、 /etc/inetd.conf ま た は
/etc/inet/inetd.conf) に対して行なう:
finger stream tcp nowait nobody /usr/etc/in.fingerd in.fingerd
これを次のように:
finger stream tcp nowait nobody /some/where/tcpd in.fingerd
こ の例では、ネットワークデーモンは /usr/etc にあるものとする。システム
によっては、ネットワークデーモンは /usr/sbin または /usr/libexec に置か
れ て いたり、名前の頭に ‘in.´ という文字を持っていなかったり、あるいは
inetd の設定ファイルには userid の項目が存在しないこともある。
似たような変更が、tcpd でカバーされるその他のサービスに対しても必要にな
る だ ろ う 。 変更を有効なものとするため、 inetd(8) のプロセスに対して
‘kill -HUP´ を送出する。AIX のユーザは ‘inetimp´ コマンドも実行する必要
があるかもしれない。
例 3
デ ー モンが普通でないディレクトリ("secret" やその他)に置かれている場合
、inetd の設定ファイルを編集して、プロセス名の項には絶対パス名で明示 す
るように。例:
ntalk dgram udp wait root /some/where/tcpd /usr/local/lib/ntalkd
パ ス名の一番最後の要素 (ntalkd) だけがアクセスコントロールと、ログの記
録に使われる。
バグ
いくつかの UDP (そして RPC) デーモンは、その仕事が終わって、別のリク エ
ス トがやって来ても、しばらくの間、名残惜しそうにプロセス空間をうろつい
ている。これらのサービスは、inetd の設定ファイルの中で、wait オプション
と ともに登録されている。このようなデーモンは、それを起動したリクエスト
だけがログに記録されることになる。
プログラムは、TCP 経由の RPC サービスにおいては動作しない。これらのサー
ビ スは、inetd の設定ファイルの中で、rpc/tcp として登録されている。この
制限によって影響される唯一特別なサービスは、 on(1) コマンドによって利用
されるrexd である。しかし、これは大したロスではない。大抵のシステムにお
いて、rexd は /etc/hosts.equiv の中のワイルドカードよりも安全度が低いの
だ。
RPC broadcast リクエスト (例: rwall, rup, rusers) が、応答のあるホスト
から常にやってくることがある。クライアントが、そのネットワーク上の全 て
の portmap デーモンに対してブロードキャストしている、というのがその実態
である; どの portmap デーモンも、リクエストはローカルのデーモンへと転送
す る。rwall などのデーモンが知る限り、リクエストはローカルホストから送
られてくるのである。
ファイル
ホストアクセスコントロールテーブル:
/etc/hosts.allow
/etc/hosts.deny
関連項目
hosts_access(5), ホストアクセスコントロールファイルの書式
syslog.conf(5), syslogd コントロールファイルの書式
inetd.conf(5), the inetd コントロールファイルの書式
著者
Wietse Venema (wietse@wzv.win.tue.nl),
Department of Mathematics and Computing Science,
Eindhoven University of Technology
Den Dolech 2, P.O. Box 513,
5600 MB Eindhoven, The Netherlands
翻訳
FUKUSHIMA Osamu
TCPD(8) TCPD(8) NAME tcpd - access control facility for internet services DESCRIPTION The tcpd program can be set up to monitor incoming requests for telnet, finger, ftp, exec, rsh, rlogin, tftp, talk, comsat and other services that have a one-to-one mapping onto executable files. The program supports both 4.3BSD-style sockets and System V.4-style TLI. Functionality may be limited when the protocol underneath TLI is not an internet protocol. Operation is as follows: whenever a request for service arrives, the inetd daemon is tricked into running the tcpd program instead of the desired server. tcpd logs the request and does some additional checks. When all is well, tcpd runs the appropriate server program and goes away. Optional features are: pattern-based access control, client username lookups with the RFC 931 etc. protocol, protection against hosts that pretend to have someone elses host name, and protection against hosts that pretend to have someone elses network address. LOGGING Connections that are monitored by tcpd are reported through the sys- log(3) facility. Each record contains a time stamp, the client host name and the name of the requested service. The information can be useful to detect unwanted activities, especially when logfile informa- tion from several hosts is merged. In order to find out where your logs are going, examine the syslog con- figuration file, usually /etc/syslog.conf. ACCESS CONTROL Optionally, tcpd supports a simple form of access control that is based on pattern matching. The access-control software provides hooks for the execution of shell commands when a pattern fires. For details, see the hosts_access(5) manual page. HOST NAME VERIFICATION The authentication scheme of some protocols (rlogin, rsh) relies on host names. Some implementations believe the host name that they get from any random name server; other implementations are more careful but use a flawed algorithm. tcpd verifies the client host name that is returned by the address->name DNS server by looking at the host name and address that are returned by the name->address DNS server. If any discrepancy is detected, tcpd concludes that it is dealing with a host that pretends to have someone elses host name. If the sources are compiled with -DPARANOID, tcpd will drop the connec- tion in case of a host name/address mismatch. Otherwise, the hostname can be matched with the PARANOID wildcard, after which suitable action can be taken. HOST ADDRESS SPOOFING Optionally, tcpd disables source-routing socket options on every con- nection that it deals with. This will take care of most attacks from hosts that pretend to have an address that belongs to someone elses network. UDP services do not benefit from this protection. This feature must be turned on at compile time. RFC 931 When RFC 931 etc. lookups are enabled (compile-time option) tcpd will attempt to establish the name of the client user. This will succeed only if the client host runs an RFC 931-compliant daemon. Client user name lookups will not work for datagram-oriented connections, and may cause noticeable delays in the case of connections from PCs. EXAMPLES The details of using tcpd depend on pathname information that was com- piled into the program. EXAMPLE 1 This example applies when tcpd expects that the original network dae- mons will be moved to an "other" place. In order to monitor access to the finger service, move the original finger daemon to the "other" place and install tcpd in the place of the original finger daemon. No changes are required to configuration files. # mkdir /other/place # mv /usr/etc/in.fingerd /other/place # cp tcpd /usr/etc/in.fingerd The example assumes that the network daemons live in /usr/etc. On some systems, network daemons live in /usr/sbin or in /usr/libexec, or have no ‘in.´ prefix to their name. EXAMPLE 2 This example applies when tcpd expects that the network daemons are left in their original place. In order to monitor access to the finger service, perform the following edits on the inetd configuration file (usually /etc/inetd.conf or /etc/inet/inetd.conf): finger stream tcp nowait nobody /usr/etc/in.fingerd in.fingerd becomes: finger stream tcp nowait nobody /some/where/tcpd in.fingerd The example assumes that the network daemons live in /usr/etc. On some systems, network daemons live in /usr/sbin or in /usr/libexec, the dae- mons have no ‘in.´ prefix to their name, or there is no userid field in the inetd configuration file. Similar changes will be needed for the other services that are to be covered by tcpd. Send a ‘kill -HUP´ to the inetd(8) process to make the changes effective. AIX users may also have to execute the ‘inetimp´ command. EXAMPLE 3 In the case of daemons that do not live in a common directory ("secret" or otherwise), edit the inetd configuration file so that it specifies an absolute path name for the process name field. For example: ntalk dgram udp wait root /some/where/tcpd /usr/local/lib/ntalkd Only the last component (ntalkd) of the pathname will be used for access control and logging. BUGS Some UDP (and RPC) daemons linger around for a while after they have finished their work, in case another request comes in. In the inetd configuration file these services are registered with the wait option. Only the request that started such a daemon will be logged. The program does not work with RPC services over TCP. These services are registered as rpc/tcp in the inetd configuration file. The only non-trivial service that is affected by this limitation is rexd, which is used by the on(1) command. This is no great loss. On most systems, rexd is less secure than a wildcard in /etc/hosts.equiv. RPC broadcast requests (for example: rwall, rup, rusers) always appear to come from the responding host. What happens is that the client broadcasts the request to all portmap daemons on its network; each portmap daemon forwards the request to a local daemon. As far as the rwall etc. daemons know, the request comes from the local host. FILES The default locations of the host access control tables are: /etc/hosts.allow /etc/hosts.deny SEE ALSO hosts_access(5), format of the tcpd access control tables. syslog.conf(5), format of the syslogd control file. inetd.conf(5), format of the inetd control file. AUTHORS Wietse Venema (wietse@wzv.win.tue.nl), Department of Mathematics and Computing Science, Eindhoven University of Technology Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands TCPD(8)
Copyright(C) linux-cmd.com All Rights Reserved. Author Takayuki Yukawa