Public access to an ActionTrail OSS bucket

Restrict public access to the OSS bucket that stores ActionTrail audit logs.

Description

Keep the OSS bucket that receives ActionTrail logs private. These logs record account activity and security events.

Potential impact

Public reads can expose account and resource details. Public writes can let others alter or delete audit evidence.

Remediation

Set the bucket ACL to private. Remove public grants from bucket policies and object ACLs, and check Block Public Access. Keep the ActionTrail delivery role and approved readers. Confirm a new log arrives and anonymous access is denied.

Examples

Use an available bucket name and set actiontrail_oss_write_role_arn to the delivery role’s ARN. Referencing the bucket ID makes Terraform create the destination before the trail. Keep the name and resource address when updating an existing bucket.

Before

hcl
resource "alicloud_oss_bucket" "actiontrail_bucket" {
  bucket = "bucket-actiontrail-3"
  acl    = "public-read"
}

resource "alicloud_actiontrail_trail" "actiontrail" {
  trail_name         = "action-trail"
  oss_write_role_arn = var.actiontrail_oss_write_role_arn
  oss_bucket_name    = alicloud_oss_bucket.actiontrail_bucket.id
  event_rw           = "All"
  trail_region       = "All"
}

After

hcl
resource "alicloud_oss_bucket" "actiontrail_bucket" {
  bucket = "bucket-actiontrail-1"
  acl    = "private"
}

resource "alicloud_actiontrail_trail" "actiontrail" {
  trail_name         = "action-trail"
  oss_write_role_arn = var.actiontrail_oss_write_role_arn
  oss_bucket_name    = alicloud_oss_bucket.actiontrail_bucket.id
  event_rw           = "All"
  trail_region       = "All"
}

References