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

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 PHP ライブラリをインストールします。

    wget https://github.com/DataDog/dd-trace-php/releases/latest/download/datadog-setup.php -O datadog-setup.php
    php datadog-setup.php --php-bin all --enable-appsec
    

    サービスの言語やフレームワークのバージョンが ASM 機能に対応しているかどうかは、互換性をご参照ください。

  2. PHP-FPM または Apache を再起動することで、コード内でライブラリを有効化します。コンテナ環境では、以前に ASM を有効にせずにライブラリをインストールした場合、以下の環境変数を設定することで、オプションで後から有効にすることができます。

    APM 用の構成コンテナを更新するには、docker run コマンドに以下の引数を追加します。

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

    コンテナの Dockerfile に以下の環境変数の値を追加します。

    ENV DD_APPSEC_ENABLED=true
    

    APM 用の構成 yaml ファイルコンテナを更新し、AppSec の環境変数を追加します。

    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.

  3. 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<=200;i++)); 
    do
    # Target existing service’s routes
    curl https://your-application-url/existing-route -A dd-test-scanner-log;
    # Target non existing service’s routes
    curl https://your-application-url/non-existing-route -A dd-test-scanner-log;
    done

    Note: The dd-test-scanner-log value is supported in the most recent releases.

    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 アドレスが表示されます。

その他の参考資料