Tripwire配置和运行

# cd /usr/local/etc

# ll

drwxr-xr-x  2 root root  4096 2012-10-13 20:50 ./

drwxr-xr-x 13 root root  4096 2012-10-12 17:16 ../

-rw-r-----  1 root root   931 2012-10-12 17:17 noi-linux-local.key

-rw-r-----  1 root root   931 2012-10-12 17:17 site.key

-rw-------  1 tss  tss   6421 2012-09-27 15:39 tcsd.conf

-rw-r-----  1 root root  4586 2012-10-13 20:39 tw.cfg

-rw-r-----  1 root root   508 2012-10-13 18:47 twcfg.txt

-rw-r-----  1 root root  4159 2012-10-13 18:51 tw.pol

-rw-r-----  1 root root 13703 2012-10-13 18:50 twpol.txt

 

tw.cfg为配置文件,tw.pol为策略文件。

首先编辑twcfg.txt和twpol.txt文件,也可以自己写txt文件代替原有策略文件,

然后使用如下命令#twadmin --create-cfgfile --cfgfile tw.cfg --site-keyfile site.key twcfg.txt

和                        #twadmin --create-polfile --polfile tw.pol --site-keyfile site.key twpol.txt

重新生成tw.cfg和tw.pol文件,重新生成需要site密码。

 

然后可以初始化了:

#tripwire --init

需要local密码,

 

Please enter your local passphrase: 

Parsing policy file: /usr/local/etc/tw.pol

Generating the database...

*** Processing Unix File System ***

Wrote database file: /usr/local/lib/tripwire/noi-linux.twd

The database was successfully generated.

 

可见数据库文件位置为/usr/local/lib/tripwire/noi-linux.twd

完整性报告位置/usr/local/lib/tripwire/report/

 

现在可以测试一下tripwire了:

我们在/home文件夹建立一个test文件夹测试,在/usr/local/etc/文件夹下新建一个策略txt文件,如newpol.txt,在这个文件里写入检查test文件的命令,

# Test File

   rulename = "Test File",

)

{

   /home/test -> $(IgnoreNone);

}

 

写入新策略:

#twadmin --create-polfile -S site.key newpol.txt

查看是否写入:

#twadmin --print-polfile

重新初始化数据库:

#tripwire --init

扫描文件系统:

#tripwire -m c

更新数据库:

#export LANG=C; tripwire --update --twrfile /usr/local/lib/tripwire/noi-linux.twr

会打开vi编辑器,将能接受的更新前的"x"删除,然后输入:wq保存,输入local密码,退出。

再次扫描:

#tripwire -m c

发现刚才数据库更改后的部分不再报告。

 

参考文献:http://tonychiu.blog.51cto.com/656605/577500

                 http://www.ibm.com/developerworks/aix/library/au-usingtripwire/index.html

 

posted on 2015-04-22 15:45  记不住  阅读(358)  评论(0编辑  收藏  举报

导航