-
-
Save jespereneberg/14627fa9b9a94fef40f80cf16145cffe to your computer and use it in GitHub Desktop.
KMS policy for cross account org usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Id": "key-consolepolicy-4", | |
"Statement": [ | |
{ | |
"Sid": "Enable IAM User Permissions", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "arn:aws:iam::${AWS::AccountId}:root" | |
}, | |
"Action": "kms:*", | |
"Resource": "*" | |
}, | |
{ | |
"Sid": "Allow access for Key Administrators", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "arn:aws:iam::${AWS::AccountId}:role/${your admin role you use}" | |
}, | |
"Action": [ | |
"kms:Create*", | |
"kms:Describe*", | |
"kms:Enable*", | |
"kms:List*", | |
"kms:Put*", | |
"kms:Update*", | |
"kms:Revoke*", | |
"kms:Disable*", | |
"kms:Get*", | |
"kms:Delete*", | |
"kms:ScheduleKeyDeletion", | |
"kms:CancelKeyDeletion", | |
"kms:TagResource", | |
"kms:UntagResource" | |
], | |
"Resource": "*" | |
}, | |
{ | |
"Sid": "Allow use of the key", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": [ | |
"arn:aws:iam::${AWS::AccountId}:role/KeyRotationLambdaRole", | |
"arn:aws:iam::${AWS::AccountId}:role/${your admin role you use}" | |
] | |
}, | |
"Action": [ | |
"kms:Encrypt", | |
"kms:Decrypt", | |
"kms:ReEncrypt*", | |
"kms:GenerateDataKey*", | |
"kms:DescribeKey" | |
], | |
"Resource": "*" | |
}, | |
{ | |
"Sid": "Allow attachment of persistent resources", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "arn:aws:iam::${AWS::AccountId}:role/${your admin role you use}" | |
}, | |
"Action": [ | |
"kms:CreateGrant", | |
"kms:ListGrants", | |
"kms:RevokeGrant" | |
], | |
"Resource": "*", | |
"Condition": { | |
"Bool": { | |
"kms:GrantIsForAWSResource": "true" | |
} | |
} | |
}, | |
{ | |
"Sid": "Allow use of the key cross account for smtp secrets manager", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "*" | |
}, | |
"Action": [ | |
"kms:Decrypt", | |
"kms:DescribeKey", | |
"kms:Encrypt", | |
"kms:ReEncrypt*", | |
"kms:GetKeyPolicy" | |
], | |
"Resource": "*", | |
"Condition": { | |
"StringEquals": { | |
"aws:PrincipalOrgID": "${YOUR-ORG-ID from organisations}" | |
} | |
} | |
}, | |
{ | |
"Sid": "Allow access through AWS Secrets Manager for all principals in the account that are authorized to use AWS Secrets Manager", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "*" | |
}, | |
"Action": [ | |
"kms:Encrypt", | |
"kms:Decrypt", | |
"kms:ReEncrypt*", | |
"kms:GenerateDataKey*", | |
"kms:CreateGrant", | |
"kms:DescribeKey" | |
], | |
"Resource": "*", | |
"Condition": { | |
"StringEquals": { | |
"kms:CallerAccount": "${AWS::AccountId}", | |
"kms:ViaService": "secretsmanager.${AWS::Region}.amazonaws.com" | |
} | |
} | |
}, | |
{ | |
"Sid": "Allow direct access to key metadata to the account", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "arn:aws:iam::${AWS::AccountId}:root" | |
}, | |
"Action": [ | |
"kms:Describe*", | |
"kms:Get*", | |
"kms:List*", | |
"kms:RevokeGrant" | |
], | |
"Resource": "*" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment