监控临时安全凭证
在华为云中执行操作时,有关调用日志可以记录到CTS中供账号管理员监控。管理员可以在配置信任委托时,要求调用AssumeAgency API时传递一个自定义字符串来标识在华为云中执行操作的人员或应用程序。这个字符串作为源身份(Source Identity)信息存储在CTS中。当管理员查看CTS中的活动时,可以通过源身份信息确定是谁切换了信任委托来执行了操作。
源身份信息设置后,会在该信任委托会话期间执行的任何华为云操作请求中存在。通过AssumeAgency API使用一个信任委托切换到另一个信任委托(称为委托链)时,源身份信息在第一次设置后便不可更改,该值会持续传递。管理员可以根据源身份的存在或值配置身份策略,以进一步控制使用信任委托执行的华为云操作。您可以决定是否必须使用该属性以及可以使用什么值。
设置源身份信息所需要的权限
sts::setSourceIdentity
- 在IAM用户切换信任委托的场景中,要指定源身份信息,IAM用户的身份策略和信任委托的信任策略都必须包含sts::setSourceIdentity权限。
- 在信任委托切换信任委托的场景中,要指定源身份信息,发起切换的信任委托的身份策略和目标信任委托的信任策略都必须包含sts::setSourceIdentity权限。
{
"Version": "5.0",
"Statement": [{
"Effect": "Allow",
"Action": [
"sts:agencies:assume",
"sts::setSourceIdentity"
],
"Condition": {
"StringEquals": {
"sts:SourceIdentity": [
"${g:UserName}"
]
}
}
}]
}
{
"Version": "5.0",
"Statement": [{
"Effect": "Allow",
"Action": [
"sts:agencies:assume",
"sts::setSourceIdentity"
],
"Condition": {
"StringEquals": {
"sts:SourceIdentity": [
"${g:UserName}"
]
}
}
}]
}
调用AssumeAgency API时传递源身份信息,参见通过委托或者信任委托获取临时安全凭证中的source_identity参数。
在CTS中查看源身份信息
{
"api_version": "v5",
"code": "204",
"account_id": "xxxxxx",
"event_type": "global",
"message": "xxxxxx",
"operation_id": "DeleteUserV5",
"project_id": "xxxxxx",
"read_only": false,
"request_id": "xxxxxx",
"resource_account_id": "xxxxxx",
"resource_id": "xxxxxx",
"resource_name": "xxxxxx",
"resource_type": "user",
"service_type": "IAM",
"source_ip": "xxx.xxx.xxx.xxx",
"trace_id": "xxxxxx",
"trace_name": "deleteUserV5",
"trace_rating": "normal",
"trace_type": "ApiCall",
"tracker_name": "system",
"user_agent": "xxxxxx",
"is_consistent": true,
"user": {
"access_key_id": "xxxxxx",
"account_id": "xxxxxx",
"domain": {
"id": "xxxxxx",
"name": "xxxxxx"
},
"name": "xxxxxx/test",
"principal_id": "xxxxxx:name",
"principal_urn": "sts::xxxxxx:assumed-agency:test/name",
"session_context": {
"assumed_by": {
"principal_id": "xxxxxx"
},
"attributes": {
"created_at": "xxxxxx",
"mfa_authenticated": "false"
},
"source_identity": "IAM User A"
},
"type": "AssumedAgency"
},
"response": "null",
"time": xxxxxx,
"record_time": xxxxxx
}