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

Docker、Kubernetes、Amazon ECS、AWS Fargate で実行されている .NET アプリのアプリケーションセキュリティを監視することができます。

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. Update your Datadog .NET library to at least version 2.2.0 (at least version 2.16.0 for Software Composition Analysis detection features) for your target operating system architecture.

    サービスで使用している言語とフレームワークのバージョンが AAP 機能に対応しているかは、互換性 を参照してください。

  2. DD_APPSEC_ENABLED 環境変数を true に設定して AAP を有効化 します。例えば Windows のセルフ ホスト環境では、アプリケーション起動スクリプトの一部として、次の PowerShell スニペットを実行します:

    $target=[System.EnvironmentVariableTarget]::Process
    [System.Environment]::SetEnvironmentVariable("DD_APPSEC_ENABLED","true",$target)
    

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

Windows コンソールで:

rem Set environment variables
SET CORECLR_ENABLE_PROFILING=1
SET CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8}
SET DD_APPSEC_ENABLED=true

rem Start application
dotnet.exe example.dll

管理者として以下の PowerShell コマンドを実行し、レジストリ HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment に必要な環境変数を構成して、IIS を再起動します。

$target=[System.EnvironmentVariableTarget]::Machine
[System.Environment]::SetEnvironmentVariable("DD_APPSEC_ENABLED","true",$target)
net stop was /y
net start w3svc

または、IIS サービスのみの場合、Powershell がある WAS と W3SVC で管理者権限で以下を実行します。


$appsecPart = "DD_APPSEC_ENABLED=true"
[string[]] $defaultvariable = @("CORECLR_ENABLE_PROFILING=1", "CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8}", $appsecPart)

function Add-AppSec {

    param (
        $path
    )
    $v = (Get-ItemProperty -Path $path).Environment
    If ($v -eq $null) {
        Set-ItemProperty -Path $path -Name "Environment" -Value $defaultvariable
    }
    ElseIf (-not ($v -match $appsecPart)) {
        $v += " " + $appsecPart;
        Set-ItemProperty -Path $path -Name "Environment" -Value $v
    }
}
Add-AppSec -path "HKLM:SYSTEM\CurrentControlSet\Services\WAS\"
Add-AppSec -path "HKLM:SYSTEM\CurrentControlSet\Services\W3SVC\"

net stop was /y
net start w3svc

または、レジストリキーの編集を避けるため、アプリケーションの設定を web.config ファイルで編集します。

<configuration>
  <appSettings>
        <add key="DD_APPSEC_ENABLED" value="true"/>
  </appSettings>
</configuration>

これは、IIS アプリケーションプールレベルで、applicationHost.config ファイル (通常、C:\Windows\System32\inetsrv\config\ にあります) で行うこともできます。

<system.applicationHost>

    <applicationPools>
        <add name="DefaultAppPool">
            <environmentVariables>
                <add name="DD_APPSEC_ENABLED" value="true" />
            </environmentVariables>
            (...)

アプリケーションの構成に以下を追加します。

DD_APPSEC_ENABLED=true

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

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"
  }
]

コンテナの Dockerfile に以下の行を追加します。

ENV DD_APPSEC_ENABLED=true
  1. Restart the application using a full stop and start.

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

  2. 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 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 send known attack patterns to it, threat information appears in the Application Signals Explorer and vulnerability information appears in the Vulnerabilities explorer.

その他の参考資料