OracleLinux8.10 ; Tripwire , Chkrootkit , Logwatch

Tripwire

1.Download and installation

2.Passphrase setting

Set site passphrase and local passphrase

3.Tripwire Configuration

Configuration File Edit

Create a Tripwire configuration file (cryptographically signed version)

Delete Tripwire configuration file (text version)

Policy File Settings

Contents of twpolmake.pl

Policy File Optimizations

Create policy file (cryptographically signed version) based on optimized policy file

Create database and check operation

Create test files

Check Tripwire operation

OK if it appears as follows

Delete test files

Tripwire Scheduled Scripts

Contents of tripwire.sh

Reference: Script for reporting results by e-mail

Execute the following command to confirm that the mail has been received

Chkrootkit

nstall a rootkit detection tool called chkrootkit to check whether a rootkit has been installed on the Linux server.
Since chkrootkit is checked using the following command, it is desirable to install it in the early stages after Linux installation, since it is useless after the command itself has been tampered with so that rootkit cannot be detected.

[Commands used by chkrootkit]
awk, cut, echo, egrep, find, head, id, ls, netstat, ps, strings, sed, uname

Note that chkrootkit can only detect known rootkits and cannot detect new rootkits.

Download and install chkrootkit

➁Move chkrootkit command to /usr/bin

Check chkrootkit.

Searching for Linux.Xor.DDoS … INFECTED: Possible Malicious Linux.Xor.DDoS installed
If the above is displayed, there are scripts that can be executed under /tmp, so if they are unnecessary, delete them and they will not be displayed.

Create chkrootkit periodic execution script and change permissions
Create chkrootkit execution script in a directory where it is automatically executed daily

Scheduled Script Contents

Add execution permission to chkrootkit execution script

Backup commands used by chkrootkit

If the commands used by chkrootkit are tampered with, rootkit will not be detected.
Back up these commands.
If necessary, run chkrootkit with the backed up command

Run chkrootkit on the copied command

If nothing is displayed, no problem.

Compresses backed up commands

Send chkrootkit use command (compressed version) to root by e-mail

Download and save chkrootkit_cmd.tar.gz file to Windows

Delete backed up commands on the server

Logwatch

①Install

Edit configuration file

Output Logwatch reports

It will appear as follows

Test to see if the report arrives at the address you set. Check if you receive a log report email like the one above.

Introduce disk usage check script

3.1 Script Creation

Contents of disk_capacity_check.sh

3.2 Execution Confirmation

①Check current usage rates

It appears as follows

②Create a dummy file to achieve at least 80% utilization(In the example, the name is dummyfile and it is about 5G.)

③check again
Confirm that it is above 80% by performing the following

④Run check scripts

You will receive an email to the email address you have set up, stating something like "Disk usage alert: 88 %".

⑤Delete "dummyfile"

⑥Periodic Execution Setting

Copied title and URL