Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security & DevOps Insights

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form
Home » Linux » How to install and configure Tripwire on Ubuntu
  • Featured image Some Settings are managed by your organization
    How to Fix “Some Settings Are Managed by Your Organization” Error in Windows Update Windows
  • Feature image OCS inventory
    Install and use OCS inventory on Windows Windows
  • 980239e9 cisco logo 2
    LACP Configuration on Cisco 3650 Switch Network | Monitoring
  • Fix invalid backup repostory and delete not needed repo via Veeam Backup Repository
    Fix missing path and delete a Veeam Backup Repository Backup
  • kubernetes
    Create and monitor Apps using the Azure Kubernetes Service manifest AWS/Azure/OpenShift
  • Banner
    How to Deploy GitHub Repositories to cPanel using GitHub Actions Automation
  • vcenter sign on
    CVE-2021-22048: VMware vCenter Server updates address a privilege escalation vulnerability Security | Vulnerability Scans and Assessment
  • What Happens if You Turn Off Your Computer During windows update
    What Happens if You Turn Off Your Computer During an Update Windows

How to install and configure Tripwire on Ubuntu

Posted on 24/03/202222/04/2023 Raphael Gab-Momoh By Raphael Gab-Momoh No Comments on How to install and configure Tripwire on Ubuntu
trip-wire-feature

Tripwire is an application (IDS) that monitors your vital system files and reports in real-time to see if they’ve been tampered with or destroyed by a hacker (or by mistake). It enables the system administrator to quickly determine what has been compromised and remediate the situation. When it comes to managing internet servers, security is a huge issue. While firewalls, fail2ban policies, secure services, and application lockdown can all be configured, it’s difficult to tell for sure if you’ve successfully prevented every threat. This guide will show you how to install and configure Tripwire on Ubuntu. Please see how to troubleshoot and fix Windows 11 blue screen, and how to Protect Microsoft Defender Settings with Tamper Protection.

A host-based intrusion detection system (HIDS) collects information about the file system and configuration of your computer. It then saves this data to reference and validate the system’s present status. If there are differences between the known-good state and the present state, your security may have been compromised. This code in this guide will work on almost all versions of Ubuntu except those below 18. Other guides can be found here: How to install Node.js on Ubuntu/, How to install MariaDB on Ubuntu/, How to install Apache Tomcat on Ubuntu/, also How to Install Terraform on Linux

Tripwire is a host-based Intrusion Detection System that is open source. Tripwire can check for file integrity and monitor and notify of changes to files and directories. Please see these exciting guides: What are the Differences between Directory Services and Databases, Email notifications for MBAM Enterprise and Compliance and Recovery Audit reports, how to Query MBAM to display the BitLocker Recovery report, and How to Clear Cache on Windows 10.

Step 1: Install and Configure Tripwire on Ubuntu

Tripwire is available in Ubuntu’s default repository. We may use apt-get to install it by typing:

$sudo apt-get update
$sudo apt-get install tripwire

The process is interactive as we can see from the gallery:

install3
install5
install8

This installation will require a significant amount of configuring of the required packages. It will set up the mail program first that has been added as a dependency. Select “Internet site” if you wish to set up email notifications.

During installation, it will ask if you want to choose your passwords. Answer “yes” to both of these questions. It will inquire if the configuration file may be rebuilt. “Yes” should be selected. It will inquire about the policy file in a comparable manner. 

Afterwards, you’ll be prompted to select and confirm a site key passphrase. Tripwire’s configuration files are protected by two keys. This key is used to safeguard the configuration files on the server. We need to make sure the configuration files aren’t tampered with, else our entire detection system will be compromised. This key can be used on different servers because the same configuration files can be utilized.

Local identifier: This key is used to run the binaries on each machine. This is required in order to prevent our binaries from being run without our permission. You’ll choose and confirm a pass for the site key first, followed by the local key. Make sure to pick strong passwords.

Step 2: Create Tripwire keys and initialize the database

Now that the installation is complete, we must set up the database so that tripwire can begin working. Please see how to fix you are not allowed to view this folder on SSRS: MBAM reports cannot be accessed because it could not load folder contents.

$ cd /etc/tripwire/
$ ls -l
ls-l
cd into tripwire

We’ll set REPORTLEVEL to 4 in the twcfg.txt file, which is the maximum.

reportlevel
report level set to 4

After the change, create a configuration file:

$ sudo twadmin -m F -c tw.cfg -S site.key twcfg.txt
wrote-conf
config file

Step 3: Optimize the Tripwire Policy file

Make a file called twpolmake.pl with the following content:

$ sudo vim twpolmake.pl

Add the policy into the vim file:

#!/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) ;

You’ll be requested to enter the password you set up before.

This converts the plain text policy file in the /etc/tripwire/ directory to an encrypted policy file. When tripwire runs its tests, it really reads this encrypted file.

Tripwire will utilize this database to validate our system, so we can now set it up. This verifies the points that are provided within the policy file that we just started.

We’ll get a lot of warnings, false positives, and problems because this file hasn’t been adapted for our system yet. In a minute, we’ll utilize these as a guide to fine-tune our configuration file.

