Install Tripwire on CentOS or Redhat RHEL

Install Tripwire on CentOS or Redhat RHEL

Tripwire centos

  • Tripwire is important tool to check integrity of the files on Linux.
  • It is having 2 versions one is open-source and one is commerical version. Open-source version not included with Redhat RHEL.
  • We can download tripwire in www.tripwire.org for open source version
  • Commercial version is provided TriSentry suite from www.psionic.com.

This guide we will show you how to install Tripwire with open source version. More detail about Tripwire and Linux Guide. Please have a look http://linuxelearning.ithelpblog.com/

Step 1: Install Epel Repository on your CentOS

http://ithelpblog.com/os/linux/redhat/centos-redhat/how-to-install-epel-repository-on-centos-6-4-or-redhat-6-4-rhel/

Step 2: Install Tripwire

[root@ITHelpBlog ~]# yum install tripwire -y
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.digipower.vn
* epel: mirrors.digipower.vn
* extras: mirrors.digipower.vn
* rpmforge: mirrors.digipower.vn
* updates: mirrors.digipower.vn
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package tripwire.x86_64 0:2.4.1.2-11.el6 will be installed
–> Finished Dependency ResolutionDependencies Resolved=====================================================================================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================================================================================
Installing:
tripwire x86_64 2.4.1.2-11.el6 epel 1.2 MTransaction Summary
=====================================================================================================================================================================================================
Install 1 Package(s)Total download size: 1.2 M
Installed size: 3.7 M
Downloading Packages:
tripwire-2.4.1.2-11.el6.x86_64.rpm | 1.2 MB 00:05
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : tripwire-2.4.1.2-11.el6.x86_64 1/1
Verifying : tripwire-2.4.1.2-11.el6.x86_64 1/1Installed:
tripwire.x86_64 0:2.4.1.2-11.el6Complete!
[root@ITHelpBlog ~]#

Step 3: Create Tripwire local and site key files

[root@ITHelpBlog ~]# tripwire-setup-keyfiles
———————————————-
The Tripwire site and local passphrases are used to sign a variety of
files, such as the configuration, policy, and database files.Passphrases should be at least 8 characters in length and contain both
letters and numbers.See the Tripwire manual for more information.———————————————-
Creating key files…(When selecting a passphrase, keep in mind that good passphrases typically
have upper and lower case letters, digits and punctuation marks, and are
at least 8 characters in length.)Enter the site keyfile passphrase:
Verify the site keyfile passphrase:
Generating key (this may take several minutes)…Key generation complete.(When selecting a passphrase, keep in mind that good passphrases typically
have upper and lower case letters, digits and punctuation marks, and are
at least 8 characters in length.)Enter the local keyfile passphrase:
Verify the local keyfile passphrase:
Generating key (this may take several minutes)…Key generation complete.———————————————-
Signing configuration file…
Please enter your site passphrase:
Wrote configuration file: /etc/tripwire/tw.cfg

A clear-text version of the Tripwire configuration file:
/etc/tripwire/twcfg.txt
has been preserved for your inspection. It is recommended that you
move this file to a secure location and/or encrypt it in place (using a
tool such as GPG, for example) after you have examined it.
———————————————-
Signing policy file…
Please enter your site passphrase:
Wrote policy file: /etc/tripwire/tw.pol

A clear-text version of the Tripwire policy file:
/etc/tripwire/twpol.txt
has been preserved for your inspection. This implements a minimal
policy, intended only to test essential Tripwire functionality. You
should edit the policy file to describe your system, and then use
twadmin to generate a new signed copy of the Tripwire policy.

Once you have a satisfactory Tripwire policy file, you should move the
clear-text version to a secure location and/or encrypt it in place
(using a tool such as GPG, for example).

Now run “tripwire –init” to enter Database Initialization Mode. This
reads the policy file, generates a database based on its contents, and
then cryptographically signs the resulting database. Options can be
entered on the command line to specify which policy, configuration, and
key files are used to create the database. The filename for the
database can be specified as well. If no options are specified, the
default values from the current configuration file are used.

[root@ITHelpBlog ~]#

Step 4: Initializing Tripwire

