snortの検知ルールを自動更新する(pulledpork)
■ snortのバージョン
snort-2.9.12.tar.gz
■ snortの起動確認
snort -T -c /etc/snort/snort.conf
→ Snort successfully validated the configuration!
Snort exiting
と表示されればOK
■snortにアカウント登録しておく
Snort - Network Intrusion Detection & Prevention System
■oinkcodeを取得しておく
ログインする
公式サイト右上の自分のログインメールアドレスをクリック
右側メニュー「Oinkcode」をクリックすると、oinkcodeが表示される
■ pulledporkを使用してsnortルールを自動更新する
参考URL
https://www.unix-power.net/networking/post-758
① pulledporkをダウンロードする
https://github.com/shirkdog/pulledpork
# git clone https://github.com/shirkdog/pulledpork.git
② etc/pulledpork.confの編集
# vi /tmp/pulledpork/pulledpork/etc/pulledpork.conf rule_path=/usr/local/etc/snort/rules/snort.rules → snortのルールファイルの場所が合っているか確認 snortのルールファイルの場所は「/etc/snort/rules/」で、 「snort.rules」が無いので新たに作成する # touch /etc/snort/rules/snort.rules → 以下のように書き換え rule_path=/etc/snort/rules/snort.rules local_rules=/usr/local/etc/snort/rules/local.rules → 以下のように書き換え local_rules=/etc/snort/rules/local.rules sid_msg=/usr/local/etc/snort/sid-msg.map → snortの各種confファイルの場所は「/etc/snort/」で、 「sid-msg.map」が無いので新たに作成する # touch /etc/snort/sid-msg.map → 以下のように書き換え sid_msg=/etc/snort/sid-msg.map snort_path=/usr/local/bin/snort → 以下のように書き換え snort_path=/usr/sbin/snort config_path=/usr/local/etc/snort/snort.conf → 以下のように書き換え config_path=/etc/snort/snort.conf distro=FreeBSD-8-1 → 以下のように書き換え distro=Ubuntu-12-04 black_list=/usr/local/etc/snort/rules/iplists/default.blacklist → 「/etc/snort/rules/iplists/default.blacklist」が無いので新たに作成する # mkdir /etc/snort/rules/iplists # touch /etc/snort/rules/iplists/default.blacklist → 以下のように書き換え black_list=/etc/snort/rules/iplists/default.blacklist IPRVersion=/usr/local/etc/snort/rules/iplists → 以下のように書き換え IPRVersion=/etc/snort/rules/iplists snort_control=/usr/local/bin/snort_control → 「/usr/sbin/snort_control」が無いので新たに作成する # touch /usr/sbin/snort_control → 以下のように書き換え snort_control=/usr/sbin/snort_control # snort_version=2.9.0.0 → 以下のように書き換え snort_version=2.9.12.0 ※ https://www.snort.org/oinkcodes 上記URLに記載されているサンプルURLに「29120」と書かれているので最後尾の.0は必須 rule_url=https://www.snort.org/reg-rules/|snortrules-snapshot.tar.gz|<oinkcode> → 「<oinkcode>」の部分に自分のoinkcodeを代入 rule_url=https://snort.org/downloads/community/|community-rules.tar.gz|Community → 存在せず、エラーになるのでコメントアウトしておく rule_url=https://snort.org/downloads/community/|opensource.gz|Opensource → 存在せず、エラーになるのでコメントアウトしておく
③ 実行テスト
# perl /tmp/pulledpork/pulledpork/pulledpork.pl -c /tmp/pulledpork/pulledpork/etc/pulledpork.conf
→ /var/log/sid_changes.logにログが吐き出されているか確認
/etc/snort/rules/iplists/default.blacklistにIPリストが記載されていることを確認
④ cloneに登録する
https://www.server-memo.net/tips/crontab.html
# crontab -e
以下を追記
* 15 * * * perl /tmp/pulledpork/pulledpork/pulledpork.pl -c /tmp/pulledpork/pulledpork/etc/pulledpork.conf