You will have to create configs with the commands below:

 $perl twpolmake.pl twpol.txt > twpol.txt.new
 $twadmin -m P -c tw.cfg -p tw.pol -S site.key twpol.txt.new 
config
create config

Create Tripwire database:

tripwire -m i -s -c tw.cfg

as expected false error but just continue

false-error
create database

You can print database using the command:

# twprint -m d -d /var/lib/tripwire/server-01.twd

Step 4: Updating the database

# tripwire --update --accept-all

executing checking manually

root@ubuntu:~# tripwire -m c -s -c /etc/tripwire/tw.cfg 

Since there are no errors encountered, Tripwire data files are located on /var/lib/tripwire/<servername>.twd Scan results are saved under /var/lib/tripwire/report/ directory:

# ls /var/lib/tripwire/report/
pRINT-report

To print this report, use the syntax:

twprint -m r -t [0-4] -r /path/to/reportfile.twr

The -t measure indicates the report verbosity, with 0 displaying a single-line summary of the contents and 4 displaying all gathered characteristics for all altered objects.

If no report level is supplied on the command line or via the REPORTLEVEL config file option, the report level defaults to 3. Example: we used our path from the screenshot above

twprint -m r -t 4 -r /var/lib/tripwire/report/ubuntu-20220324-115138.twr

report is shown below:

oot@ubuntu:~# twprint -m r -t 4 -r /var/lib/tripwire/report/ubuntu-20220324-115138.twr

Also, note that you can update this report manually:

tripwire -m u -a -s -c /etc/tripwire/tw.cfg -r /var/lib/tripwire/report/ubuntu-20220324-115138.twr

Step 5: Updating a policy

Policy update mode allows you to make changes to your current Tripwire policy without sacrificing your previous baselines.

 tripwire --update-policy updated-policy.txt

As part of the update process, this will do a check against the new policy. If this check finds changes, the default approach is to show the changes and then quit without altering the policy or database.

Step 6: Testing email configuration

To test email configuration:

 tripwire --test --email [email protected]
testing-email

This sends a test email to the supplied address, using the config file’s email settings.

tripwire-email

Summary

In this article, you have learned how to install and configure Tripwire on Ubuntu. We went through the steps to install Tripwire, which is an open-source intrusion detection system it monitors your vital system files and reports in real-time to see if they’ve been tampered with or destroyed by a hacker or by accident.

Rate this post

Thank you for reading this post. Kindly share it with others.

  • Click to share on X (Opens in new window) X
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on Tumblr (Opens in new window) Tumblr
  • Click to share on Telegram (Opens in new window) Telegram
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on Bluesky (Opens in new window) Bluesky
  • Click to share on Threads (Opens in new window) Threads
  • Click to share on Nextdoor (Opens in new window) Nextdoor
Linux Tags:security, Ubuntu, Ubuntu 20.04 LTS

Post navigation

Previous Post: How to install Node.js on Ubuntu
Next Post: How to stop Docker from automatically starting on Mac

Related Posts

  • Synergy software kvm
    Why Software KVMs such as Synergy is replacing Hardware KVMs Linux
  • redisf
    How to install Redis on Linux System Linux
  • Screenshot 2021 02 14 at 00.35.50
    How to manage automatic login on Ubuntu Linux Linux
  • Webp.net resizeimage 1
    Automate Infrastructure Deployments in the Cloud with Ansible and Azure Pipelines AWS/Azure/OpenShift
  • feature image sublime text 4
    How to install Sublime Text 4 on Ubuntu Linux
  • sdf
    Creating an offline local repository in Linux Linux

More Related Articles

Synergy software kvm Why Software KVMs such as Synergy is replacing Hardware KVMs Linux
redisf How to install Redis on Linux System Linux
Screenshot 2021 02 14 at 00.35.50 How to manage automatic login on Ubuntu Linux Linux
Webp.net resizeimage 1 Automate Infrastructure Deployments in the Cloud with Ansible and Azure Pipelines AWS/Azure/OpenShift
feature image sublime text 4 How to install Sublime Text 4 on Ubuntu Linux
sdf Creating an offline local repository in Linux Linux

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

sysadmin top30a
 
  • Featured image Some Settings are managed by your organization
    How to Fix “Some Settings Are Managed by Your Organization” Error in Windows Update Windows
  • Feature image OCS inventory
    Install and use OCS inventory on Windows Windows
  • 980239e9 cisco logo 2
    LACP Configuration on Cisco 3650 Switch Network | Monitoring
  • Fix invalid backup repostory and delete not needed repo via Veeam Backup Repository
    Fix missing path and delete a Veeam Backup Repository Backup
  • kubernetes
    Create and monitor Apps using the Azure Kubernetes Service manifest AWS/Azure/OpenShift
  • Banner
    How to Deploy GitHub Repositories to cPanel using GitHub Actions Automation
  • vcenter sign on
    CVE-2021-22048: VMware vCenter Server updates address a privilege escalation vulnerability Security | Vulnerability Scans and Assessment
  • What Happens if You Turn Off Your Computer During windows update
    What Happens if You Turn Off Your Computer During an Update Windows

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,841 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon

Tags

AWS Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2025 TechDirectArchive

 

Loading Comments...
 

You must be logged in to post a comment.