Click here for "Safe Air Conditioner Repair and Proper Freon Recovery".

CentOS7.9 ; SNORT2 , Tripwire , Chkrootkit

SNORT2 Install

1. Advance preparation

①Install necessary software

②DAQ   install
③Lua  install
④Create fake release file

2. Download, compile, and install Snort

Delete fake release files

3.Create groups and users, necessary directories and files

Setup configuration files… Copy all files to the configuration directory.

4.Use of Community Rules

①Get Community Rules

②Extract rules and copy to configuration folder

There are various rule files that are not included in the community rules.
Use the sed command to comment out unnecessary lines.

5. Retrieving Registered User Rules

Once registered on the Snort website, you can use your Oink code to download registered user rules; the Oink code is located in your Snort user account details.
Replace oinkcode with your personal code in the following command

Once download is complete, extract rules to the configuration directory

6. Network and Rule Configuration

7. Verification of settings

Use parameter -T to test configuration and enable test mode
Copy the relevant file to /etc/snort/rules in case of an error
In our case, the error occurred in the following file
If you get a unicode.map error
Also, if you get the error "/etc/snort/rules/snort.conf(322) => Invalid keyword '}'".
relevant line
decompress_swf { deflate lzma } \ : Comment.
# decompress_swf { deflate lzma } \

8. Configuration Testing

To test if Snort is logging alerts, add a custom detection rule alert for incoming ICMP connections to the local.rules file.
②Start Snort at the console and output an alert to stdout. The correct network interface (e.g. eth0) must be selected

9. Running Snort in the background

①Create a startup script for Snort (eth0 must match your environment)

②After defining the service, reload and run the systemctl daemon

Tripwire Install

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 Setting
Contents of twpolmake.pl

⑤Policy File Optimizations

⑥Create policy file (cryptographically signed version) based on optimized policy file
⑦Create database and check operation

テスト用ファイルを削除

⑧Tripwire Scheduled Execution Script
Contents of tripwire.sh

⑨Tripwire Auto-Run Script Execution Settings

Reference: Script for reporting results by e-mail

Chkrootkit Install

①Download and install chkrootkit

➁Create /root/bin directory and move chkrootkit command to that directory
➂Check chkrootkit.

Searching for Linux.Xor.DDoS ... INFECTED: Possible Malicious Linux.Xor.DDoS installed

If you get the above error
This is probably a false positive that occurs when there are executable files under /tmp.
In our case, we have disabled the following files

④Create chkrootkit periodic execution script and change permissions

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 using the backed up commands
⑦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 commands on the backed up server
Copied title and URL