# wget http://jaist.dl.sourceforge.net/sourceforge/tripwire/tripwire-2.4.2.2-src.tar.bz2
# tar jxvf tripwire-2.4.2.2-src.tar.bz2
2. Tripwireインストール
展開先ディレクトリへ移動して、インストールを実行する。
1234567891011121314151617181920212223242526
# cd tripwire-2.4.2.2-src
# ./configure --prefix=/usr/local/tripwire --sysconfdir=/etc/tripwire && make && make install
Press ENTER to view the License Agreement. # <= 空ENTER
# ===< SPACEキー押下でライセンス表示を流す >===
Please type "accept" to indicate your acceptance of this
license agreement. [do not accept] accept # <= "accept" 応答
Continue with installation? [y/n] y # <= "y" 応答
Enter the site keyfile passphrase: # <= 任意のサイトパスフレーズ応答
Verify the site keyfile passphrase: # <= 確認入力
Enter the local keyfile passphrase: # <= 任意のローカルパスフレーズ応答
Verify the local keyfile passphrase: # <= 確認入力
Creating signed configuration file...
Please enter your site passphrase: # <= サイトパスフレーズ応答
Creating signed policy file...
Please enter your site passphrase: # <= サイトパスフレーズ応答
The installation succeeded.
3. 後始末
インストール後、展開先ディレクトリ・アーカイブファイルは不要なので削除しておく。
123
# cd
# rm -rf tripwire-2.4.2.2-src
# rm -f tripwire-2.4.2.2-src.tar.bz2
# twadmin -m F -c /etc/tripwire/tw.cfg -S /etc/tripwire/site.key /etc/tripwire/twcfg.txt
Please enter your site passphrase: # <= サイトパスフレーズ応答
Wrote configuration file: /etc/tripwire/tw.cfg
暗号化したら、元のテキストファイル “twcfg.txt” は削除する。
1
# rm -f /etc/tripwire/twcfg.txt
ちなみに、暗号化した設定ファイルからテキストファイルを復元するには以下のようにする。
1
# twadmin -m f -c /etc/tripwire/tw.cfg > /etc/tripwire/twcfg.txt
#!/usr/bin/perl# Tripwire Policy File customize tool# ----------------------------------------------------------------# Copyright (C) 2003 Hiroaki Izumi# This program is free software; you can redistribute it and/or# modify it under the terms of the GNU General Public License# as published by the Free Software Foundation; either version 2# of the License, or (at your option) any later version.# This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.# You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.# ----------------------------------------------------------------# Usage:# perl twpolmake.pl {Pol file}# ----------------------------------------------------------------#$POLFILE=$ARGV[0];open(POL,"$POLFILE") or die "open error: $POLFILE";my($myhost,$thost);my($sharp,$tpath,$cond);my($INRULE)=0;while(<POL>){ chomp;if(($thost)= /^HOSTNAME\s*=\s*(.*)\s*;/){$myhost=`hostname`; chomp($myhost);if($thost ne $myhost){$_="HOSTNAME=\"$myhost\";";}} elsif ( /^{/ ){$INRULE=1;} elsif ( /^}/ ){$INRULE=0;} elsif ($INRULE==1 and ($sharp,$tpath,$cond)= /^(\s*\#?\s*)(\/\S+)\b(\s+->\s+.+)$/){$ret=($sharp=~ s/\#//g);if($tpath eq '/sbin/e2fsadm'){$cond=~ s/;\s+(tune2fs.*)$/;\#$1/ ;}if(! -s $tpath){$_="$sharp#$tpath$cond"if($ret== 0);}else{$_="$sharp$tpath$cond";}} print "$_\n";}close(POL);
# twadmin -m P -c /etc/tripwire/tw.cfg -p /etc/tripwire/tw.pol -S /etc/tripwire/site.key /etc/tripwire/twpol.txt.new
Please enter your site passphrase: # <= サイトパスフレーズ応答
Wrote policy file: /etc/tripwire/tw.pol