This product is not supported for your selected Datadog site. ().

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

Prerequisites

1-Click Enablement
If your service is running with an Agent with Remote Configuration enabled and a tracing library version that supports it, hover over the Not Enabled indicator in the AAP Status column and click Enable AAP. There's no need to re-launch the service with the DD_APPSEC_ENABLED=true or --enable-appsec flags.

Enabling threat detection

詳細はこちら

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

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

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

    $ go build -v -tags appsec my-program
    

    :

    • CGO_ENABLED=1 で CGO が有効になっていれば、Go のビルドタグ appsec は不要です。
    • Datadog WAF を Linux 上で動作させるには、次の共有ライブラリが必要です: libc.so.6 および libpthread.so.0
    • ビルドタグ appsec を使用し、CGO が無効になっている場合、生成されたバイナリは依然としてこれらのライブラリと動的にリンクされます。
    • 上記の要件が障害になる場合は、Go のビルド タグ datadog.no_waf を使ってビルド時に AAP を無効化できます。
  4. DD_APPSEC_ENABLED 環境変数を true に設定して Go サービスを再デプロイし、AAP を有効化します。

    $ env DD_APPSEC_ENABLED=true ./my-program
    

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

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

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

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

    ENV DD_APPSEC_ENABLED=true
    

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

    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 App and API Protection 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.

その他の参考資料