このページは日本語には対応しておりません。随時翻訳に取り組んでいます。
翻訳に関してご質問やご意見ございましたら、
お気軽にご連絡ください。
You can monitor App and API Protection for Go apps running in Docker, Kubernetes, and Amazon ECS.
前提条件
Enabling threat detection
Get started
- Add to your program’s go.mod dependencies the latest version of the Datadog Go library (version 1.53.0 or later). Note: This documentation uses v2 of the Go tracer, which Datadog recommends for all users. If you are using v1, see the migration guide to upgrade to v2.
$ go get -v -u github.com/DataDog/dd-trace-go/v2/ddtrace/tracer
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.
Recompile your program with AAP 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 AAP at build time in any situation where the requirements above are a hinderance.
Redeploy your Go service and enable AAP by setting the DD_APPSEC_ENABLED
environment variable to true
:
$ env DD_APPSEC_ENABLED=true ./my-program
Or one of the following methods, depending on where your application runs:
Add the following environment variable value to your Docker command line:
$ docker run -e DD_APPSEC_ENABLED=true [...]
Add the following environment variable value to your application container’s Dockerfile:
ENV DD_APPSEC_ENABLED=true
Update your application’s deployment configuration file for APM and add the AAP environment variable:
spec:
template:
spec:
containers:
- name: <CONTAINER_NAME>
image: <CONTAINER_IMAGE>/<TAG>
env:
- name: DD_APPSEC_ENABLED
value: "true"
Update your application’s ECS task definition JSON file, by adding this in the environment section:
"environment": [
...,
{
"name": "DD_APPSEC_ENABLED",
"value": "true"
}
]
ライブラリは、アプリケーションからセキュリティデータを収集し、Agent に送信します。Agent は、そのデータを Datadog に送信し、すぐに使える検出ルールによって、攻撃者のテクニックや潜在的な誤構成にフラグが立てられるため、是正措置を講じることができます。
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 に脅威情報が表示されます。
Using AAP without APM tracing
If you want to use Application & API Protection without APM tracing functionality, you can deploy with tracing disabled:
- Configure your tracing library with the
DD_APM_TRACING_ENABLED=false
environment variable in addition to the DD_APPSEC_ENABLED=true
environment variable. - This configuration will reduce the amount of APM data sent to Datadog to the minimum required by App and API Protection products.
For more details, see [Standalone App and API Protection][standalone_billing_guide].
[standalone_billing_guide]: /security/application_security/guide/standalone_application_security/
Further Reading