This product is not supported for your selected
Datadog site. (
).
App and API Protection は、Datadog Government サイト US1-FED でプレビュー版として提供されています。
Docker、Kubernetes、Amazon ECS、AWS Fargate で実行されている .NET アプリの App and API Protection を監視することができます。
Prerequisites
脅威検知の有効化
始める
**Datadog .NETライブラリ**を、ターゲット OS アーキテクチャのバージョン 2.2.0 以上に更新します。
サービスの言語やフレームワークのバージョンが AAP 機能に対応しているかどうかは、互換性をご参照ください。
AAP を有効にするには、DD_APPSEC_ENABLED 環境変数を true に設定します。たとえば、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 サービスのみの場合は、WAS および W3SVC で管理者として Powershell を使用して以下を実行します。
$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>
(...)
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
アプリケーションを完全に停止してから起動する方法で3. 再起動します。
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.
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.
APM トレーシングを使用せずに AAP を使用する
APM トレーシング機能を使用せずに App and API Protection を使用する場合は、トレーシングを無効にしてデプロイできます。
- SDK の構成時に、
DD_APPSEC_ENABLED=true 環境変数に加えて DD_APM_TRACING_ENABLED=false 環境変数も使用します。 - この構成により、Datadog に送信される APM データの量が、App and API Protection 製品で必要とされる最小限の量に削減されます。
詳細については、[スタンドアロンの App and API Protection][standalone_billing_guide] を参照してください。
[standalone_billing_guide]: /security/application_security/guide/standalone_application_security/
4. Verify setup
To verify that App and API Protection is working correctly:
- Send some traffic to your application
- Check the Application Signals Explorer in Datadog
- Look for security signals and vulnerabilities
参考資料