# cd /usr/local/src/ # wget http://jaist.dl.sourceforge.net/sourceforge/oinkmaster/oinkmaster-2.0.tar.gz # tar xvzf oinkmaster-2.0.tar.gz # cd oinkmaster-2.0 # # mkdir /usr/local/oinkmaster # cp oinkmaster.pl oinkmaster.conf /usr/local/oinkmaster/ # # mkdir /etc/snort/rules/Backup
# vi /usr/local/oinkmaster/oinkmaster.conf
/usr/local/oinkmaster/oinkmaster.conf
################################################ # General options # ################################################ url = http://www.snort.org/pub-bin/oinkmaster.cgi/<oinkcode here>/snortrules-snapshot-2.4.tar.gz path = /bin:/usr/bin:/usr/local/bin tmpdir = /tmp/ update_files = \.rules$|\.config$|\.conf$|\.txt$|\.map$ # use_external_bins = 0 # umask = 0027 # rule_actions = alert|drop|log|pass|reject|sdrop|activate|dynamic # min_files = 1 # min_rules = 1 # use_path_checks = 1 # user_agent = Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) # include /etc/foo.conf ####################################################################### # Files to totally skip (i.e. never update or check for changes) # # # # Syntax: skipfile filename # # or: skipfile filename1, filename2, filename3, ... # ####################################################################### skipfile local.rules skipfile deleted.rules skipfile snort.conf # skipfile threshold.conf # skipfile sid-msg.map ########################################################################## # SIDs to modify after each update (only for the skilled/stupid/brave). # ########################################################################## # Example to add "tag" stuff to SID 1325. # modifysid 1325 "sid:1325;" | "sid:1325; tag: host, src, 300, seconds;" ######################################################################## # SIDs that we don't want to update. # # # # Syntax: localsid SID # # or: localsid SID1, SID2, SID3, ... # ######################################################################## # Example to never update SID 1325. # localsid 1325 ######################################################################## # SIDs to enable after each update. # # # # Syntax: enablesid SID # # or: enablesid SID1, SID2, SID3, ... # ######################################################################## # Example to enable SID 1325. # enablesid 1325 ######################################################################## # SIDs to comment out # # # # Syntax: disablesid SID # # or: disablesid SID1, SID2, SID3, ... # ######################################################################## # You can specify one SID per line. # disablesid 1 # disablesid 2 # disablesid 3 # disablesid 4,5,6
# chown -R snort:snort /usr/local/oinkmaster # chown -R snort:snort /etc/snort/
# vi /usr/local/oinkmaster/rule-update
/usr/local/oinkmaster/rule-update
#!/bin/sh OINKDIR="/usr/local/oinkmaster" RULEDIR="/etc/snort/rules" $OINKDIR/oinkmaster.pl -o $RULEDIR -C $OINKDIR/oinkmaster.conf -b /etc/snort/rules/Backup -Q chown -R snort:snort /etc/snort/
# chmod +x /usr/local/oinkmaster/rule-update # # crontab -e 以下をエントリー(下記は毎日0:05に実行) 5 0 * * * /usr/local/oinkmaster/rule-update #
| option | 説明 |
|---|---|
| -b <dir> | 更新前まで使用していたルールセットを保存するディレクトリを指定 |
| -c | 更新のチェックのみを実行し、実際の更新は行わない |
| -C <file> | 設定ファイルへのパスを指定 |
| -e | デフォルトで無効にされているルールすべてを有効にする |
| -h | ヘルプを表示 |
| -i | 対話モードでの実行 |
| -m | 結果表示を最小にする |
| -q | 更新の際に変化がない場合は結果を表示しない |
| -Q | 必要最小限の結果表示 |
| -r | 既存のルールのチェックのみを行う |
| -s | 追加、変更されたシグネチャのSIDや名前を表示 |
| -S <file> | 変数を定義されたファイルを指定(指定なき場合はsnort.confが使用される) |
| -T | 設定ファイルが正しく記述されているかのチェック |
| -u | <url> ルールをダウンロードするURLを指定 |
| -U | <file> 指定したファイルを最新のルールファイルに含まれるsnort.confの代わりに使用する |
| -v | 冗長モードで実行 |
| -V | バージョンを表示 |