このページは日本語には対応しておりません。随時翻訳に取り組んでいます。
翻訳に関してご質問やご意見ございましたら、お気軽にご連絡ください

You can monitor application security for Go apps running in Docker, Kubernetes, and Amazon ECS.

Prerequisites

Enabling Application & API Protection

Get started

  1. Add to your program’s go.mod dependencies the latest version of the Datadog Go library (version 1.53.0 or later):

    $ 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 has a series of pluggable packages which provide out-of-the-box support for instrumenting a series of Go libraries and frameworks. A list of these packages can be found in the compatibility requirements page. Import these packages into your application and follow the configuration instructions listed alongside each integration.

  3. Recompile your program with Application & API Protection enabled:

    $ go build -v -tags appsec my-program
    

    Notes:

    • The Go build tag appsec is not necessary if CGO is enabled with CGO_ENABLED=1.
    • Datadog WAF needs the following shared libraries on Linux: libc.so.6 and libpthread.so.0.
    • When using the build tag appsec and CGO is disabled, the produced binary is still linked dynamically to these libraries.
    • The Go build tag datadog.no_waf can be used to disable Application & API Protection at build time in any situation where the requirements above are a hinderance.
  4. Redeploy your Go service and enable Application & API Protection by setting the environment variables:

    $ env DD_APPSEC_ENABLED=true DD_APM_TRACING_ENABLED=false ./my-program
    

    Or one of the following methods, depending on where your application runs:

    Add the following environment variable values to your Docker command line:

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

    Add the following environment variable values to your application container’s Dockerfile:

    ENV DD_APPSEC_ENABLED=true
    ENV DD_APM_TRACING_ENABLED=false
    

    Update your application’s deployment configuration file for APM and add the Application & API Protection environment variables:

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

    Update your application’s ECS task definition JSON file, by adding these in the environment section:

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

    ライブラリは、アプリケーションからセキュリティデータを収集し、Agent に送信します。Agent は、そのデータを Datadog に送信し、すぐに使える検出ルールによって、攻撃者のテクニックや潜在的な誤構成にフラグが立てられるため、是正措置を講じることができます。

  5. Application Security Management の脅威検出の動作を見るには、既知の攻撃パターンをアプリケーションに送信してください。例えば、次の curl スクリプトを含むファイルを実行して、Security Scanner Detected ルールをトリガーします。

    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

    アプリケーションを有効にして実行すると、数分後に Datadog の Application Trace and Signals Explorer に脅威情報が表示されます

Further Reading

PREVIEWING: mcretzman/DOCS-10318-sec-reorg-WP-AAP