How to build Internet Server with Linux

last update: 29 Sep 2004

home |index |contents |next |previous

tripwire



tripwireで、簡便にファイルシステムの改ざんを検出することができます。
どんなに厳しくアクセス制御を行っても、侵入者がサーバに侵入し、ファイルの改ざんを行ったり、自作のプログラムやトロイの木馬を仕掛けたりする可能性があります。このような事態に対処するため、ファイルシステムの改ざんを検出できるようにしておく必要があります。
tripwireは、現在最もよく使われるファイルシステムの改ざん検出ツールです。以下にインストール方法と使用方法を説明します。

5.1 ダウンロード
Tripwireは商用、フリーの両バージョンがあります。フリーのバージョンは、以下のURLからダウンロードできます。

http://www.tripwire.org/

2002年1月現在、最新のアーカイブは"tripwire-2.3-47.bin.tar.gz"です。
5.2 インストール
適当なディレクトリで"tripwire"のアーカイブを展開したら、 作成されたディレクトリに移動し、"install.sh"スクリプトを実行します。
	# tar zxvf tripwire-2.3-47.bin.tar.gz
	# cd tripwire-2.3
	# ./install.sh

tripwireインストール


途中、ライセンス条項を受諾するかどうか尋ねてきますので、 受諾の場合には"accept"を入力します。
	# ./install.sh
	Installer program for:
	Tripwire(R) 2.3 Open Source for LINUX

	Copyright (C) 1998-2000 Tripwire (R) Security Systems, Inc.  Tripwire (R)
	is a registered trademark of the Purdue Research Foundation and is
	licensed exclusively to Tripwire (R) Security Systems, Inc.

	LICENSE AGREEMENT for Tripwire(R) 2.3 Open Source for LINUX

	-- 略 --

	Please type "accept" to indicate your acceptance of this
	license agreement. [do not accept] accept

tripwireインストール(つづき)


次に3つのパスフレーズ、 を入力します。 (パスフレーズは8文字以上です。)
	Enter the site keyfile passphrase:		<-サイトキーファイル用パスフレーズ入力
	Verify the site keyfile passphrase:		<-サイトキーファイル用パスフレーズ再入力
	Generating key (this may take several minutes)...Key generation complete.

	-- 略 --

	Enter the local keyfile passphrase: 		<-キーファイル用パスフレーズ入力
	Verify the local keyfile passphrase: 		<-キーファイル用パスフレーズ再入力
	Generating key (this may take several minutes)...Key generation complete.

	-- 略 --

	Creating signed configuration file...
	Please enter your site passphrase: 		<-サイト用パスフレーズ入力
	Wrote configuration file: /etc/tripwire/tw.cfg

tripwireインストール(つづき)


以上でインストールは完了です。
5.3 初期設定
twadminコマンドを使って設定ファイル(tw.cfg)と、ポリシーファイル(twpol.txt)を生成します。
	# twadmin --create-cfgfile --site-keyfile /etc/tripwire/site.key /etc/tripwire/twcfg.txt
	Please enter your site passphrase: 	<-サイト用パスフレーズ入力
	Wrote configuration file: /etc/tripwire/tw.cfg

設定ファイルの生成


	# twadmin --create-polfile /etc/tripwire/twpol.txt              
	Please enter your site passphrase: 	<-サイト用パスフレーズ入力
	Wrote policy file: /etc/tripwire/tw.pol

ポリシーファイルの生成


次に、tripwireデータベースを作成します。 このデータベースにはファイルシステムの情報が書き込まれます。
	# tripwire --init
	### Continuing...
	Wrote database file: /var/lib/tripwire/client.domain.net.twd
	The database was successfully generated.

tripwireの初期化

* コンソールイメージ:
5.4 運用
2回目以降の実行は"--check"オプションをつけて実行します。
	# tripwire --check

tripwireの実行


tripwireを実行すると、/var/lib/tripwire/reportディレクトリ以下に、 結果がファイルとして収められます。tripwireの結果出力ファイル名は次のような書式です。
	サイト名-年月日-時刻分秒.twr

結果出力ファイル名の書式


結果をコンソールに表示するにはtwprintコマンドを使います。 例として、"client.domain.net-20011231-235833.twr"という結果出力ファイルの内容を表示する場合を示します。
	# twprint -m r --twrfile /var/lib/tripwire/report/client.domain.net-20011231-235833.twr

twprint


trpwireを定期的に実行し、ファイルシステムの改ざんを監視しましょう。


home |index |contents |next |previous


since 04/Oct/2004