CentOS tripwire-文件指纹

Tripwire是目前最为著名的unix下文件系统完整性检查的软件工具,这一软件采用的技术核心就是对每个要监控的文件产生一个数字签名,保留下来。当文件现在的数字签名与保留的数字签名不一致时,那么现在这个文件必定被改动过了。
Tripwire可以对要求校验的系统文件进行类似md5的运行,而生成一个唯一的标识,即“快照”snapshot。当这些系统文件的大小、inode号、权限、时间等任意属性被修改后,再次运行Tripwire,其会进行前后属性的对比,并生成相关的详细报告。

1、下载并安装

[[email protected] ~]# wget http://nchc.dl.sourceforge.net/project/tripwire/tripwire-src/tripwire-2.4.2.2/tripwire-2.4.2.2-src.tar.bz2

[[email protected] ~]# tar jxf tripwire-2.4.2.2-src.tar.bz2
[[email protected] ~]# cd tripwire-2.4.2.2-src

[[email protected]ipython tripwire-2.4.2.2-src]# ./configure --prefix=/software/tripwire
[[email protected] tripwire-2.4.2.2-src]# make
[[email protected] tripwire-2.4.2.2-src]# make install

############INSTALL 交互#################
Press ENTER to view the License Agreement.		###回车阅读协议
license agreement. [do not accept] accept		###同意协议
Continue with installation? [y/n] y			###确认继续安装
Enter the site keyfile passphrase:			###需要记住的keyfile
Verify the site keyfile passphrase:			###重复
Enter the local keyfile passphrase:			###需要记住的local keyfile
Verify the local keyfile passphrase:			###重复
Please enter your site passphrase:			###输入
Please enter your site passphrase: 			###输入
############交互结束,完成安装#################

[[email protected] tripwire-2.4.2.2-src]# ls /software/tripwire/etc/ | sort
ipython.me-local.key		####加密本地密钥文件
site.key			####加密站点密钥文件
tw.cfg				####加密配置变量文件
tw.pol				####加密策略文件
twcfg.txt			####定义数据库、策略文件和Tripwire可执行文件的位置
twpol.txt			####定义检测的对象及违规时采取的行为

2、初始化(生成基准数据库)

[[email protected] ~]# /software/tripwire/sbin/tripwire --init
Please enter your local passphrase: 		###键入密码,后面省略此交互
...
...
Wrote database file: /software/tripwire/lib/tripwire/ipython.me.twd
The database was successfully generated.

3、第一次完整性检查,和常用检查参数

[[email protected] ~]# /software/tripwire/sbin/tripwire --check

##默认检查报告存放路径##
/software/tripwire/lib/tripwire/report/
##指定存放路径##
[[email protected] ~]# /software/tripwire/sbin/tripwire --check --twrfile ./test.twr
###Email 发送报告###
[[email protected] ~]# /software/tripwire/sbin/tripwire --check --email-report
###指定Email 报告的级别###
[[email protected] ~]# /software/tripwire/sbin/tripwire --check --email-report --email-report-level 2
###使用指定严重性等级的规则进行检查###
[[email protected] ~]# /software/tripwire/sbin/tripwire --check --severity 80
###使用指定的规则名检查##
[[email protected] ~]# /software/tripwire/sbin/tripwire --check --rule-name rulename
###只检查指定的文件或目录
[[email protected] ~]# /software/tripwire/sbin/tripwire --check object1 object2 object3
###检查是忽略某属性###
[[email protected] ~]# /software/tripwire/sbin/tripwire --check --ignore "property, property, property, property"
###获取帮助
[[email protected] ~]# /software/tripwire/sbin/tripwire --help all

##检视报告##
[[email protected] ~]# /software/tripwire/sbin/twprint --print-report --twrfile ./test.twr 

##重定向加密报告的内容##
[[email protected] ~]# /software/tripwire/sbin/twprint --print-report --twrfile ./test.twr > output.text

##指定报告输出时的级别##
[[email protected] ~]# /software/tripwire/sbin/twprint --print-report --report-level 4 --twrfile ./test.twr > output.text

4、升级基准数据库文件

###升级的目的是很正常的,因为check 是基于基准数据的###
[[email protected] ~]# /software/tripwire/sbin/tripwire --update --twrfile ./test.twr
###检测后立即自动update###
[[email protected] ~]# /software/tripwire/sbin/tripwire --check --interactive 

5、升级策略文件

更新策略稳健,需要修改策略的规则,先将策略重定向出来
[[email protected] ~]# /software/tripwire/sbin/twadmin --print-polfile > twpol.txt
###照猫画虎修改吧,然后update###
[[email protected] ~]# /software/tripwire/sbin/tripwire --update-policy twpol.txt
Parsing policy file: /root/twpol.txt
Please enter your local passphrase:
Please enter your site passphrase:

6、修改site key 和 local key

###修改前记得备份下###
[[email protected] ~]# /software/tripwire/sbin/twadmin --generate-keys --site-keyfile /software/tripwire/etc/site.key
[[email protected] ~]# /software/tripwire/sbin/twadmin --generate-keys --local-keyfile /software/tripwire/etc/site.key 

#配置文件通过site key 假面,数据文件和报告文件用local key 加密#
[[email protected] ~]# /software/tripwire/sbin/twadmin --encrypt --site-keyfile /software/tripwire/etc/site.key
[[email protected] ~]# /software/tripwire/sbin/twadmin --encrypt --local-keyfile /software/tripwire/etc/ipython.me-local.key

