Debian12.8 ; Logwatch , Chkrootkit , Disk Usage Check Script

Logwatch

Logwatch compiles various logs together and delivers them as a report via email on a regular daily basis. This is a useful tool for detecting unauthorized access and problems and monitoring servers.

①Install

Copy the default configuration file

Change email address, etc.

Creating Directories

⑤Confirmation of Operation
When logwatch is installed, cron is registered by default, so report mail is delivered every day.
Test if the report is delivered to the address you set.

Chkrootkit

chkrootkit is a tool to detect the presence of rootkits.
Note that chkrootkit is meaningless after it has already been tampered with, so consideration must be given when introducing it. In addition, chkrootkit has no function to automatically deal with a rootkit even if it detects it, so it must be dealt with manually after detection.

Install chkrootkit

Check chkrootkit

Create chkrootkit periodic execution script and change permissions

Automatically creates /etc/cron.daily/chkrtootkit based on /usr/sbin/chkrootkit-daily and runs it automatically every day, so no script creation is required

Disk Usage Check Script

1.Scripting

Contents of disk_capacity_check.sh

2. Execution check

Check current usage

It appears as follows

Create a dummy file (in the example, it is called "dummyfile" and is about 15G) so that the utilization is 80% or more.

Check again

Run it and make sure it is above 80%.

Run disk space check script

You will receive an e-mail to the e-mail address you have set up with the body of the message as "Disk usage alert : 98%".

Delete the "dummyfile" you created.

Periodic Execution Setting

Copied title and URL