- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- Administrator's Guide
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
This topic explains how to create custom Datadog Agent policies and detection rules for CSM Threats.
In addition to the out of the box (OOTB) default Agent and detection rules, you can write custom Agent and detection rules. Custom rules help to detect events Datadog is not detecting with its OOTB rules.
Agent rules are collected in policies. First, you create a policy, and then you add the default and custom rules you want applied by the policy.
When you create an Agent configuration policy it contains the default rules only. You can add custom rules to the policy to target specific infrastructure locations.
Here are some important role and permissions to use for custom rules RBAC:
security_monitoring_cws_agent_rules_actions
permission can be used to turn on and configure the Active Protection feature. Active Protection enables you to proactively block and terminate crypto mining threats identified by the Datadog Agent threat detection rules.security_monitoring_cws_agent_rules_actions
permission, a user with the Datadog Admin role must create a role containing the security_monitoring_cws_agent_rules_actions
permission and then add only those users that manage Active Protection to this role.Rules are managed and applied using policies. To view policies, go to Security > Cloud Security Management > Agent Configuration.
You can create and deploy different custom policies containing rules you want to apply to different sets of hosts in your infrastructure.
For example, you can do the following with policies:
The default policy and its rules cannot be modified. You can use the policy priority setting to override the default policy with custom policies.
Agents that are in the scope of multiple policies apply configurations based on the priority order. In cases where a higher priority policy contains the same rules as a lower priority, the higher priority policy’s rules override the lower priority policy.
When a policy is overridden, the Overridden status is displayed. Hover over the status to see the overriding policy name.
Tags are the target location where the policy is applied (environments, clusters, hosts, etc.). Add custom tags to policies to target the policy rules at certain portions of your infrastructure.
Tags identify two things: the Agents using the policy and the infrastructure where those Agents apply the policy. For example, if a policy has the tag cluster_name:mycluster
the Agents in that cluster use the policy on the hosts in that cluster.
When you add tags, Datadog displays how many hosts the tags target. For example, Tags match 144 hosts
.
In the policy, click Tags With This Policy. The number of hosts targeted by each tag are displayed in Hosts matching this tag.
Custom detection rules depend on Agent rules. They are composed of existing, deployed Agent rules and additional expression parameters.
There are two use cases:
For more information, see CSM Threats Detection Rules.
You can create custom rules using these methods:
CSM custom Agent rules are grouped into policies. Policies group Agent rules to help you apply multiple rules more efficiently.
When you create an Agent configuration policy it contains the default Agent rules only. You can add custom Agent rules to the policy to apply specific rules to specific Agents.
When you add an Agent configuration policy you can use the Assisted rule creator option to create the Agent and dependent detection rules together. This method ensures that the Agent rule is referenced in the detection rules. Using this tool is faster than creating the Agent and detection rules separately and then referencing the Agent rules in the detection rules.
As you define the rules using this tool, the threat expressions generated for these rules are displayed in the tool.
To use the Assisted rule creator:
foo
is added as process.argv in ["foo"]
.You can create a custom Agent rule and deploy it as part of a new Agent policy. Later, when defining a custom detection rule, you reference the custom Agent rule and add expression parameters.
After you create a custom Agent rule, the change is saved along with other pending rule updates. To apply the change to your environment, deploy the updated custom policy to the Agent.
To perform remote configuration, you use the Datadog UI to apply policies to infrastructure. When you enable a policy, it is applied to the infrastructure identified by the policy’s tags.
To perform manual deployment, you create the policy and its rules in the Datadog UI, download it, and then upload it to the Agent(s) where you want it applied.
Next, use the following instructions to upload the policy file to each host.
Copy the default.policy
file to the target host in the /etc/datadog-agent/runtime-security.d
folder. The file must have read
and write
access for the root
user on the host. This may require use of a utility such as SCP or FTP.
To apply the changes, restart the Datadog Agent.
Create a ConfigMap containing default.policy
, for example, kubectl create configmap jdefaultpol --from-file=default.policy
.
Add the ConfigMap (jdefaultpol
) to values.yaml
with datadog.securityAgent.runtime.policies.configMap
:
securityAgent:
# [...]
runtime:
# datadog.securityAgent.runtime.enabled
# Set to true to enable Security Runtime Module
enabled: true
policies:
# datadog.securityAgent.runtime.policies.configMap
# Place custom policies here
configMap: jdefaultpol
# [...]
Upgrade the Helm chart with helm upgrade <RELEASENAME> -f values.yaml --set datadog.apiKey=<APIKEY> datadog/datadog
.
Note: If you need to make further changes to default.policy
, you can either use kubectl edit cm jdefaultpol
or replace the configMap with kubectl create configmap jdefaultpol --from-file default.policy -o yaml --dry-run=client | kubectl replace -f -
.
Enabled policies apply their rules to the infrastructure targets identified by their tags. Enabling a policy is the same as deploying it.
You can use Remote Configuration in the Datadog UI to automatically deploy the custom policy to the hosts designated by the policy tags (all hosts or a defined subset of hosts), or you can manually upload the policy to the Agent on each host.
To enable a policy using Remote Configuration in the Datadog UI, do the following:
If you disable a policy, its rules are no longer applied to the infrastructure identified by its tags.
Custom Agent rules are deployed to the Agent in a custom policy separate from the default policy. The custom policy contains custom Agent rules as well as default rules that have been disabled.
After you upload the new default policy file to the Agent, navigate to the Threat Detection Rules page.
Configure a new CSM Threats rule. A rule can have multiple rule cases combined with Boolean logic, for example (||, &&)
. You can also set the counter, group by, and roll-up window.
Enter a query so that a trigger is only generated when a value is met. You can also enter suppression queries in the Suppression Rules, so that a trigger is not generated when the specified values are met.
Set a rule case for the trigger and severity.
Define the logic for when this rule triggers a security signal. For example, a>0
means a security signal triggers as long as the rule condition set in the search query is met at least once in the sliding time window.
Select a severity to associate the rule with and select all relevant parties you want to notify.
Datadog recommends including a remediation runbook in the body. As noted in the template, use substitution variables to dynamically generate contextualized content at runtime.
You can also disable a rule by setting the Then… section of a rule to Do Nothing.