App and API Protection은 정부 기관용 Datadog 사이트 US1-FED에서 미리 보기로 제공되고 있습니다.
Docker, Kubernetes, Amazon ECS 및 AWS Fargate에서 실행되는 .NET 앱에 대한 App and API Protection(AAP)를 모니터링할 수 있습니다.
Prerequisites
위협 탐지 활성화
시작하기
**대상 운영 체제 아키텍처에 맞는 Datadog .NET 라이브러리**를 최소 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 서비스 전용의 경우, 관리자 권한으로 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>
이는 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 [...]
컨테이너 도커파일에 다음 환경 변수 값을 추가합니다.
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
애플리케이션을 완전히 중지한 후 다시 시작하세요.
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_APM_TRACING_ENABLED=false 환경 변수와 함께 추가로 DD_APPSEC_ENABLED=true 환경 변수를 지정하세요. - 이 구성은 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
추가 자료