Tobias Schmidt
Tobias Schmidt

@tpschmidt_

16 Tweets 1 reads Jan 15, 2023
๐Ÿ“š AWS 1x1 - ๐—–๐—น๐—ผ๐˜‚๐—ฑ๐—ง๐—ฟ๐—ฎ๐—ถ๐—น
Discover malicious behavior in your account by tracking all changes that are made to your infrastructure โ†“
๐—ง๐—ต๐—ฟ๐—ฒ๐—ฎ๐—ฑ ๐—ข๐˜ƒ๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฒ๐˜„ ๐Ÿงต
โ€ข Importance of audit logging
โ€ข The Basics
โ€ข Structure of Audit Logs
โ€ข Trails
โ€ข Encryption & Compliance
โ€ข Event Types
โ€ข Filtering
โ€ข Identity Types
{ 1 | 15 }
๐—ช๐—ต๐˜† ๐—ฑ๐—ผ ๐—œ ๐—ป๐—ฒ๐—ฒ๐—ฑ ๐˜๐—ต๐—ถ๐˜€?
There's a high chance that your infrastructure will be under attack at some point in the future. This grows with your product and the complexity of your infrastructure.
If something is compromised, you're in need of audit logs.
{ 2 | 15 }
And that's where CloudTrail comes in.
It tracks all activities that are related to infrastructure changes in your account and keeps this information in the form of audit logs.
Those logs contain all information: ๐˜„๐—ต๐—ผ did ๐˜„๐—ต๐—ฎ๐˜ ๐˜„๐—ต๐—ฒ๐—ป & ๐˜„๐—ต๐—ฒ๐—ฟ๐—ฒ!
{ 3 | 15 }
Each of these activities is recorded as an ๐—˜๐˜ƒ๐—ฒ๐—ป๐˜, which is a JSON object containing all needed information.
You can browse them at ๐—–๐—น๐—ผ๐˜‚๐—ฑ๐—ง๐—ฟ๐—ฎ๐—ถ๐—น๐˜€ ๐—˜๐˜ƒ๐—ฒ๐—ป๐˜ ๐—›๐—ถ๐˜€๐˜๐—ผ๐—ฟ๐˜†!
eu-central-1.console.aws.amazon.com
{ 4 | 15 }
๐—ง๐—ฟ๐—ฎ๐—ถ๐—น๐˜€
You can decide for yourself which Events you want to track by creating ๐˜๐—ฟ๐—ฎ๐—ถ๐—น๐˜€.
A trail will forward your events to an S3 bucket.
Additionally, you can also send them to CloudWatch.
(great if also using subscription filters to react to events)
{ 5 | 15 }
๐—˜๐—ป๐—ฐ๐—ฟ๐˜†๐—ฝ๐˜๐—ถ๐—ผ๐—ป & ๐—–๐—ผ๐—บ๐—ฝ๐—น๐—ถ๐—ฎ๐—ป๐—ฐ๐—ฒ
CloudWatch also enables you to verify the log file integrity - so you can be sure there was no tampering.
Furthermore, log event objects can be automatically encrypted by using a key from KMS.
{ 6 | 15 }
For securing your data even more, you can make use of S3's retention modes & object locks
With S3's ๐—ชrite-๐—ขnce-๐—ฅead-๐— any (WORM) model you can enforce that objects can't be deleted or modified for a given period of time.
By that, you can enforce compliance rules
{ 7 | 15 }
CloudTrail records different types of audit events.
There are ๐— ๐—ฎ๐—ป๐—ฎ๐—ด๐—ฒ๐—บ๐—ฒ๐—ป๐˜, ๐——๐—ฎ๐˜๐—ฎ & ๐—œ๐—ป๐˜€๐—ถ๐—ด๐—ต๐˜ events for the actions that are performed by users.
{ 8 | 15 }
๐— ๐—ฎ๐—ป๐—ฎ๐—ด๐—ฒ๐—บ๐—ฒ๐—ป๐˜ ๐—˜๐˜ƒ๐—ฒ๐—ป๐˜๐˜€
As the type already suspects, those events are related to infrastructure management operations.
This includes for example IAM Policy adjustments or VPC Subnet creations.
They are referred to as ๐—ฐ๐—ผ๐—ป๐˜๐—ฟ๐—ผ๐—น ๐—ฝ๐—น๐—ฎ๐—ป๐—ฒ operations
{ 9 | 15 }
๐——๐—ฎ๐˜๐—ฎ ๐—˜๐˜ƒ๐—ฒ๐—ป๐˜๐˜€
For events that retrieve, delete or modify data within your AWS accounts services
This includes for example CRUD operations on DynamoDB documents or a GET for an object in an S3 bucket
As expected, data events are often under high activity!
{ 10 | 15 }
Keep this in mind if you're creating data event trails.
If you're monitoring DynamoDB tables at object-level access with high traffic, this will cause a significant amount of trail events and therefore writes to S3.
{ 11 | 15 }
๐—œ๐—ป๐˜€๐—ถ๐—ด๐—ต๐˜ ๐—˜๐˜ƒ๐—ฒ๐—ป๐˜๐˜€
The rarest type of events, which records anomalies in your API usage of your account.
The analysis is based on your historical usage pattern and can identify events like an unusually high number of API calls in a short time period.
{ 12 | 15 }
๐—™๐—ถ๐—น๐˜๐—ฒ๐—ฟ๐—ถ๐—ป๐—ด
If you're creating trails you can also decide which events you actually want to track.
Maybe you're only interested in certain types, services, resources, or a specific region.
This reduces the noise created by changes to your whole ecosystem.
{ 13 | 15 }
For getting back to our previous example:
You're interested in DynamoDB object-level accesses.
Maybe your real interest in tracking modification & deleting operations, but not reads.
Set your filter to ๐—น๐—ผ๐—ด ๐˜„๐—ฟ๐—ถ๐˜๐—ฒ๐—ข๐—ป๐—น๐˜† ๐—ฒ๐˜ƒ๐—ฒ๐—ป๐˜๐˜€
{ 14 | 15 }
๐—œ๐—ฑ๐—ฒ๐—ป๐˜๐—ถ๐˜๐˜† ๐—ง๐˜†๐—ฝ๐—ฒ๐˜€
In addition to having different even types, there are also multiple identity types.
CloudTrail logs the identity of the user or service that performed the action.
For example an...
โ€ข IAM User
โ€ข AWS Service
โ€ข Assumed Role
{ 15 | 15 }

Loading suggestions...