Cấu hình Snort + Barnyard2 trên Centos7

dosaobang

New member
#Snort #Barnyard2 #Centos7 #intrusiondetectionsystem #Ids

## Cách định cấu hình Snort + Barnyard2 trên Centos 7

Snort là một hệ thống phát hiện xâm nhập (IDS) miễn phí và nguồn mở có thể được sử dụng để giám sát lưu lượng mạng cho hoạt động độc hại.Barnyard2 là một công cụ phân tích nhật ký lưu lượng truy cập mạng có thể được sử dụng để tương quan các cảnh báo khịt mũi với lưu lượng mạng.Trong hướng dẫn này, chúng tôi sẽ chỉ cho bạn cách cài đặt và định cấu hình Snort và Barnyard2 trên máy chủ Centos 7.

### Điều kiện tiên quyết

Để làm theo hướng dẫn này, bạn sẽ cần những điều sau đây:

* Máy chủ Centos 7 với tối thiểu 2GB RAM và 20GB dung lượng đĩa
* Một kết nối internet hoạt động
* Các gói sau được cài đặt:
* `wget`
* `Yum-Utils`
* `Epel-Release`

### Cài đặt Snort và Barnyard2

Để cài đặt Snort và Barnyard2, chúng tôi sẽ sử dụng kho lưu trữ Epel.Kho lưu trữ EPEL là một kho lưu trữ các gói bổ sung cho doanh nghiệp Linux.

Để cài đặt kho lưu trữ EPEL, hãy chạy lệnh sau:

`` `
sudo yum cài đặt phát hành epel
`` `

Khi kho lưu trữ EPEL được cài đặt, chúng ta có thể cài đặt Snort và Barnyard2.Để thực hiện việc này, hãy chạy lệnh sau:

`` `
sudo yum cài đặt Snort-Barnyard2
`` `

### Cấu hình khịt mũi

Snort được cấu hình bằng tệp cấu hình có tên là `Snort.conf`.Tệp `Snort.conf` được đặt trong thư mục`/etc/snort/`.

Để mở tệp `snort.conf`, hãy chạy lệnh sau:

`` `
sudo vi /etc/snort/snort.conf
`` `

Tệp `Snort.conf` được chia thành một số phần.Phần đầu tiên là phần `Global`.Phần `Global` chứa các tùy chọn cấu hình toàn cầu cho Snort.

Sau đây là một số tùy chọn cấu hình toàn cầu quan trọng nhất:

* `alert_type`: Tùy chọn này chỉ định loại cảnh báo mà Snort sẽ tạo ra.Các giá trị có thể là `alert`,` log` và `none`.
* `logdir`: Tùy chọn này chỉ định thư mục nơi Snort sẽ lưu trữ nhật ký của nó.
* `pidfile`: Tùy chọn này chỉ định tệp nơi Snort sẽ lưu trữ ID quy trình của nó.
* `nfqueue`: Tùy chọn này chỉ định liệu Snort sẽ sử dụng hệ thống con xếp hàng Netfilter.

