LoginSignup
2
1

More than 3 years have passed since last update.

GuardDutyの結果をEvent Bridge→SNSで通知する

Posted at

はじめに

前回、AWS LambdaからEvent Bridgeに通知してみました。
今回は、GuardDutyEventBridgeSNS(Email)と連携させてみます。

最近業務でセキュリティ!セキュリティ!と叫ばれておりますが、そこまでまともにセキュリティ系のサービスを使っていなかったので、GuardDutyを触り始めたのが理由です。。

構築手順

GuardDutyの有効化

AWSコンソールからGuardDutyを有効化しておきます。(初回の場合、30日間は無料です。)

SNSの作成

Emailで通知が受け取れるように設定しておきます。
sns.PNG

EventBridgeの設定

イベントバスの作成

defaultのイベントバスを利用するので不要です。
最初カスタムイベントバスにルールを作ってしまい、全然アラートが飛ばす悩みました、、、
ここでは前回作成した、custom-application-event-busをそのまま使います。(無い方は任意の名前で作って下さい)

イベントルールの作成

ルール名は任意でOK
guard-1.PNG

カスタムパターンを選択し、イベントパターンに以下を入力します。
今回はSeverityがHighのものだけ通知するようにしています。Severityの定義はこちらを参照。

{
    "source": [
        "aws.guardduty"
    ],
    "detail-type": [
        "GuardDuty Finding"
    ],
    "detail": {
        "severity": [
            { "numeric": [ ">=", 7 ] }
        ]
    }
}

ターゲットには先ほど作成したSNS Topicを指定します。
guard-3.PNG

GuardDutyにサンプルを作成し通知

サンプル結果の作成

GuardDutyの検出を意図的に発生させるのは難しいため、サンプルで試します。
AWSコンソールのGuardDutyの画面で、「設定」→「結果サンプルの作成」を選択します。
(10数件ほどメールが来るのでご承知おきを。)

メールの確認

SNS作成時に設定したEmailに以下のようなメールが届いていれば完了です!

{
    "version": "0",
    "id": "0eef64b4-0f67-244d-400b-7677324fe2af",
    "detail-type": "GuardDuty Finding",
    "source": "aws.guardduty",
    "account": "xxxxxxxxxx",
    "time": "2020-03-10T13:50:01Z",
    "region": "us-west-2",
    "resources": [],
    "detail": {
        ・・・
        "severity": 8,
        "createdAt": "2020-03-07T13:34:05.589Z",
        "updatedAt": "2020-03-10T13:49:52.052Z",
        "title": "DGA domain name queried by EC2 instance i-99999999.",
        "description": "EC2 instance i-99999999 is querying algorithmically generated domains. Such domains are commonly used by malware and could be an indication of a compromised EC2 instance."
    }
}

さいごに

セキュリティの検知をどの範囲で、どのような方法ですれば良いのか?はとても難しいと思います。
まずは、GuardDutyのような自動で検出してくれるサービスを有効にし、EventBridgeである程度必要なものに絞り込み、自分達に有用なアラートを取捨選択していければと思っています。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1