#author("2021-02-08T05:01:49+00:00","default:src128","src128")
&tag(tripwire);
*目次 [#l8781dc9]
#contents
*関連ページ [#la7ff0d4]
*参考情報 [#yd9dbd3c]
-[[Tripwireによるファイル改ざん検知の導入〜設定〜運用の流れ - Qiita:https://qiita.com/progrhyme/items/f65c3a56cf6e5e954f8d]]
-[[顰に倣う - Tripwireの導入 - Qiita:https://qiita.com/mitzi2funk/items/357d5787501dd627d68c]]


*基本情報 [#ve1d8851]
-サイトキー、ローカルキーの入力が必要。
-設定ファイルを暗号化する必要がある。


*インストール [#ha4d0914]
-Debian/Ubuntuの場合
 apt install tripwire
-サイトキーとローカルキーの入力が求められるので適当に入力する。

*設定 [#g1c44786]
**設定ファイルの最適化 [#w6be90bd]
-[[ファイル改竄検知システム導入(Tripwire) - CentOSで自宅サーバー構築:https://centossrv.com/tripwire.shtml]]が出典のtwpolmake.plを/etc/tripwireに作成。
#pre{{
#!/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;
    # HOSTNAME=hogeを検索してhostnameの結果で置き換え
    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) ;
}}


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS