ㅎㅇㅎㅇ 여러분
오늘은 불목이에요 불목.
님들은 불목 없쥬 ? ㅋㅋ
IDS 구조와 snort
• IDS 시스템에서 snort는 A-Box에 해당한다.
• R-Box를 강화하고 여러가지 보안 기능을 포함하는 시스템을 IPS라고 한다.
- R-Box 기능은 snort에 통상 포함되어 있지 않다.
• E-Box: Data AcQuisition system
- E-Box 기능도 최근 버전엔 포함되어 있지 않아 별도로 설치가 필요하다.
• D-Box: barnyard2, MySQL
snort-install
snort는 snort.org에서 제공된다.
- 2.9.0부터 DB에 대한 connect 기능이 제공되지 않음.
설치 과정
1. 관련 패키지 설치
# yum -y install libdnet-devel openssl-devel pkgconfig gcc flex bison zlib* libpcap* pcre* libpcap-devel libpcre3-devel libnetfilter-queue-devel iptables-devel libdnet* tcpdump
2. daq 설치
daq와 같이 설치해야 하는 libnghttp2는 epel에서 제공한다.
* epel이 설치되어 있지 않으면 epel부터 설치해야 한다.
# yum list | grep epel
# yum install -y epel-release.noarch
# yum install -y daq daq-devel daq-modules libnghttp2
# ln -s /usr/lib64/libdnet.so.1.0.1 /usr/lib64/libdnet.1
3. snort 설치
• Wget를 이용해서 다운 받아 설치한다.
- wget 명령이 막히면 제공된 down 경로에서 다운 받는다.
• 설치 후 작동 여부를 확인한다.
• rpm 패키지를 설치하면 snort 계정도 생성된다.
# wget https://snort.org/downloads/snort/snort-2.9.20-1.centos.x86_64.rpm
# rpm -Uvh snort-2.9.20-1.centos.x86_64.rpm
# snort -V
4. 기본 환경 설정
• snort 실행에 필요한 기본 디렉토리와 rule 파일을 생성하고 퍼미션을 조정한다.
# mkdir /usr/local/lib/snort_dynamicrules
# touch /etc/snort/rules/white_list.rules
# touch /etc/snort/rules/black_list.rules
# touch /etc/snort/rules/local.rules
# chmod -R 700 /etc/snort
# chmod -R 700 /var/log/snort
# chmod -R 700 /usr/local/lib/snort_dynamicrules
# chown -R snort.snort /etc/snort
# chown -R snort.snort /var/log/snort
# chown -R snort.snort /usr/local/lib/snort_dynamicrules
• test를 위해 /etc/snort/rules/local.rules 파일에 다음 rule을 추가한다.
# vi /etc/snort/rules/local.rules
alert icmp any any -> $HOME_NET any (msg:"ICMP TEST"; sid:10000001; rev:001;)
5. snort.conf 설정
- /etc/snort/snort.conf 파일은 snort의 환경 설정파일이다. 수정 전 반드시 백업 받는다.
# cp snort.conf snort.conf.backup
# vi /ect/snort/snort.conf
'#site specific rules' 항목에 'include $RULE_PATH/local.rule'를 제외하고 모두 삭제한다.
- 저는 안 지우고 모두 주석 처리 했어용! 근데 양이 많으니까 지우는 게 편할 수도 !?
ipvar HOME_NET 192.168.11.0/24 ← snort의 네트워크 주소
ipvar EXTERNAL_NET !$HOME_NET
var RULE_PATH /etc/snort/rules
var SO_RULE_PATH /etc/snort/so_rules
var PREPROC_RULE_PATH /etc/snort/preproc_rules
var WHITE_LIST_PATH /etc/snort/rules
var BLACK_LIST_PATH /etc/snort/rules
output unified2: filename snort.log, limit 128
6. 실행과 테스트
• snort를 실행하고 탐지를 테스트한다.
• -i : 'ERROR: Cannot decode data link type 239' 에러 방지
# snort -i ens32 -A console -c /etc/snort/snort.conf
- console : 경고 파일(alert) 없이 화면에 출력한다.
# snort -i ens32 -A fast -c /etc/snort/snort.conf
- Fast : alert 파일을 생성한다.
시스템에 ping을 보낸후 /var/log/snort 에 생성된 log(snort.log.##########) 파일이나 alert 파일을 확인한다.
# snort -r 로그파일
# cat /var/log/snort/alert
Rule 적용은 다음 쭈에 할 예정 !!
'인프라 7기 > 네트워크 보안 공격 기법' 카테고리의 다른 글
리눅스 서버 log (13) | 2023.05.31 |
---|---|
SSH 터널링과 은닉채널 (1) | 2023.05.18 |
DDoS(Distributed Denial of Service) 공격 - Trinoo (0) | 2023.05.15 |
Dos(Denial of Service: 서비스 거부) 공격 (0) | 2023.05.12 |
스푸핑 Spoofing [DNS 스푸핑] (0) | 2023.05.11 |