How to build Internet Server with Linux

last update: 29 Sep 2004

home |index |previous |next |contents

tcpwrappers-7.6のインストールと運用



tcpwrappersはセキュリティ機能を向上させたtcpdデーモンです。 細かなアクセス制御と、アクセス状況をログファイルに記録する機能を持っています。
注意:1 /usr/sbin/syslogdとの兼ね合いでlogが記録できない場合があります(tcpwrappersの機能自体は有効)。

注意:2 CERT/CCがTCPwrappersのセキュリティに関する問題点を指摘しました。

TCPwrappers自体のセキュリティ問題ではなく、トロイの木馬を仕掛けられたTCPwrappersが あるので注意せよとのことです。

http://www.cert.org/advisories/CA-99-01-Trojan-TCP-Wrappers.html

4.1 ソフトの入手
"tcpwrappers-7.6"を入手します。以下のサイトから入手できます:
ftp://cert.org/pub/tools/tcp_wrappers
ftp://ftp.win.tue.nl/pub/security/
ftp://ftp.aist-nara.ac.jp/pub/Security/tool/tcp_wrappers

4.2 インストール
インストールはきわめて簡単です。 ファイルを展開するディレクトリ$Workに移動して、バイナリパッケージを展開します。作業ディレクトリ$Workは任意のディレクトリです。

    % cd $Work/
    % gzip -cd tcp_wrappers_7.6.tgz | tar xvf -

次に今作成されたディレクトリに移動し、makeを実行します。
make時のオプションとして次の二つを指定します:
  1. REAL_DEAMON_DIR
    tcpdをインストールするディレクトリを指定します。 通常は/usr/sbin
  2. OS
    OSを指定します。今回は"linux"です。

    % cd $Work/tcp_wrappers_7.6
    % make REAL_DAEMON_DIR=/usr/sbin linux

次に生成されたtcpdデーモンをディレクトリ/usr/sbin以下にコピーして下さい。
    % cp tcpd /usr/sbin

4.3 コンフィギュレーション
tcpwrapperのコンフィギュレーションは/etc/hosts.allowと/etc/hosts.denyで行ないます。

読んで字の如く、"hosts.allow"でアクセスを許可するIPアドレスやドメインを指定し、 "hosts.deny"でアクセスを拒否するIPアドレスやドメインを指定します。

試しに以下の条件を実現する"hosts.allow"と"hosts.deny"を示します。


  1. hosts.allow
    以下のように、アクセスを許可するドメインを書き加えます。
    #
    # hosts.allow	This file describes the names of the hosts which are
    #		allowed to use the local INET services, as decided by
    #		the '/usr/sbin/tcpd' server.
    #
    # Version:	@(#)/etc/hosts.allow	1.00	05/28/93
    #
    # Author:	Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org
    #
    #
    ALL : 254.188.149.0/255.255.255.0
    ALL : 192.168.1.0/255.255.255.0
    ALL : 127.0.0.1
    
    # End of hosts.allow.
    

    /etc/hosts.allow


  2. hosts.deny
    アクセスを拒否するドメインを書きます。"hosts.allow"でアクセスを許可するドメインを書いている場合には、 単に"ALL : ALL"とするだけでそれ以外のドメインからのアクセスをすべて拒否することが出来ます。
    #
    # hosts.deny	This file describes the names of the hosts which are
    #		*not* allowed to use the local INET services, as decided
    #		by the '/usr/sbin/tcpd' server.
    #
    # Version:	@(#)/etc/hosts.deny	1.00	05/28/93
    #
    # Author:	Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org
    #
    #
    ALL : ALL
    # End of hosts.deny.
    

    /etc/hosts.deny



4.4 参考文献
以下の記事が参考になります。

・UNIX MAGAZINE 98.1 TCP wrapperを用いたセキュリティ (p.p.93-98)


home |index |previous |next |contents


since 04/Oct/2004