» 转载保留版权:IT辰逸 » 《tripwire-文件指纹》

» 本文链接地址:http://www.ipython.me/centos/tripwire-file-md5.html

» 本文版权采取:BY-NC-SA 协议进行授权,转载注明出处。除IT-Tools、News以及特别标注,本站所有文章均为原创。

» 如果喜欢可以:点此订阅本站

CentOS tripwire-文件指纹

时间: 2024-08-05 20:49:23

CentOS tripwire-文件指纹的相关文章

2017-7-19-每日博客-关于Linux下的CentOS中文件夹基本操作命令.doc

CentOS中文件夹基本操作命令 文件(夹)查看类命令 ls--显示指定目录下内容 说明:ls 显示结果以不同的颜色来区分文件类别.蓝色代表目录,灰色代表普通文件,绿色代表可执行文件,红色代表压缩文件,浅蓝色代表链接文件. -a---显示所有内容,包括隐藏文件 说明:在Linux系统中,以"."开头的就是隐藏文件或隐藏目录. -l---以长格式(内容更详细)显示文件或目录的详细信息. 说明:ls -l命令可以简写成ll, 输出的信息共分为7组:文件类别和文件权限.链接数或子目录个数.文

『笔记』windows与CentOS间文件传输(win下实行)

使用工具:PSCP (an SCP client, i.e. command-line secure file copy)也许不是所有人都知道,但是说到 putty 应该很多人都知道吧,直接到 http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html 下载 putty.zip 压缩包,其中包含了 putty pscp psftp plink pageant 等小工具,软件很小,但是基本的功能都具备了,当然,其中也包含了各工具的

MD5指纹(文件指纹验证)

当你从网络上下载了软件后,想确保此软件没有被人修改过(如添加了木马/病毒/非官方插件),或在下载中被破坏,可以用文件指纹验证(MD5)技术进行确认. 原理: 通过某种算法,对具体的文件进行校验,得出了一个32位的十六进制数(校验和).待校验文件的文件名和后缀名都可以更改,不影响校核.由于原来的信息只要有稍许改动,通过md5运算后,结果都会有很大的改变.所以,如果再次校验以后所得到的值(md5代码)和此软件发布站或官方网站公布的值不同,就可以认为,文件已被改动过.

CentOS常用文件操作命令[百度博客搬家]

路径操作的CentOS常用命令 现在整理如下(百度博客搬家) cd pwd NO1. 显示当前路径 [[email protected] root]# pwd NO2. 返回用户主目录 [[email protected] root]# cd NO3. 改变到其它路径 [[email protected] root]# cd /etc NO4. 返回到上一级目录 [[email protected] root]# cd .. NO5. 返回到根目录 [[email protected] root

Centos之文件搜索命令locate

locate命令 locate 文件名 在后台数据库中按文件名搜索,搜索速度更快 /var/lib/mlocate #locate命令所搜索的后台数据库 updatedb 更新数据库 locate搜索速度比较快: [[email protected] ~]# ls 222  anaconda-ks.cfg  牛逼 [[email protected] ~]# locate 牛 -bash: locate: 未找到命令 我们用locate命令的时候 发现 为找到命令,我们用Yum命令远程安装下lo

解决WIN7与虚拟机CentOS的文件夹共享问题

一.系统与软件 WIN7 64bit.VirtualBox 5.0.14.CentOS 6.5.SecureCRT 7.2.3 二.使用文件夹共享需要安装增强功能,但是安装时无法读取光盘iso文件 三.为了方便操作,配置静态IP,并使用CRT连接上去(参考http://my.oschina.net/allman90/blog/294847?fromerr=CotpElUe) [[email protected] ~]# vi /etc/sysconfig/network-scripts/ifcf

CentOS中文件夹基本操作命令

摘自:http://www.centoscn.com/CentOS/help/2013/1024/1967.html 文件(夹)查看类命令 ls--显示指定目录下内容 说明:ls 显示结果以不同的颜色来区分文件类别.蓝色代表目录,灰色代表普通文件,绿色代表可执行文件,红色代表压缩文件,浅蓝色代表链接文件. -a---显示所有内容,包括隐藏文件 说明:在Linux系统中,以“.”开头的就是隐藏文件或隐藏目录. -l---以长格式(内容更详细)显示文件或目录的详细信息. 说明:ls -l命令可以简写

centos rm文件删除恢复

系统是centos 6.5 x64位系统 rm文件删除之后,恢复比较麻烦. 可以使用extundelete进行恢复 目前最新版本是0.2.4 extundelete 主页:http://extundelete.sourceforge.net/ 下载软件 wget http://fossies.org/linux/misc/extundelete-0.2.4.tar.gz 安装组件 yum install -y e2fsprogs e2fsprogs-devel e2fsprogs-libs 安装

xen利用URL的centos镜像文件安装(三)

一.Xen的配置文件说明 Xen配置文件一般由选项(options).变量(variables).CPU.网络.PCI.HVM.计时器(timers).驱动(drivers).磁盘设备(disk devices).动作(behavior),以及图形及声音(Graphics and audio)几个段组成,分别用于定义不同类别的域属性或设备属性. 上面的配置文件中的各选项作用如下. ◇kernel:为当前域指定可用于DomU的内核文件: ◇ramdisk:与kernel指定的内核文件匹配使用的ra