日本語訳How to send Snort IDS alert logs into Graylog(前記事Snortのlogを受信して、graylog管理画面に表示されるようにする で紹介しているOther Solutionsのマニュアルの日本語訳)

■ ReadMe日本語訳
How to send Snort IDS alert logs into Graylog
SnortのログをどうやってGraylogに入れるか

This guide describes how to send structured Snort IDS alert logs into Graylog.![]
このガイドでは、構造化されたSnort IDSアラートログをGraylogに送信する方法について説明します。

https://s3.amazonaws.com/graylogblog/snort_integration/dashboard.png

A blog post with use-cases can be found on the Graylog Blog: [Visualize and Correlate IDS Alerts with Open Source Tools]
Graylogブログに、ユースケースのあるブログ記事があります
ブログURL:
https://www.graylog.org/post/visualize-and-correlate-ids-alerts-with-open-source-tools

Configuring Snort
Snortの設定

First, instruct Snort to write all alerts to the local syslog daemon:
まず、すべての警告をローカルsyslogデーモンに書き込むようSnortに指示します。
(Snortをインストールしているサーバのsnort.confにoutput…を追記する)
# snort.conf
output alert_syslog: LOG_LOCAL5 LOG_ALERT
snort.conf(/etc/snort/snort.conf)を編集し、output…を書き込む

Next, configure the local syslog daemon to forward logs to Graylog. If you are using rsyslog, it would look like the following:
次に、ログをGraylogに転送するように、ローカルsyslogデーモンを設定します。 rsyslogを使用している場合は、次のようになります。
(ログ送信元≒Snortをインストールしているサーバの /etc/rsyslog.confに以下を追記する)
$template GRAYLOGRFC5424,"<%PRI%>%PROTOCOL-VERSION% %TIMESTAMP:::date-rfc3339% %HOSTNAME% %APP-NAME% %PROCID% %MSGID% %STRUCTURED-DATA% %msg%\n"
(下はUDP514番ポートでログを転送する場合の設定。同じくrsyslog.confに書き込む)
★ @graylog.example.org:514;GRAYLOGRFC5424

## Configuring Graylog
Graylogの設定

In Graylog, set up a UDP syslog input at the port and network interface you configured in rsyslog earlier and confirm that messages are arriving.
Graylogでは、★(rsyslog)で設定したポートとネットワークインターフェイスUDPでのsyslog取込を設定し、メッセージが到着していることを確認します。

For examples, you could enable ICMP IDS rules and ping a host you are monitoring with Snort to trigger an alert to arrive in Graylog.
確認方法の一例:SnortのICMP IDSルールを有効にして、Snortで監視しているホストに対してpingを実行し、警告をトリガにしてGraylogに届くかどうか確認します。
例に挙げた確認方法の詳細:
graylog管理画面トップメニュー「System」から「Inputs」を選択、
画面左上のプルダウンから「Syslog UDP」を選択し、「Launch new input」を選択
f:id:Saw84:20181113220343p:plain

[Node, Title, Bind address, Port(例:514)]を入力し、「Save」を押下する
f:id:Saw84:20181113220401p:plain

Snortで監視しているホストに対してpingを実行し、登録したInputの右側に表示されているNetwork IO欄のtotalの数字を確認
f:id:Saw84:20181113220423p:plain

You’ll notice that the alert information is not parsed by Graylog yet.
alertはGraylog上ではまだ解析されていないことに気付くでしょう。
(この段階ではGraylogのSearch画面のMessagesに上がってこない)

We will set up a [Graylog Processing Pipeline](http://docs.graylog.org/en/latest/pages/pipelines.html) to identify snort logs and parse the alert into a message with extracted fields.
snortログを特定するためのパイプラインを設定し、Snortログを区別し、アラートを抽出されたフィールドにパースします。

Below is the rule we are using:
以下は、使用しているRuleです。
```
rule "Extract Snort alert fields"
when
has_field("message")
then
let m = regex("^\\s?\\[(\\d+):(\\d+):(\\d+)\\] (.+?) \\[Classification: (.+?)\\] \\[Priority: (\\d+)] \\{(.+?)\\} (\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})(:(\\d{1,5}))? -> (\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})(:(\\d{1,5}))?\\R?", to_string($message.message));

set_field("snort_alert", true);

set_field("generator_id", m["0"]);
set_field("signature_id", m["1"]);
set_field("signature_revision_id", m["2"]);

set_field("description", m["3"]);
set_field("classification", m["4"]);
set_field("priority", to_long(m["5"]));
set_field("protocol", m["6"]);

set_field("src_addr", m["7"]);
set_field("src_port", to_long(m["9"]));

set_field("dst_addr", m["10"]);
set_field("dst_port", to_long(m["12"]));
end
```

Then, connect this pipeline to a stream with the following rules to apply to all snort messages:
続いて、このパイプラインを、次のRuleを設定したStreamに接続することで、snortメッセージに適用します。

# Stream "Snort Alerts"
# Rule 1:
message must match regular expression ^\s?\[\d+:\d+:\d+].*
# Rule 2:
application_name must match exactly snort
## Result

Now all Snort alerts should arrive in Graylog with nicely parsed and extracted fields:
Snortのアラートはすべて、Graylogにきれいに解析され、抽出されたフィールドで到着するはずです:
(この段階で、GraylogのSearch画面のMessagesに上がってくるようになる
参考画像:https://s3.amazonaws.com/graylogblog/snort_integration/snort_message.png

翻訳終わり