Article Title: IDS test in LINUX. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
// At that time, this experiment was conducted to attend the student academic forum held by the College. The article is a bit long. Please give your valuable comments.
Test the IDS in LINUX
Level 1 Computer Class 1: Wang Wei
IDS (Instrusion Detection System), a Common Intrusion Detection System, is widely used in Security Detection and defense of various operating systems, and the extent and frequency of network attacks. Provides detailed information and evidence for future network security management.
Due to restrictions, we can only use SNORT as the IDS of this experiment.
Some functions of Snort:
1. Real-time communication analysis and information package records
2. Check the packaging Payload
3. Protocol Analysis and Content Query matching
4. detects buffer overflow, secret port scanning, CGI attacks, SMB detection, and operating system intrusion attempts
5. Real-Time alerts for system logs, specified files, Unix sockets, or WinPopus through Samba
Next, I will take REDHAT 7.3 as an example to describe the debugging and testing report of a complete intrusion detection system.
1. Local Environment
OS: REDHAT 7.3
HardWare: CPU: P3 800. 256MB--SDRAM. 20G/7200 -- HARDDISC
IDS: SNORT-1.9 + Libpcap
Ii. debugging methods
First, install SNORT in the local environment. SNORT is a free IDS software. We will use it for system detection this time.
The local machine has obtained the SNORT-1.9 version.
First, in order to more easily customize the subsequent detection rules and debugging needs, we will use the method of manually compiling the source file (scorcus) for installation. (Version Description: SNORT-1.9.0.tar.gz)
The local installation permission must be: ROOT. If not ROOT. The SU command must be used to switch the local system administrator. |: ROOT
# Su
# Passwd :************
After we confirm to log on from the ROOT, we must release the source file, because when using snort, we need the Libpcap package file, so before testing on the local machine, we must ensure that Libpcap is in the system. If you do not know whether the localhost already has Libacap, you can use the following command to query it:
$ Locate Libacap
If:
/Usr/lib/Libacap.1.9.0
/Usr/lib/Libpcap.
If you do not receive any prompts, it indicates that the Libpcap library file has not been installed. Perform the following operations: (libpcap0.6.2.tar.gz)
Cd/usr/src/ids
[Root @ kykin-L-linux ids] # tar? Zxvf libpcap-0.6.2.tar.gz
[Root @ kykin-L-linux ids] # ls
Libpcap-0.6.2 libpcap-0.6.2.tar.gz snort-1.9.0 snort-1.9.0.tar.gz
This operation completely releases libpcap to the local folder.
Continue:
[Root @ kykin-L-linux ids] # cd libpcap-0.6.2
[Root @ kykin-L-libpcap-0.6.2 for linux] # ls
Aclocal. m4 configure. in lbl pcap-enet.c README. linux
Bpf CREDITS libpcap. a pcap. h savefile. c
Bpf_dump.c cvs license pcap-int.h savefile. o
Bpf_dump.o etherent. c llc. h pcap-linux.c cipher. c
Bpf_filter.c etherent. o Makefile pcap-linux.o specification. l
Bpf_filter.o ethertype. h Makefile. in pcap-namedb.h. o
Bpf_image.c FILES mkdep pcap-nit.c sll. h
Bpf_image.o gencode. c nametoaddr. c pcap-nit.h SUNOS4
CHANGES gencode. h nametoaddr. o pcap-null.c TODO
Config. cache gencode. o net pcap. o tokdefs. h
Config. guess grammar. c nlpid. h pcap-pf.c VERSION
Config. h grammar. o optimize. c pcap-pf.h version. c
Config. h. in grammar. y optimize. o pcap-snit.c version. o
Config. log inet. c pcap.3 pcap-snoop.c
Config. status inet. o pcap-bpf.c ppp. h
Config. sub INSTALL pcap. c README
Configure install-sh pcap-dlpi.c README. aix
These source files are the Libpcap files to be compiled. Continue:
[Root@kykin-L-linuxlibpcap-0.6.2] #./configure -- prefix =/usr/local/libpcap-0.6.2
(This sentence means: Compile the Libpcap file to the/usr/local/libpcap-0.6.2 directory)
# Make
[Root@kykin-L-linuxlibpcap-0.6.2] # makeinstall
After executing the above steps, we have installed Libpcap in the system.
Next, we will complete SNORT installation and debugging
(For testing purposes, we do not need to write the SNORT log file to the local MYSQL database, so the operation steps for the MYSQL database are temporarily omitted)
[Root @ kykin-L-linux ids] # tar? Zxvf snort-1.9.0.tar.gz
[Root @ kykin-L-linux ids] # cd snort-1.9.0
[Root @ kykin-L-linux snort-1.9.0] # ls
Acconfig. h config. h. in contrib Makefile snort.8
Aclocal. m4 config. log COPYING Makefile. am src
ChangeLog config. status doc Makefile. in stamp-h
Config. cache config. sub etc missing stamp-h.in
Config. guess configure install-sh mkinstalldirs templates
Config. h configure. in LICENSE rules
[Root @ kykin-L-linux snort-1.9.0] #./configure -- prefix =/usr/local/snort19
[Root @ kykin-L-linux snort-1.9.0] # make
[Root @ kykin-L-linux snort-1.9.0] # makeinstall
(These operations have the same meaning as Libpcap)
Then, we will perform a series of debugging on the SNORT to make it run properly and facilitate management.
[Root @ kykin-L-linux snort-1.9.0] # cp etc/usr/local/snort19? R
(Copy the ETC directory under the current folder to SNORT19)
[Root @ kykin-L-linux snort-1.9.0] # cp rules/usr/local/snort19? R
(Copy all rule files)
[Root @ kykin-L-linux snort-1.9.0] # cp etc/classification. config/root/
[Root @ kykin-L-linux snort-1.9.0] # cp etc/snort. conf/root/. snortrc
(Modify the called file attributes)
After doing this, we have completed a majority of our work. Next we will complete an important part. Custom intrusion detection rules
[Root @ kykin-L-linux snort-1.9.0] # vi/root/. snortrc
# This file contains a sample snort configuration.
# You can take the following steps to create your
# Own custom configuration:
#
#1) Set the network variables for your network
#2) Configure preprocessors
#3) Configure output plugins
#4) Customize your rule set
#
######################################## ###########
# Step #1: Set the network variables:
#
# You must change the following variables to reflect
# Your local network. The variable is currently
# Setup for an RFC 1918 address space.
#
# You can specify it explicitly:
#
# Var HOME_NET 10.1.1.0/24
........................................ ........
(Too much content, temporarily omitted)
First. We can find the following in row 102 of the entire config file:
Var RULE_PATH ../rules
This is the path for storing local rules. We must write it completely according to our own situation.
My file is like this:
Var RULE_PATH/usr/local/snort19/rules
Then, in the 590 rows of the config file. We will see:
Include $ RULE_PATH/bad-traffic.rules
From here until the end, it is the entire rule set of SNORT. We must make detailed debugging based on our own situation.
Include $ RULE_PATH/bad-traffic.rules
Include $ RULE_PATH/exploit. rules
Include $ RULE_PATH/scan. rules
Include $ RULE_PATH/finger. rules
Include $ RULE_PATH/ftp. rules
Include $ RULE_PATH/telnet. rules
Include $ RULE_PATH/rpc. rules
Include $ RULE_PATH/rservices. rules
Include $ RULE_PATH/dos. rules
(The file contains too many contents, which are omitted for the moment)
You can describe the rules in detail for the specific environment of your system. If you do not need the rules, you can use the # annotation method to remove them.
To facilitate the invocation of the executable command: SNORT, we will provide a description of the connection.
[Root@kykin-L-linuxsnort-1.9.0] # ln? S/usr/local/snort19/bin/snort/usr/sbin/snort
Then. We will create a new directory to store SNORT log files.
[Root @ kykin-L-linux snort-1.9.0] # cd/var/log
[Root @ kykin-L-linux snort-1.9.0] # mkdir snort
After everything above is done, the preliminary settings of the entire IDS are basically completed. Next we will test whether the IDS are successful.
[Root @ kykin-L-linux snort-1.9.0] # snort
Initializing Output Plugins!
Log directory =/var/log/snort
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service