[root@ITHelpBlog ~]# tripwire –init
Please enter your local passphrase:
Incorrect local passphrase.
Please enter your local passphrase:
Parsing policy file: /etc/tripwire/tw.pol
Generating the database…
*** Processing Unix File System ***
### Warning: File system error.
### Filename: /dev/kmem
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /proc/ksyms
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /proc/pci
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /usr/sbin/fixrmtab
### No such file or directory
### Continuing…### Continuing…
### Warning: File system error.
### Filename: /sbin/kallsyms
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /sbin/ksyms
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /sbin/mkfs.reiserfs
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /sbin/mount.ncp
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /sbin/mount.ncpfs
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /sbin/mount.smb
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /sbin/mount.smbfs
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /sbin/raid0run
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /sbin/raidhotadd
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /sbin/raidhotremove
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /sbin/raidstop
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /sbin/rdump
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /sbin/rdump.static
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /sbin/rrestore
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /sbin/rrestore.static
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /sbin/lilo
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /sbin/mkkerneldoth
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /var/lib/nfs/rmtab
### No such file or directory
### Continuing…
The object: “/var/run/vmblock-fuse” is on a different file system…ignoring.
### Warning: File system error.
### Filename: /var/lock/subsys/portmap
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /var/lock/subsys/apmd
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /var/lock/subsys/canna
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /var/lock/subsys/crond
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /var/lock/subsys/gpm
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /var/lock/subsys/kudzu
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /var/lock/subsys/nfslock
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /var/lock/subsys/ntpd
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /var/lock/subsys/random
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /var/lock/subsys/sendmail
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /var/lock/subsys/syslog
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /var/lock/subsys/xfs
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /var/lock/subsys/xinetd
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /etc/sysconfig/network-scripts/ifdown-cipcb
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /etc/sysconfig/network-scripts/ifdown-sl
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /etc/sysconfig/network-scripts/ifup-cipcb
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /etc/sysconfig/network-scripts/ifup-sl
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /etc/crontab
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /etc/cron.hourly
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /etc/cron.weekly
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /etc/modules.conf
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /etc/yp.conf
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /etc/xinetd.conf
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /etc/syslog.conf
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /bin/sfxload
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /bin/ash
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /bin/ash.static
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /bin/aumix-minimal
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /bin/doexec
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /bin/gettext
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /bin/igawk
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /bin/mt
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /bin/pgawk
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /bin/zsh
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /bin/bash2
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /bin/bsh
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /bin/ksh
### No such file or directory
### Continuing…
The object: “/root/.gvfs” is on a different file system…ignoring.
### Warning: File system error.
### Filename: /root/.Xresources
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /root/.gnome
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /root/.Xauthority
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /dev/cua0
### No such file or directory
### Continuing…
### Warning: File system error.
### Filename: /dev/initctl
### No such file or directory
### Continuing…
Wrote database file: /var/lib/tripwire/ITHelpBlog.twd
The database was successfully generated.
[root@ITHelpBlog ~]#

Step 5: Configure Tripwire policy

You can disable some check by “#” with  ”no such file or directory” file when we have done Initializing polices (in Step 4)

[root@ITHelpBlog ~]# vi /etc/tripwire/twpol.txt
……………………………..

/root
# /root/.Xresources -> $(SEC_CONFIG) ;
/root/.bashrc -> $(SEC_CONFIG) ;
/root/.bash_profile -> $(SEC_CONFIG) ;
/root/.bash_logout -> $(SEC_CONFIG) ;
/root/.cshrc -> $(SEC_CONFIG) ;
/root/.tcshrc -> $(SEC_CONFIG) ;
#/root/Mail -> $(SEC_CONFIG) ;
#/root/mail -> $(SEC_CONFIG) ;
#/root/.amandahosts -> $(SEC_CONFIG) ;
#/root/.addressbook.lu -> $(SEC_CONFIG) ;
#/root/.addressbook -> $(SEC_CONFIG) ;

…………………………….

Step 6: Update policy file

[root@ITHelpBlog ~]# tripwire –update-policy –secure-mode low /etc/tripwire/twpol.txt
Parsing policy file: /etc/tripwire/twpol.txt
Please enter your local passphrase:
Please enter your site passphrase:======== Step 2: Updating the database with new objects.
======== Step 3: Pruning unneeded objects from the database.
Wrote policy file: /etc/tripwire/tw.pol
Wrote database file: /var/lib/tripwire/ITHelpBlog.twd

Step 7: Checking if have any changes in files/folders in Linux System

