Docker、Kubernetes、Amazon ECS で動作する Go アプリのアプリケーションセキュリティを監視することができます。

In general, setting up Application Security Management (ASM) involves:

  1. Identifying services that are vulnerable or are under attack, which would most benefit from ASM. Find them on the Security tab of your Service Catalog.
  2. Updating to the latest Datadog library (the most recent APM tracing library).
  3. Enabling the library to collect the application security data from the services and send it to Datadog.
  4. Triggering security signals in your application and seeing how Datadog displays the resulting information.

Prerequisites

脅威検知を有効にする

はじめに

  1. 最新バージョンの Datadog Go ライブラリ (バージョン 1.53.0 以降) をプログラムの go.mod 依存関係に追加します。

    $ go get -v -u gopkg.in/DataDog/dd-trace-go.v1
    
  2. Datadog には、一連の Go ライブラリやフレームワークのインスツルメンテーション向けにすぐに使えるサポートを提供するプラグイン可能な一連のパッケージがあります。 これらのパッケージのリストは、互換性要件ページにあります。これらのパッケージをアプリケーションにインポートし、各インテグレーションの横に記載されている構成の説明に従ってください。

  3. ASM を有効にしてプログラムを再コンパイルします。

    $ go build -v -tags appsec my-program
    
  4. 環境変数 DD_APPSEC_ENABLEDtrue に設定することで Go サービスを再デプロイし、ASM を有効にします

    $ env DD_APPSEC_ENABLED=true ./my-program
    

    または、アプリケーションの実行場所に応じて、以下の方法のいずれかを使用します。

    Docker コマンドラインに以下の環境変数の値を追加します。

    $ docker run -e DD_APPSEC_ENABLED=true [...]
    

    アプリケーションコンテナの Dockerfile に以下の環境変数の値を追加します。

    ENV DD_APPSEC_ENABLED=true
    

    アプリケーションの APM 用のデプロイメント構成ファイルを更新し、ASM 環境変数を追加します。

    spec:
      template:
        spec:
          containers:
            - name: <CONTAINER_NAME>
              image: <CONTAINER_IMAGE>/<TAG>
              env:
                - name: DD_APPSEC_ENABLED
                  value: "true"
    

    以下を環境セクションに追加して、アプリケーションの ECS タスク定義 JSON ファイルを更新します。

    "environment": [
      ...,
      {
        "name": "DD_APPSEC_ENABLED",
        "value": "true"
      }
    ]
    

    The library collects security data from your application and sends it to the Agent, which sends it to Datadog, where out-of-the-box detection rules flag attacker techniques and potential misconfigurations so you can take steps to remediate.

  5. To see Application Security Management threat detection in action, send known attack patterns to your application. For example, trigger the Security Scanner Detected rule by running a file that contains the following curl script:

    for ((i=1;i<=250;i++)); 
    do
    # Target existing service’s routes
    curl https://your-application-url/existing-route -A Arachni/v1.0;
    # Target non existing service’s routes
    curl https://your-application-url/non-existing-route -A Arachni/v1.0;
    done

    A few minutes after you enable your application and exercise it, threat information appears in the Application Trace and Signals Explorer in Datadog.

Security Signal 詳細ページでは、タグ、メトリクス、次のステップの提案、脅威と関連する攻撃者の IP アドレスが表示されます。

その他の参考資料