Linux에서 Java용 App and API Protection 설정
You can enable App and API Protection for Java services with the following setup options:
- If your Java service already has APM tracing set up and running, then skip to service configuration.
- If your Java service doesn't have APM tracing set up, you can easily enable App and API Protection with Datadog's Automatic Installation.
- Otherwise, continue reading the manual setup instructions below.
Overview
App and API Protection leverages the Datadog Java library to monitor and secure your Java service. The library integrates seamlessly with your existing application without requiring code changes.
For detailed compatibility information, including supported Java versions, frameworks, and deployment environments, see Java Compatibility Requirements.
This guide explains how to set up App and API Protection (AAP) for Java applications. The setup involves:
- Installing the Datadog Agent.
- Enabling App and API Protection monitoring.
- Running your Java application with the Datadog Agent.
- Verifying the setup.
전제 조건
- Linux 운영체제
- Java 애플리케이션
- 루트 또는 sudo 권한
- Systemd(서비스 관리용)
- Datadog API 키
- Datadog Java SDK(버전 요구 사항은 여기 참조)
1. Datadog Agent 설치
Linux 호스트용 설정 지침에 따라 Datadog Agent를 설치합니다.
2. App and API Protection 모니터링 활성화
Automatically enabling App and API Protection through Remote Configuration
You can enable services with remote configuration on your services dashboard.
Check the box for the service you want to enable App and API Protection for under Activate on your APM services.
App and API Protection 모니터링 수동 활성화
Datadog Java 라이브러리 최신 버전을 다운로드합니다.
wget -O dd-java-agent.jar 'https://dtdg.co/latest-java-tracer'
시스템 속성을 사용하여 Datadog Agent 및 App and API Protection을 활성화한 상태에서 Java 애플리케이션을 시작합니다.
java -javaagent:/path/to/dd-java-agent.jar -Ddd.appsec.enabled=true -Ddd.service=<MY_SERVICE> -Ddd.env=<MY_ENV> -jar path/to/app.jar
필수 환경 변수를 설정하고 Java 애플리케이션을 시작합니다.
export DD_APPSEC_ENABLED=true
export DD_SERVICE=<YOUR_SERVICE_NAME>
export DD_ENV=<YOUR_ENVIRONMENT>
java -javaagent:/path/to/dd-java-agent.jar -jar path/to/app.jar
App and API Protection을 활성화한 상태에서 APM 추적을 비활성화하려면 APM 추적 변수를 ‘false’로 설정해야 합니다.
시스템 속성을 사용하여 Datadog Agent 및 App and API Protection을 활성화한 상태에서 Java 애플리케이션을 시작합니다.
java -javaagent:/path/to/dd-java-agent.jar -Ddd.appsec.enabled=true -Ddd.apm.tracing.enabled=false -Ddd.service=<MY_SERVICE> -Ddd.env=<MY_ENV> -jar path/to/app.jar
필수 환경 변수를 설정하고 Java 애플리케이션을 시작합니다.
export DD_APPSEC_ENABLED=true
export DD_APM_TRACING_ENABLED=false
export DD_SERVICE=<YOUR_SERVICE_NAME>
export DD_ENV=<YOUR_ENVIRONMENT>
java -javaagent:/path/to/dd-java-agent.jar -jar path/to/app.jar
3. 애플리케이션 실행
위 설정을 통해 Java 애플리케이션을 시작합니다.
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
문제 해결
Java 애플리케이션에 App and API Protection을 설정하는 과정에서 문제가 발생할 경우, Java App and API Protection 문제 해결 가이드를 참조하세요.
추가 자료