[root@ITHelpBlog ~]# tripwire –check –interactive
Parsing policy file: /etc/tripwire/tw.pol
*** Processing Unix File System ***Open Source Tripwire 2.4 Portions copyright 2000 Tripwire, Inc. Tripwire is a registered
trademark of Tripwire, Inc. This software comes with ABSOLUTELY NO WARRANTY;
for details use –version. This is free software which may be redistributed
or modified only under certain conditions; see COPYING for details.
All rights reserved.
Integrity check complete.
Open Source Tripwire(R) 2.4.1 Integrity Check ReportReport generated by: root
Report created on: Wed 09 Oct 2013 08:03:35 PM PDT
Database last updated on: Wed 09 Oct 2013 08:01:29 PM PDT===============================================================================
Report Summary:
===============================================================================Host name: ITHelpBlog
Host IP address: Unknown IP
Host ID: None
Policy file used: /etc/tripwire/tw.pol
Configuration file used: /etc/tripwire/tw.cfg
Database file used: /var/lib/tripwire/ITHelpBlog.twd
Command line used: tripwire –check –interactive===============================================================================
Rule Summary:
===============================================================================——————————————————————————-
Section: Unix File System
——————————————————————————-Rule Name Severity Level Added Removed Modified
——— ————– —– ——- ——–
Invariant Directories 66 0 0 0
Temporary directories 33 0 0 0
* Tripwire Data Files 100 1 0 1
Critical devices 100 0 0 0
User binaries 66 0 0 0
Tripwire Binaries 100 0 0 0
Critical configuration files 100 0 0 0
Libraries 66 0 0 0
Operating System Utilities 100 0 0 0
Critical system boot files 100 0 0 0
File System and Disk Administraton Programs
100 0 0 0
Kernel Administration Programs 100 0 0 0
Networking Programs 100 0 0 0
System Administration Programs 100 0 0 0
Hardware and Device Control Programs
100 0 0 0
System Information Programs 100 0 0 0
Application Information Programs
100 0 0 0
Shell Related Programs 100 0 0 0
Critical Utility Sym-Links 100 0 0 0
Shell Binaries 100 0 0 0
“twtemp3hJprH” 587L, 21535C

Step 8: Add one file and recheck again

[root@ITHelpBlog ~]# touch Ithelpblog.com.txt

[root@ITHelpBlog ~]# tripwire –check –interactive
Open Source Tripwire(R) 2.4.1 Integrity Check Report

Report generated by: root
Report created on: Wed 09 Oct 2013 08:05:56 PM PDT
Database last updated on: Wed 09 Oct 2013 08:03:35 PM PDT

===============================================================================
Report Summary:
===============================================================================

Host name: ITHelpBlog
Host IP address: Unknown IP
Host ID: None
Policy file used: /etc/tripwire/tw.pol
Configuration file used: /etc/tripwire/tw.cfg
Database file used: /var/lib/tripwire/ITHelpBlog.twd
Command line used: tripwire –check –interactive

===============================================================================
Rule Summary:
===============================================================================

——————————————————————————-
Section: Unix File System
——————————————————————————-

Rule Name Severity Level Added Removed Modified
——— ————– —– ——- ——–
Invariant Directories 66 0 0 0
Temporary directories 33 0 0 0
Tripwire Data Files 100 0 0 0
Critical devices 100 0 0 0
User binaries 66 0 0 0
Tripwire Binaries 100 0 0 0
Critical configuration files 100 0 0 0
Libraries 66 0 0 0
Operating System Utilities 100 0 0 0
Critical system boot files 100 0 0 0
File System and Disk Administraton Programs
100 0 0 0
Kernel Administration Programs 100 0 0 0
Networking Programs 100 0 0 0
System Administration Programs 100 0 0 0
Hardware and Device Control Programs
100 0 0 0
System Information Programs 100 0 0 0
Application Information Programs
100 0 0 0
Shell Related Programs 100 0 0 0
Critical Utility Sym-Links 100 0 0 0
Shell Binaries 100 0 0 0

Total objects scanned: 21366
Total violations found: 2

===============================================================================
Object Summary:
===============================================================================

——————————————————————————-
# Section: Unix File System
——————————————————————————-

——————————————————————————-
Rule Name: Root config files (/root)
Severity Level: 100
——————————————————————————-

Remove the “x” from the adjacent box to prevent updating the database
with the new values for this object.

Added:
[x] “/root/Ithelpblog.com.txt”

Modified:
[x] “/root”

===============================================================================
Object Detail:
===============================================================================

——————————————————————————-
Section: Unix File System
——————————————————————————-

——————————————————————————-
Rule Name: Root config files (/root)
Severity Level: 100
——————————————————————————-
—————————————-
Added Objects: 1
—————————————-

Added object name: /root/Ithelpblog.com.txt

Property: Expected Observed
————- ———– ———–
* Object Type — Regular File
* Device Number — 2050
* File Device Number — 0
* Inode Number — 390713

Modified object name: /root

Property: Expected Observed
————- ———– ———–
Object Type Directory Directory
Device Number 2050 2050
File Device Number 0 0
Inode Number 390146 390146
Mode dr-xr-x— dr-xr-x—
Num Links 31 31
UID root (0) root (0)
GID root (0) root (0)
Size 4096 4096
* Modify Time Wed 09 Oct 2013 08:03:36 PM PDT
Wed 09 Oct 2013 08:05:57 PM PDT
* Change Time Wed 09 Oct 2013 08:03:36 PM PDT
Wed 09 Oct 2013 08:05:57 PM PDT
Blocks 8 8

Thanks for using IThelpblog.com.

Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>