- Notifications
You must be signed in to change notification settings - Fork 519
aws.cloudtrail: improve CloudTrail user identity processing #15601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws.cloudtrail: improve CloudTrail user identity processing #15601
Conversation
| Pinging @elastic/security-service-integrations (Team:Security-Service Integrations) |
🚀 Benchmarks reportTo see the full report comment with |
6b2aa19 to 6f4b104 Compare packages/aws/data_stream/cloudtrail/elasticsearch/ingest_pipeline/default.yml Show resolved Hide resolved
packages/aws/data_stream/cloudtrail/_dev/test/pipeline/test-assume-role-json.log-expected.json Show resolved Hide resolved
| "private-ec2-instance-role" | ||
| "PRINCIPALID", | ||
| "private-ec2-instance-role", | ||
| "i-03cd6b2a7eb4bf3ae" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems more odd, since this is a session now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From this same conversation, the goal is to consider the session name as temporary user name, that's why it is being mapped as user.changes.name and therefore included into related.users.
...aws/data_stream/cloudtrail/_dev/test/pipeline/test-create-db-instance-json.log-expected.json Show resolved Hide resolved
...aws/data_stream/cloudtrail/_dev/test/pipeline/test-create-db-instance-json.log-expected.json Show resolved Hide resolved
| ] | ||
| }, | ||
| "related": { | ||
| "entity": [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, I'd add the "identityStoreArn\":\"arn:aws:identitystore::redacted:identitystore/redacted\" value here
| ignore_failure: true | ||
| ignore_missing: true | ||
| override: true | ||
| if: ctx.aws?.cloudtrail?.user_identity?.type == 'AssumedRole' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to prevent proper mapping for FederatedUser type, which also provides the userIdentity.sessionContext.sessionIssuer.userName field that needs to continue to be mapped to user.name field
| target_field: user.id | ||
| ignore_missing: true | ||
| override: true | ||
| if: ctx.aws?.cloudtrail?.user_identity?.type == 'AssumedRole' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, this change should apply to FederateUser type as well
| patterns: | ||
| - "arn:aws:sts:.*/%{GREEDYDATA:user.changes.name}$" | ||
| ignore_missing: true | ||
| if: ctx.aws?.cloudtrail?.user_identity?.type == 'AssumedRole' && ctx.aws?.cloudtrail?.user_identity?.arn != null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use this to also map the user.changes.name value for FederatedUser identity type. Example: aws.cloudtrail.user_identity.arn : "arn:aws:sts::123445667789:federated-user/fed_consoler" . The arn is created a little differently from Assumed Role since it doesn't keep the calling user's name in the arn but fed_consoler is the name change that should be extracted and treated just like we are treated the session.name for AssumedRole identity type.
| @imays11 @Mikaayenson I have a question for you, the latest changes to the change request respond to Isai's suggestions to avoid breaking the existing rules, so role names are still mapped as Do you still agree with these changes? I understand that the most painful change for you would be to separate roles and user names into different fields. If so, assigning |
Yes I still agree with those changes
Yes that is correct, if the |
| @chemamartinez |
In that case, if no more changes are required the PR is ready for review I think.
@imays11 aren't these two comments contradictory? If we now map the fields to |
@chemamartinez The problem comes with keeping IAM Users under I'm fine keeping both under |
| @imays11 thanks for the clarification! |
| Am I correct in understanding that this change is still going to conflate roles with users? If that's the case, I still do not agree, but I am not going to block this. |
One problem is that the field |
@efd6 yes, but this is not something in this PR. It is something it was happening before so the SIEM rules work. |
💚 Build Succeeded
History
|
agithomas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, considering the design approach taken! Code owner approval.
| Package aws - 5.2.0 containing this change is available at https://epr.elastic.co/package/aws/5.2.0/ |
Proposed commit message
For CloudTrail events, it has been updated how IAM users are handled.
In particular, for the user identity
IAMUsertype, theuser.nameanduser.idarepopulated with the user fields that made the action/request.
For the user identity
AssumedRoletype, AWS SIEM rules need roles to be treated as IAMUsers in order to work fine. So the role identifies insidesessionIssuerpopulateuser.*fields. Then, the session name is being mapped asuser.changes.nameas it can be interpreted as the name the user is taking for that particular session, and it's the closest approach in ECS.References:
Checklist
changelog.ymlfile.Related issues