0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

はじめてのHCP Vault Radar⑤ Vault RadarとSlackを統合してイベントをリアルタイム通知

Posted at

はじめに

前回の記事では、HCP Vault Radar CLIを使ったスキャン方法をご紹介しました。

はじめてのHCP Vault Radar④ Vault Radar CLIでのシークレット検出

今回は、シークレットを検出したときに、Slackへ通知する設定を試してみます。

1. SlackへVault Radar Slack アプリのインストール

1.下のURLからSlackのアプリページにアクセスします。
https://api.slack.com/apps

2.「Create New App」をクリックします。
image.png

3.「From a manifest」をクリックします。
image.png

4.任意のワークスペースを選択します。
image.png

5.ガイドにある下記内容をJSONタブに張り付けます。

{
    "display_information": {
        "name": "HashiCorp Vault Radar",
        "description": "Pipeline Security Tools",
        "background_color": "#2b2b2b",
        "long_description": "What if code security could be improved with the same techniques we use to improve code quality? Tests and code coverage reports integrated in our workflows giving us quick feedback on PRs and in our IDEs have helped us build better, faster, and more maintainable code together, and now it’s time to do the same to improve security."
    },
    "features": {
        "bot_user": {
            "display_name": "HashiCorp Vault Radar",
            "always_online": false
        }
    },
    "oauth_config": {
        "scopes": {
            "bot": [
                "chat:write",
                "incoming-webhook"
            ]
        }
    },
    "settings": {
        "org_deploy_enabled": false,
        "socket_mode_enabled": false,
        "token_rotation_enabled": false
    }
}

image.png

5.「Create」をクリックします。
image.png

6.「Install App」メニューをクリックします。
image.png

7.「install to 」をクリックします。
image.png

8.任意のチャネル名を入力し、『Allow』をクリックします。
image.png

9.表示された「Bot User OAuth Token」をコピーしておきます。
image.png

10.対象のチャネルで、「Hashicorp Vault Radar」を追加します。
image.png

11.「Add this app to a channel...」をクリックします。
image.png

12.チャネル名をもう一度選択して、「Add」をクリックします。
image.png

13.チャネルにアプリケーションが追加されました。
image.png

Slack側の設定は以上です。次に、Vault Radar側の設定を行います。

2. HCP Vault Radar側の設定

Vault Radar側では、Slackとの接続設定(Connection)と通知設定(Subscription)の2つを登録します。ConnectionはSlackとのリンクを確立するための設定で、Subscriptionは通知するイベントやチャネルを指定します。

1.Vault Radarで、「Settings]-「Integrations」-「Slack」を開き、「+Connection」をクリックします。
image.png

2.任意のConnection Nameを入力し、Token欄には、先ほどSlack側で取得した「Bot User OAuth Token」を貼り付けます。「Test & save」をクリックします。
image.png

3.Connectionが登録されました。次に、「Subscriptions」をクリックします。
image.png

4.「+Subscriptions」をクリックします。
今回は、テストのため、すべてのイベントを通知対象として選択しました。フィルターはカスタマイズできるので、通知対象のイベントを絞り込みすることができます。
image.png

5.以下の項目を登録して、「Test & save」をクリックします。

Connection:登録したConnection名を選択
Subscription Name:任意の名前
Saved Filter:All eventsを選択
Channel:アプリをインストールしたチャネル名を入力

image.png

6.Subscriptionが登録されました。
image.png

以上で、Vault Radar側の設定が完了しました。

3. 動作確認

GitHubに新しいファイルを追加し、Vault Radar CLIでスキャンを実行したところ、設定したSlackチャネルに通知が届きました。以下は通知の画面例です。
image.png

最後に

今回は、Vault RadarのIntegration機能を使用してSlackへ通知する方法を試しました。この機能により、セキュリティイベントをリアルタイムで共有し、迅速な対応が可能となります。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?