Skip to content

Commit 1ae6c3e

Browse files
authored
Add Support for Multiple Kibana Security Detection Rule Types (#1292)
1 parent 429d7e9 commit 1ae6c3e

29 files changed

+14424
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## [Unreleased]
22

3+
- Create `elasticstack_kibana_security_detection_rule` resource. ([#1290](https://github.com/elastic/terraform-provider-elasticstack/pull/1290))
34
- Add `elasticstack_kibana_export_saved_objects` data source ([#1293](https://github.com/elastic/terraform-provider-elasticstack/pull/1293))
45
- Create `elasticstack_kibana_maintenance_window` resource. ([#1224](https://github.com/elastic/terraform-provider-elasticstack/pull/1224))
56
- Add support for `solution` field in `elasticstack_kibana_space` resource and data source ([#1102](https://github.com/elastic/terraform-provider-elasticstack/issues/1102))

docs/resources/kibana_security_detection_rule.md

Lines changed: 431 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
terraform import elasticstack_kibana_security_detection_rule.example default/12345678-1234-1234-1234-123456789abc
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
provider "elasticstack" {
2+
kibana {}
3+
}
4+
5+
# Basic security detection rule
6+
resource "elasticstack_kibana_security_detection_rule" "example" {
7+
name = "Suspicious Activity Detection"
8+
type = "query"
9+
query = "event.action:logon AND user.name:admin"
10+
language = "kuery"
11+
enabled = true
12+
description = "Detects suspicious admin logon activities"
13+
severity = "high"
14+
risk_score = 75
15+
from = "now-6m"
16+
to = "now"
17+
interval = "5m"
18+
19+
author = ["Security Team"]
20+
tags = ["security", "authentication", "admin"]
21+
license = "Elastic License v2"
22+
false_positives = ["Legitimate admin access during maintenance windows"]
23+
references = [
24+
"https://example.com/security-docs",
25+
"https://example.com/admin-access-policy"
26+
]
27+
28+
note = "Investigate the source IP and verify if the admin access is legitimate."
29+
setup = "Ensure that authentication logs are being collected and indexed."
30+
}
31+
32+
# Advanced security detection rule with custom settings
33+
resource "elasticstack_kibana_security_detection_rule" "advanced" {
34+
name = "Advanced Threat Detection"
35+
type = "query"
36+
query = "process.name:powershell.exe AND process.args:*encoded*"
37+
language = "kuery"
38+
enabled = true
39+
description = "Detects encoded PowerShell commands which may indicate malicious activity"
40+
severity = "critical"
41+
risk_score = 90
42+
from = "now-10m"
43+
to = "now"
44+
interval = "2m"
45+
max_signals = 200
46+
version = 1
47+
48+
index = [
49+
"winlogbeat-*",
50+
"logs-windows-*"
51+
]
52+
53+
author = [
54+
"Threat Intelligence Team",
55+
"SOC Analysts"
56+
]
57+
58+
tags = [
59+
"windows",
60+
"powershell",
61+
"encoded",
62+
"malware",
63+
"critical"
64+
]
65+
66+
false_positives = [
67+
"Legitimate encoded PowerShell scripts used by automation",
68+
"Software installation scripts"
69+
]
70+
71+
references = [
72+
"https://attack.mitre.org/techniques/T1059/001/",
73+
"https://example.com/powershell-security-guide"
74+
]
75+
76+
license = "Elastic License v2"
77+
note = <<-EOT
78+
## Investigation Steps
79+
1. Examine the full PowerShell command line
80+
2. Decode any base64 encoded content
81+
3. Check the parent process that spawned PowerShell
82+
4. Review network connections made during execution
83+
5. Check for file system modifications
84+
EOT
85+
86+
setup = <<-EOT
87+
## Prerequisites
88+
- Windows endpoint monitoring must be enabled
89+
- PowerShell logging should be configured
90+
- Sysmon or equivalent process monitoring required
91+
EOT
92+
}

0 commit comments

Comments
 (0)