Sub topic 12
Centralizing logs and security tooling
This chapter assumes you know how an organization, OUs and member accounts fit together. It also assumes you understand trusted access and delegated administrators, and can read an S3 bucket policy.
Why centralize
Each member account produces its own audit logs and security findings. If they stay there, an attacker who gains admin rights in an account can delete the evidence. Reviewers also have to sign in to dozens of accounts to see the full picture.
The usual fix is two dedicated accounts, often placed in a Security OU:
- Log archive account. It holds write-only copies of logs in S3. Almost nobody signs in to it.
- Security tooling account. It is the delegated administrator for services such as GuardDuty, Security Hub and AWS Config. Security staff work here.
Keep both out of the management account. The management account is not restricted by SCPs, so you should run as little as possible in it.
Organization trail
An organization trail is a CloudTrail trail created once that records events from every member account. Members can see the trail but cannot change or stop it. First enable trusted access. Then create the trail from the management account, pointing at a bucket in the log archive account.
aws organizations enable-aws-service-access \
--service-principal cloudtrail.amazonaws.com
aws cloudtrail create-trail \
--name org-trail \
--s3-bucket-name example-org-logs-111122223333 \
--is-organization-trail \
--is-multi-region-trail
aws cloudtrail start-logging --name org-trailThe bucket policy must allow cloudtrail.amazonaws.com to write to the organization's prefix. Otherwise create-trail fails with an InsufficientS3BucketPolicyException.
Delegating security services
Designate the security tooling account once from the management account. After that, the delegated administrator enrolls members and reads findings for the whole organization.
# Run in the management account
aws guardduty enable-organization-admin-account \
--admin-account-id 222233334444
# Run in the security tooling account
DETECTOR_ID=$(aws guardduty list-detectors \
--query 'DetectorIds[0]' --output text)
aws guardduty update-organization-configuration \
--detector-id "$DETECTOR_ID" \
--auto-enable-organization-members ALLWith ALL, GuardDuty is turned on automatically in new and existing member accounts. Security Hub and Config follow the same pattern. Config uses an aggregator for the cross-account view.
Common errors
- Findings only in some Regions. GuardDuty, Security Hub and Config are Regional. You must enable and delegate in every Region you use, including ones you block with SCPs only for workloads.
- Admin set up in the wrong account. Some services allow only one delegated administrator. Changing it later means deregistering the old one first.
- Logs not protected. Turn on versioning, S3 Object Lock or MFA delete, and log file validation in CloudTrail. Add an SCP that denies
cloudtrail:StopLoggingandcloudtrail:DeleteTrail. - Missing KMS permissions. If the bucket uses a KMS key, the key policy must allow CloudTrail and any reading roles.
Exercise
Why should the organization trail's S3 bucket live in a separate log archive account rather than in the management account?
Show answer
The management account is not limited by SCPs and has broad administrative reach. A separate account that few people can access limits who can alter or delete audit logs, so the logs stay trustworthy after a compromise. It also keeps routine workloads out of the management account.