Skip to content

Commit 42ef6c9

Browse files
aws.cloudtrail: improve CloudTrail user identity processing (#15601)
AWS Cloudtrail: it has been updated how IAM users are handled. In particular, for the user identity IAMUser type, the user.name and user.id are populated with the user fields that made the action/request. For the user identity AssumedRole type, AWS SIEM rules need roles to be treated as IAMUsers in order to work fine. So the role identifies inside sessionIssuer populate user.* fields. Then, the session name is being mapped as user.changes.name as it can be interpreted as the name the user is taking for that particular session, and it's the closest approach in ECS.
1 parent 19ee358 commit 42ef6c9

File tree

36 files changed

+222
-110
lines changed

36 files changed

+222
-110
lines changed

packages/aws/changelog.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# newer versions go on top
2+
- version: "5.2.0"
3+
changes:
4+
- description: Normalize user fields for AWS CloudTrail events.
5+
type: enhancement
6+
link: https://github.com/elastic/integrations/pull/15601
27
- version: "5.1.0"
38
changes:
49
- description: Set `event.kind` to `alert` on AWS WAF events.

packages/aws/data_stream/apigateway_logs/_dev/test/pipeline/test-apigateway-http.log-expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,4 @@
122122
]
123123
}
124124
]
125-
}
125+
}

packages/aws/data_stream/apigateway_logs/_dev/test/pipeline/test-apigateway-rest.log-expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,4 @@
132132
]
133133
}
134134
]
135-
}
135+
}

packages/aws/data_stream/apigateway_logs/_dev/test/pipeline/test-apigateway-websocket.log-expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,4 @@
103103
]
104104
}
105105
]
106-
}
106+
}

packages/aws/data_stream/cloudtrail/_dev/test/pipeline/test-assume-role-json.log-expected.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@
113113
],
114114
"user": [
115115
"AROAIN5ATK5U7KEXAMPLE:JohnRole1",
116-
"JohnDoe"
116+
"JohnDoe",
117+
"JohnRole1"
117118
]
118119
},
119120
"source": {
@@ -144,6 +145,9 @@
144145
}
145146
},
146147
"user": {
148+
"changes": {
149+
"name": "JohnRole1"
150+
},
147151
"entity": {
148152
"id": [
149153
"arn:aws:iam::111111111111:role/JohnRole1"
@@ -290,7 +294,8 @@
290294
],
291295
"user": [
292296
"AROAIN5ATK5U7KEXAMPLE:JohnRole1",
293-
"JohnDoe"
297+
"JohnDoe",
298+
"JohnRole1"
294299
]
295300
},
296301
"source": {
@@ -321,6 +326,9 @@
321326
}
322327
},
323328
"user": {
329+
"changes": {
330+
"name": "JohnRole1"
331+
},
324332
"entity": {
325333
"id": [
326334
"arn:aws:iam::111111111111:role/JohnRole1"

packages/aws/data_stream/cloudtrail/_dev/test/pipeline/test-attach-user-policy-json.log-expected.json

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,6 @@
5757
]
5858
}
5959
},
60-
"service": {
61-
"target": {
62-
"entity": {
63-
"id": [
64-
"arn:aws:iam::aws:policy/AdministratorAccess"
65-
]
66-
}
67-
}
68-
},
6960
"event": {
7061
"action": "AttachUserPolicy",
7162
"category": [
@@ -94,9 +85,19 @@
9485
"user": [
9586
"pwncloud-backdoor-user",
9687
"PRINCIPALID:i-06815aa7cf7d21f8f",
97-
"ec2-instance-role"
88+
"ec2-instance-role",
89+
"i-06815aa7cf7d21f8f"
9890
]
9991
},
92+
"service": {
93+
"target": {
94+
"entity": {
95+
"id": [
96+
"arn:aws:iam::aws:policy/AdministratorAccess"
97+
]
98+
}
99+
}
100+
},
100101
"source": {
101102
"address": "216.160.83.56",
102103
"as": {
@@ -137,6 +138,9 @@
137138
"version_protocol": "tls"
138139
},
139140
"user": {
141+
"changes": {
142+
"name": "i-06815aa7cf7d21f8f"
143+
},
140144
"entity": {
141145
"id": [
142146
"arn:aws:sts::000000000:assumed-role/ec2-instance-role/i-06815aa7cf7d21f8f"

packages/aws/data_stream/cloudtrail/_dev/test/pipeline/test-attach-user-role-json.log-expected.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@
7777
"test@elastic.co"
7878
]
7979
},
80+
"service": {
81+
"target": {
82+
"entity": {
83+
"id": [
84+
"arn:aws:iam::aws:policy/SecurityAudit"
85+
]
86+
}
87+
}
88+
},
8089
"source": {
8190
"address": "216.160.83.56",
8291
"as": {
@@ -108,15 +117,6 @@
108117
]
109118
}
110119
},
111-
"service": {
112-
"target": {
113-
"entity": {
114-
"id": [
115-
"arn:aws:iam::aws:policy/SecurityAudit"
116-
]
117-
}
118-
}
119-
},
120120
"tls": {
121121
"cipher": "TLS_AES_128_GCM_SHA256",
122122
"client": {

packages/aws/data_stream/cloudtrail/_dev/test/pipeline/test-authorize-security-group-egress-json.log-expected.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@
108108
],
109109
"user": [
110110
"PRINCIPALID:i-06815aa7cf7d21f8f",
111-
"ec2-instance-role"
111+
"ec2-instance-role",
112+
"i-06815aa7cf7d21f8f"
112113
]
113114
},
114115
"service": {
@@ -161,6 +162,9 @@
161162
"version_protocol": "tls"
162163
},
163164
"user": {
165+
"changes": {
166+
"name": "i-06815aa7cf7d21f8f"
167+
},
164168
"entity": {
165169
"id": [
166170
"arn:aws:sts::000000000:assumed-role/ec2-instance-role/i-06815aa7cf7d21f8f"

packages/aws/data_stream/cloudtrail/_dev/test/pipeline/test-console-login-json.log-expected.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,8 @@
322322
],
323323
"user": [
324324
"AROAIDPPEZS35WEXAMPLE:AssumedRoleSessionName",
325-
"RoleToBeAssumed"
325+
"RoleToBeAssumed",
326+
"MySessionName"
326327
]
327328
},
328329
"source": {
@@ -352,6 +353,9 @@
352353
"actor_target_mapping"
353354
],
354355
"user": {
356+
"changes": {
357+
"name": "MySessionName"
358+
},
355359
"entity": {
356360
"id": [
357361
"arn:aws:sts::123456789012:assumed-role/RoleToBeAssumed/MySessionName"

packages/aws/data_stream/cloudtrail/_dev/test/pipeline/test-converse-json.log-expected.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@
7878
],
7979
"user": [
8080
"PRINCIPALID:i-03cd6b2a7eb4bf3ae",
81-
"private-ec2-instance-role"
81+
"private-ec2-instance-role",
82+
"i-03cd6b2a7eb4bf3ae"
8283
]
8384
},
8485
"source": {
@@ -120,6 +121,9 @@
120121
"version_protocol": "tls"
121122
},
122123
"user": {
124+
"changes": {
125+
"name": "i-03cd6b2a7eb4bf3ae"
126+
},
123127
"entity": {
124128
"id": [
125129
"arn:aws:sts::00000000000:assumed-role/private-ec2-instance-role/i-03cd6b2a7eb4bf3ae"

0 commit comments

Comments
 (0)