Phần tiếp theo trong tệp `snort.conf` là phần` tiền xử lý`.Phần `tiền xử lý 'chứa một danh sách các tiền xử lý mà Snort sẽ sử dụng.

Bộ tiền xử lý là một chương trình có thể được sử dụng để sửa đổi lưu lượng mạng trước khi nó được chuyển sang khịt mũi.Ví dụ: bộ tiền xử lý `tcpdump` có thể được sử dụng để nắm bắt lưu lượng mạng và bộ tiền xử lý` dns` có thể được sử dụng để phân tích lưu lượng DNS.

Sau đây là một ví dụ về phần `tiền xử lý`:

`` `
tiền xử lý {
tcpdump;
DNS;
}
`` `

Phần tiếp theo trong tệp `snort.conf` là phần` quy tắc`.Phần `quy tắc` chứa một danh sách các quy tắc mà Snort sẽ sử dụng để phát hiện hoạt động độc hại.

Một quy tắc là một tuyên bố chỉ định một điều kiện mà Snort sẽ tìm kiếm trong lưu lượng truy cập mạng.Nếu Snort tìm thấy một quy tắc phù hợp với lưu lượng truy cập, nó sẽ tạo ra một cảnh báo.

Sau đây là một ví dụ về một quy tắc:

`` `
Cảnh báo TCP bất kỳ -> bất kỳ (MSG: "Lũ lụt Syn có thể"; Nội dung: "Syn"; Ngưỡng: 100/giây;)
`` `

Quy tắc này sẽ tạo ra một cảnh báo nếu Snort nhìn thấy hơn 100 gói SYN mỗi giây từ bất kỳ nguồn nào đến bất kỳ điểm đến nào.

Phần cuối cùng trong tệp `snort.conf` là phần` oputs`.Phần `đầu ra` chứa một danh sách các đầu ra mà Snort sẽ sử dụng để gửi thông báo và nhật ký.

Sau đây là một ví dụ về phần `đầu ra`:

`` `
đầu ra {
=======================================
#Snort #Barnyard2 #Centos7 #intrusiondetectionsystem #Ids

## How to Configure Snort + Barnyard2 on CentOS 7

Snort is a free and open-source intrusion detection system (IDS) that can be used to monitor network traffic for malicious activity. Barnyard2 is a network traffic log analysis tool that can be used to correlate Snort alerts with network traffic. In this tutorial, we will show you how to install and configure Snort and Barnyard2 on a CentOS 7 server.

### Prerequisites

To follow this tutorial, you will need the following:

* A CentOS 7 server with a minimum of 2GB of RAM and 20GB of disk space
* A working internet connection
* The following packages installed:
* `wget`
* `yum-utils`
* `epel-release`

### Installing Snort and Barnyard2

To install Snort and Barnyard2, we will use the EPEL repository. The EPEL repository is a repository of additional packages for Enterprise Linux.

To install the EPEL repository, run the following command:

```
sudo yum install epel-release
```

Once the EPEL repository is installed, we can install Snort and Barnyard2. To do this, run the following command:

```
sudo yum install snort snort-barnyard2
```

### Configuring Snort

Snort is configured using a configuration file called `snort.conf`. The `snort.conf` file is located in the `/etc/snort/` directory.

To open the `snort.conf` file, run the following command:

```
sudo vi /etc/snort/snort.conf
```

The `snort.conf` file is divided into several sections. The first section is the `global` section. The `global` section contains global configuration options for Snort.

The following are some of the most important global configuration options:

* `alert_type`: This option specifies the type of alerts that Snort will generate. The possible values are `alert`, `log`, and `none`.
* `logdir`: This option specifies the directory where Snort will store its logs.
* `pidfile`: This option specifies the file where Snort will store its process ID.
* `nfqueue`: This option specifies whether Snort will use the netfilter queueing subsystem.

The next section in the `snort.conf` file is the `preprocessors` section. The `preprocessors` section contains a list of preprocessors that Snort will use.

A preprocessor is a program that can be used to modify network traffic before it is passed to Snort. For example, the `tcpdump` preprocessor can be used to capture network traffic, and the `dns` preprocessor can be used to parse DNS traffic.

The following is an example of a `preprocessors` section:

```
preprocessors {
tcpdump;
dns;
}
```

The next section in the `snort.conf` file is the `rules` section. The `rules` section contains a list of rules that Snort will use to detect malicious activity.

A rule is a statement that specifies a condition that Snort will look for in network traffic. If Snort finds a rule that matches the traffic, it will generate an alert.

The following is an example of a rule:

```
alert tcp any any -> any any (msg:"Possible SYN flood"; content:"SYN"; threshold:100/second;)
```

This rule will generate an alert if Snort sees more than 100 SYN packets per second from any source to any destination.

The last section in the `snort.conf` file is the `outputs` section. The `outputs` section contains a list of outputs that Snort will use to send alerts and logs.

The following is an example of an `outputs` section:

```
outputs {
 
Join ToolsKiemTrieuDoGroup
Back
Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock