


How to Protect CentOS Servers Using Network Intrusion Detection Systems (NIDS)
How to use Network Intrusion Detection System (NIDS) to protect CentOS servers
Introduction:
In modern network environments, server security is crucial. Attackers use a variety of means to try to break into our servers and steal sensitive data or compromise systems. To ensure server security, we can use a Network Intrusion Detection System (NIDS) for real-time monitoring and detection of potential attacks.
This article will introduce how to configure and use NIDS on CentOS server to protect the server.
Step 1: Install and configure SNORT
SNORT is an open source intrusion detection system that we can use to monitor network traffic and detect possible attacks. First, we need to install SNORT.
- Open a terminal and log in to the server with root privileges.
- Use the following command to install SNORT:
yum install epel-release yum install snort
- After the installation is complete, we need to configure SNORT. First, we need to create a new configuration file. Use the following command to create and open a new configuration file:
cp /etc/snort/snort.conf /etc/snort/snort.conf.backup vim /etc/snort/snort.conf
- In the configuration file, you can customize SNORT as needed. Also, make sure to uncomment the following lines to enable the corresponding features:
include $RULE_PATH/local.rules include $RULE_PATH/snort.rules include $RULE_PATH/community.rules
- Save and close the configuration file.
Step 2: Configure NIDS rules
In SNORT, rules are used to define the types of attacks we wish to detect. We can use an existing rule set or create custom rules.
- Open a terminal and use the following command to enter the SNORT rules directory:
cd /etc/snort/rules/
- Use the following command to download the latest rule set:
wget https://www.snort.org/downloads/community/community-rules.tar.gz tar -xvf community-rules.tar.gz
- After the download and extraction is completed, we can find the rule file in the rules directory. These rules files have the extension .rules.
- If we want to add custom rules, we can create a new rules file and add rules in it. For example, we can create a rules file named custom.rules using the following command:
vim custom.rules
- In the rules file, we can add custom rules. Here is an example:
alert tcp any any -> any any (msg:"Possible SSH brute force attack"; flow:from_client,established; content:"SSH-"; threshold:type limit, track by_src, count 5, seconds 60; sid:10001; rev:1;)
- Save and close the rules file.
Step 3: Start SNORT and monitor traffic
After configuring SNORT and rules, we can start SNORT and start monitoring traffic.
- Open a terminal and use the following command to start SNORT:
snort -A console -c /etc/snort/snort.conf -i eth0
Among them, -A console specifies to output the alert message to the console, -c /etc/snort/snort .conf specifies to use the SNORT configuration file we configured previously, and -i eth0 specifies the network interface to be monitored.
- SNORT will start monitoring traffic and detect potential attacks. If there is any suspicious activity, it will generate an alert message and output it to the console.
Step 4: Set up SNORT alarm notification
In order to get the alarm message in time, we can use the email notification function to send the alarm message to our email address.
- Open a terminal and use the following command to install the email notification plug-in:
yum install barnyard2 yum install sendmail
- After the installation is complete, we need to create a new configuration file. Copy the example configuration file and open a new configuration file using the following command:
cp /etc/barnyard2/barnyard2.conf /etc/barnyard2/barnyard2.conf.backup vim /etc/barnyard2/barnyard2.conf
- In the configuration file, find the following lines and uncomment them:
output alert_syslog_full output database: log, mysql, user=snort password=snort dbname=snort host=localhost output alert_fast: snort.alert config reference_file: reference.config config classification_file:classification.config config gen_file: gen-msg.map config sid_file: sid-msg.map
- Modify the following lines as appropriate based on our SMTP server and email settings:
output alert_full: alert.full output log_unified2: filename unified2.log, limit 128 output smtp: email@example.com
- Save and close the configuration file.
- Start barnyard2 using the following command:
barnyard2 -c /etc/barnyard2/barnyard2.conf -d /var/log/snort/
- Later, if SNORT detects suspicious activity, it will generate an alert message and send it to our specified email address.
Conclusion:
It is very important to protect our CentOS servers by deploying a Network Intrusion Detection System (NIDS). We can use SNORT to monitor network traffic and detect potential attacks. By following the steps in this article, we can configure SNORT and set up rules to monitor and protect our servers. In addition, we can also use the email notification function to obtain alert messages in time.
The above is the detailed content of How to Protect CentOS Servers Using Network Intrusion Detection Systems (NIDS). For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



How to use IP blacklists to prevent malicious IP addresses from accessing CentOS servers Servers operating on the Internet often face attacks from malicious IP addresses, and these attacks may cause server performance degradation or even system crashes. In order to protect the security and stability of the server, CentOS server provides a simple and effective way to block access from malicious IP addresses, that is, using an IP blacklist. An IP blacklist is a list of IP addresses that are considered threatening or malicious. When the server receives data from these IP

How to protect data on CentOS servers using secure file system encryption In today’s digital age, data security has become even more important. Especially sensitive data stored on servers, if not properly protected, may be attacked by hackers, leading to serious consequences. In order to ensure data confidentiality and integrity, we can use file system encryption to protect data on the CentOS server. This article will explain how to use secure file system encryption to protect data on CentOS servers and

How to Protect CentOS Servers Using Network Intrusion Detection Systems (NIDS) Introduction: In modern network environments, server security is crucial. Attackers use a variety of means to try to break into our servers and steal sensitive data or compromise systems. To ensure server security, we can use a Network Intrusion Detection System (NIDS) for real-time monitoring and detection of potential attacks. This article will introduce how to configure and use NIDS on a CentOS server to protect the server. Step 1: Install and configure SN

How to Use Antivirus Software to Protect CentOS Servers from Malware In today’s digital age, server security is crucial. The intrusion of malware may lead to the leakage of personal information, system failure and even hacker attacks. To protect CentOS servers from these risks, we can use antivirus software to increase the security of the server. This article will introduce how to use antivirus software to protect CentOS servers, and attach some code examples for reference. Choosing the right antivirus software First, I

How to Protect CentOS Server from Unauthorized Access Using Intrusion Detection System (IDS) Introduction: As a server administrator, protecting the server from unauthorized access is a very important task. The Intrusion Detection System (IDS for short) can help us achieve this goal. This article will introduce how to install and configure Snort, a commonly used IDS tool, on a CentOS server to protect the server from unauthorized access. 1. An

How to use two-factor authentication to secure access to CentOS servers Summary: With the increase in network attacks, it is particularly important to secure access to servers. Two-factor authentication is a way to enhance server security. This article will introduce how to use two-factor authentication on CentOS servers to improve access security. Keywords: two-factor authentication, CentOS server, access security, code example 1. What is two-factor authentication? Two-factor authentication refers to the use of two or more different identities.

How to use key authentication to implement more secure SSH login on CentOS servers In server management, it is crucial to ensure system security. SSH (SecureShell) is an encrypted network protocol used for remote login to Linux and UNIX servers. To further strengthen the security of the server, we can use key authentication instead of password login. This article will introduce how to implement a more secure SSH login on a CentOS server and provide corresponding code examples. Step 1: Generate

How to use an intrusion prevention system (IPS) to protect CentOS servers from attacks Introduction: In today’s digital age, server security is crucial. Cyberattacks and intrusions are becoming more frequent, so the need to protect servers from them is becoming increasingly urgent. An intrusion prevention system (IPS) is an important security measure that can help detect and block malicious activity and protect servers from attacks. In this article, we will learn how to configure and use IPS on CentOS servers to improve the security of the server.
