ohsaruの日記: tripwire
日記 by
ohsaru
ファイルの改ざんを防ぐtripwireを入れてみた。
twinstall.sh
で
tripwire --init
とすれば、初期設定も完了し、cronにも書き込まれてインストール
終了になるはずだが、twpol.txtに実際に存在しないファイルが
たくさんあるため、エラーがいっぱい出る。
手で書き換えるのが面倒なのでtwpol.txtの書き換えプログラム
をここにおいておく。
次のディストリビューションからは、きっと不要になるだろう
たぶん
<chpol.pl>
-----------------------------------------------
#!/usr/bin/perl
#$filelist = "f.txt";
$filelist = "twprint -m r --twrfile /var/lib/tripwire/report/*.twr|grep Filename|";
open( I , $filelist )||die($!);
while(<I>){
@f = split(/\s+/);
push(@rpl,$f[2]);
}
close(I);
open( I , $ARGV[0])||die($!);
while(<I>){
foreach $w ( @rpl ){
s/^(\s+$w)/#$1/;
}
print;
}
close(I);
------------------------------------------------------
使い方
一度 tripwiew -m c でエラーを出しまくってください。
mv twpol.txt twpol.txt.org
chpol twpol.txt.org >twpol.txt
これでエラーのなくなったtwpol.txtをtwdに反映させます。
twadmin -m P -c tw.cfg twpol.txt
再度データーベースを作成
tripwire -m -i
テスト
tripwire -m c
twinstall.sh
で
tripwire --init
とすれば、初期設定も完了し、cronにも書き込まれてインストール
終了になるはずだが、twpol.txtに実際に存在しないファイルが
たくさんあるため、エラーがいっぱい出る。
手で書き換えるのが面倒なのでtwpol.txtの書き換えプログラム
をここにおいておく。
次のディストリビューションからは、きっと不要になるだろう
たぶん
<chpol.pl>
-----------------------------------------------
#!/usr/bin/perl
#$filelist = "f.txt";
$filelist = "twprint -m r --twrfile /var/lib/tripwire/report/*.twr|grep Filename|";
open( I , $filelist )||die($!);
while(<I>){
@f = split(/\s+/);
push(@rpl,$f[2]);
}
close(I);
open( I , $ARGV[0])||die($!);
while(<I>){
foreach $w ( @rpl ){
s/^(\s+$w)/#$1/;
}
print;
}
close(I);
------------------------------------------------------
使い方
一度 tripwiew -m c でエラーを出しまくってください。
mv twpol.txt twpol.txt.org
chpol twpol.txt.org >twpol.txt
これでエラーのなくなったtwpol.txtをtwdに反映させます。
twadmin -m P -c tw.cfg twpol.txt
再度データーベースを作成
tripwire -m -i
テスト
tripwire -m c
tripwire More ログイン