每天我都会看到一些未经授权的 KMS 解密操作的 CloudTrail 日志,但我无法弄清楚是什么原因造成的。以下是日志示例:
{
"eventVersion": "1.08",
"userIdentity": {
"type": "AssumedRole",
"principalId": "*********************:LambdaDescribeHandlerSession",
"arn": "arn:aws:sts::************:assumed-role/AWSServiceRoleForConfig/LambdaDescribeHandlerSession",
"accountId": "************",
"accessKeyId": "********************",
"sessionContext": {
"sessionIssuer": {
"type": "Role",
"principalId": ""********************",
"arn": "arn:aws:iam::************:role/aws-service-role/config.amazonaws.com/AWSServiceRoleForConfig",
"accountId": "************",
"userName": "AWSServiceRoleForConfig"
},
"webIdFederationData": {},
"attributes": {
"creationDate": "2021-11-28T12:53:33Z",
"mfaAuthenticated": "false"
}
},
"invokedBy": "config.amazonaws.com"
},
"eventTime": "2021-11-28T12:53:33Z",
"eventSource": "kms.amazonaws.com",
"eventName": "Decrypt",
"awsRegion": "eu-west-1",
"sourceIPAddress": "config.amazonaws.com",
"userAgent": "config.amazonaws.com",
"errorCode": "AccessDenied",
"errorMessage": "User: arn:aws:sts::************:assumed-role/AWSServiceRoleForConfig/LambdaDescribeHandlerSession is not authorized to perform: kms:Decrypt on resource: arn:aws:kms:eu-west-1:************:key/********-****-****-****-************ because no resource-based policy allows the kms:Decrypt action",
"requestParameters": null,
"responseElements": null,
"requestID": "7bb5bcac-29ab-4d03-b2b9-fc9d7125286e",
"eventID": "5308c08c-2f09-4fbe-bd10-32e7aa9ee43c",
"readOnly": true,
"eventType": "AwsApiCall",
"managementEvent": true,
"recipientAccountId": "************",
"eventCategory": "Management"
}
我尝试使用以下内容更新 KMS 政策,但这似乎没有帮助:
{
"Sid": "Grant AWS Config Decrypt Access To Avoid Unauthorised Errors",
"Effect": "Allow",
"Principal": {
"Service": "config.amazonaws.com"
},
"Action": "kms:Decrypt",
"Resource": "*"
}
我检查了 IAM 角色arn:aws:iam::************:role/aws-service-role/config.amazonaws.com/AWSServiceRoleForConfig
,我可以看到这不允许该kms:Decrypt
操作。但是,这是 AWS 的托管角色,我无法更新该策略。
这是 AWS 需要解决的问题吗?是否可以将 Config 切换为使用kms:Decrypt
允许操作的自定义角色?当 AWS 更新托管角色并且我没有向自定义角色添加任何内容时,这是否值得,或者它只会在未来引起更多问题?