在 CloudTrail 控制台中創建默認KMS密鑰策略 - AWS CloudTrail

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

在 CloudTrail 控制台中創建默認KMS密鑰策略

如果您在 CloudTrail 主控台 AWS KMS key 中建立,則會自動為您建立下列原則。此政策允許這些許可:

  • 允許KMS金鑰的 AWS 帳戶 (根) 權限。

  • 允許 CloudTrail 加密密KMS鑰下的日誌文件並描述密KMS鑰。

  • 允許指定帳戶中的所有使用者解密日誌檔案。

  • 允許指定帳戶中的所有使用者為KMS金鑰建立KMS別名。

  • 已建立追蹤的帳戶能夠用於帳戶 ID 跨帳戶日誌解密。

CloudTrail Lake 事件資料存放區的預設KMS金鑰原則

以下是針對與 CloudTrail Lake 中的事件資料存放區搭配使用 AWS KMS key 而建立的預設原則。

{ "Version": "2012-10-17", "Id": "Key policy created by CloudTrail", "Statement": [ { "Sid": "The key created by CloudTrail to encrypt event data stores. Created ${new Date().toUTCString()}", "Effect": "Allow", "Principal": { "Service": "cloudtrail.amazonaws.com" }, "Action": [ "kms:GenerateDataKey", "kms:Decrypt" ], "Resource": "*" }, { "Sid": "Enable IAM user permissions", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::account-id:root" }, "Action": "kms:*", "Resource": "*" }, { "Sid": "Enable user to have permissions", "Effect": "Allow", "Principal": { "AWS" : "arn:aws:sts::account-id:role-arn" }, "Action": [ "kms:Decrypt", "kms:GenerateDataKey" ], "Resource": "*" } ] }

追蹤的預設KMS金鑰原則

以下是針對您與追蹤搭配使用的預設原則 AWS KMS key 所建立。

注意

該策略包括一個聲明,允許跨帳戶使用密KMS鑰解密日誌文件。

{ "Version": "2012-10-17", "Id": "Key policy created by CloudTrail", "Statement": [ { "Sid": "Enable IAM user permissions", "Effect": "Allow", "Principal": { "AWS": [ "arn:aws:iam::account-id:root", "arn:aws:iam::account-id:user/username" ] }, "Action": "kms:*", "Resource": "*" }, { "Sid": "Allow CloudTrail to encrypt logs", "Effect": "Allow", "Principal": { "Service": "cloudtrail.amazonaws.com" }, "Action": "kms:GenerateDataKey*", "Resource": "*", "Condition": { "StringEquals": { "aws:SourceArn": "arn:aws:cloudtrail:region:account-id:trail/trail-name" }, "StringLike": { "kms:EncryptionContext:aws:cloudtrail:arn": "arn:aws:cloudtrail:*:account-id:trail/*" } } }, { "Sid": "Allow CloudTrail to describe key", "Effect": "Allow", "Principal": { "Service": "cloudtrail.amazonaws.com" }, "Action": "kms:DescribeKey", "Resource": "*" }, { "Sid": "Allow principals in the account to decrypt log files", "Effect": "Allow", "Principal": { "AWS": "*" }, "Action": [ "kms:Decrypt", "kms:ReEncryptFrom" ], "Resource": "*", "Condition": { "StringEquals": { "kms:CallerAccount": "account-id" }, "StringLike": { "kms:EncryptionContext:aws:cloudtrail:arn": "arn:aws:cloudtrail:*:account-id:trail/*" } } }, { "Sid": "Allow alias creation during setup", "Effect": "Allow", "Principal": { "AWS": "*" }, "Action": "kms:CreateAlias", "Resource": "arn:aws:kms:region:account-id:key/key-id", "Condition": { "StringEquals": { "kms:ViaService": "ec2.region.amazonaws.com", "kms:CallerAccount": "account-id" } } }, { "Sid": "Enable cross account log decryption", "Effect": "Allow", "Principal": { "AWS": "*" }, "Action": [ "kms:Decrypt", "kms:ReEncryptFrom" ], "Resource": "*", "Condition": { "StringEquals": { "kms:CallerAccount": "account-id" }, "StringLike": { "kms:EncryptionContext:aws:cloudtrail:arn": "arn:aws:cloudtrail:*:account-id:trail/*" } } } ] }