Suricata IDS on Ubuntu Server

TOC

  1. Suricata 설치하기
  2. Suricata 관리하기
  3. ELK 로 Suricata 로그 관리

Suricata 설치하기

suricata repository 종류

  • Stable
sudo add-apt-repository ppa:oisf/suricata-stable
sudo apt-get update && sudo apt-get install suricata
  • Beta
sudo add-apt-repository ppa:oisf/suricata-beta
sudo apt-get update && sudo apt-get install suricata
  • Daily Release
sudo add-apt-repository ppa:oisf/suricata-daily
sudo apt-get update && sudo apt-get install suricata

Interface card 설정 하기

Network interface file

sudo vim /etc/network/interfaces

아래 내용을 추가한다.

auto eth1
iface eth1 inet manual
up ifconfig $IFACE 0.0.0.0 up
up ip link set $IFACE promisc on
down ip link set $IFACE promisc off
down ifconfig $IFACE down

로그 종류

  • eve.json
  • fast.log
  • http.log
  • stats.log
  • unified2.alert.1437460553

Suricata 관리하기

oinkmaster

pulledpork

py-idstools

Sample Command

sudo idstools-rulecat --rules-dir /etc/suricata/rules/ --sid-msg-map /etc/suricata/rules/sid-msg.map --disable disable.conf --post-hook "/etc/init.d/suricata restart"
인자 설명
  • rules-dir : 룰 폴더의 경로
  • sid-msg-map: sid-msg.map 파일의 경로
  • disable: 사용하지 않을 룰의 sid를 가지고 있는 파일
  • disable 파일의 경우 룰번호/n 형태로 파일을 작성 할 수 있다.
  • post-hook: 룰이 변경됬을 경우 실행할 명렁

해당 명령은 cronjob에 추가 할수 있다.

sudo vim /etc/cron.hourly/rulecat.hourly
### Adding the command to rulecat.houly file
#!/bin/bash

/usr/local/bin/idstools-rulecat  --rules-dir /etc/suricata/rules/ --sid-msg-map /etc/suricata/rules/sid-msg.map --disable disable.conf --post-hook "/etc/init.d/suricata restart"

### Adding the execution permission to this file
sudo chmod 755 /etc/cron.hourly/rulecat.hourly

Result

Last download less than 15 minutes ago. Not fetching.
Loaded 21320 rules.
Disabled 48 rules.
Enabled 0 rules.
Modified 0 rules.
Enabled 86 rules for flowbit dependencies.
Writing rule files to /etc/suricata/rules/.
Writing /etc/suricata/rules/sid-msg.map.
Running post-hook as output has been modified.
Running /etc/init.d/suricata restart.
Stopping suricata:  done.
Starting suricata in IDS (af-packet) mode... done.
Done.

Comments !

links

social