보안

[Snort] 활용1

날았다 고양이 2019. 10. 28. 10:48
반응형

개요

 

1. snort 구동

snort -i 인터페이스 -c 설정파일 -l 로그디렉토리

 로그디렉토리 : /var/log/snort 디렉토리가 디폴트

shell> snort -i eth0 -c /etc/snort/snort.conf -l /var/log/snort

2. rule 문법

[Rule Hearder] [Protocol] source_ip source_port -> destination_ip destination_port (Rule_Options)

Rule Hearder : alert, log, sdrop, drop, reject pass

  - alert : 알람을 발생시키고 로그에 남긴다.

  - log : 로그에 남긴다

  - pass : 무시한다.

  - drop : iptables를 통해 패킷을 차단하고 로그에 남긴다.

  - sdrop : iptables를 통해 패킷을 차단하고 로그를 남기지 않는다

  - reject : drop과 동일하지만 메시지를 남긴다

 * alvert vs log 차이 : alert는 alert파일에 메시지기록, log는 snort.log.xxx 파일에 기록하지만 alert파일에는 기록하지 않음

Protocol : ip, tcp, udp, icmp

Rule_Options : msg, content, depth, nocase, sid, resp, react

  - resp : 지정된 응답메시지

  - nocase : 대소문자 구분하지 않음

  - depth : 검색할 위치 지정

3. 예제

1) icmp 기록

alert icmp any any -> any any (msg:"icmp record";sid:10000001;)

2) dns 쿼리내에 google 문자열 검출후 기록(대소문자 구분 안함)

alert udp any any -> any 53 ( msg:"dns google detection";content:"google",nocase,sid:10000002;)

 

반응형