MiracleLinux9.4 ; SNORT3 Install

Snort3

Snort is an open source network intrusion detection system capable of performing real-time traffic analysis and packet logging on IP networks。

It can perform “protocol analysis,” “content search,” and “matching,” and can be used to detect various attacks such as “buffer overflows,” “stealth port scans,” “CGI attacks,” “SMB probes,” “OS fingerprinting attempts,” “semantic URL attacks,” and “server message block probes. The system can be used to detect a variety of attacks, such as

1. advance preparation

①Build tools and dependency libraries required for build and installation.

②SNORT3 installation working directory creation

③Download and install DAQ

Tcmalloc installation
Installed gperftools to improve speed when memory usage increases

2. Snort3 download and installation

①Download and install Snort3

②Update shared libraries

Version Check

3. Network interface settings

①Configure the network interface card
The “ens160” part below is to be adapted to your environment.

Disable interface offloading so that Snort does not truncate packets larger than 1518 bytes
Check current status

It is off.
If it is on, disable GRO and LRO with the following command

Create and enable systemd service so that changes will take effect after system reboot

Contents of snort3-promisc.service

[Unit]
Description=Set Snort 3 NIC in promiscuous mode and Disable GRO, LRO on boot
After=network.target

[Service]
Type=oneshot
ExecStart=/usr/sbin/ip link set dev ens160 promisc on
ExecStart=/usr/sbin/ethtool -K ens160 gro off lro off
TimeoutStartSec=0
RemainAfterExit=yes

[Install]
WantedBy=default.target

4.Added Snort Community Ruleset

Set community rules this time
Create Snort Rules directory

➁Download Snort 3 Community Rules from the Snort 3 Download Page
Extract rules and copy to configuration folder

Check inside the configuration folder

5. Edit Snort main configuration file

Update path to rules

Install OpenAppID extension
Download and install Snort OpenAppID from the Snort 3 download page

Edit the Snort main configuration file to define the location of the OpenAppID folder

log directory creation

Configuration check

OK if the check results in the following

6. Create custom local rules

Edit Snort Main Configuration File
Edit Snort main configuration file to include custom rules file directory in main configuration

7. Verification of settings

Use parameter -T to test configuration and enable test mode

Next, run the test by executing the following command

Send a ping command from a remote computer to the IP address of the server. This will cause an alert log to appear in the console window of the host server

Settings for writing to log files

An alert_fast.txt file is created in the log directory

Perform syntax check

Now, instead of -A alert_fast, add the option "-l /var/log/snort", which specifies the log directory

When I ping the server again from another PC in the same network, this time nothing appears on the console screen.
Checking the log directory, an alert_fast.txt file has been created
To check the alert_fast.txt file

8. Create user for Snort

Create a non-login system user account for Snort

9. Create systemd service unit for Snort

Reload systemd configuration

Set log file ownership and permissions

Enable Snort to start and run at system startup

status check

Copied title and URL