67 lines
3.4 KiB
Markdown
67 lines
3.4 KiB
Markdown
---
|
||
title: "AWS Source Identity"
|
||
type: concept
|
||
tags: [AWS, Security, IAM, Auditing, FinOps]
|
||
created: 2026-04-26
|
||
updated: 2026-04-26
|
||
sources: [Cloud & DevOps/Public-Cloud-Learning-Sessions/05_FinOps/public-cloud-learning-sessions-budget-control-20240319-160204-meeting-recording.md]
|
||
last_updated: 2026-04-26
|
||
---
|
||
|
||
# AWS Source Identity
|
||
|
||
> **Source Identity** 是 AWS STS(Security Token Service)的一个属性,通过 `sts:SourceIdentity` 在用户假设 IAM 角色时保留原始登录身份,使 CloudTrail 能够追踪联邦登录(Federated Login)跨角色切换的完整用户链。
|
||
|
||
## 定义
|
||
|
||
在 AWS 联邦身份认证场景中,用户通过身份提供商(IdP,如 NetIQ Access Manager)认证后,会假设多个 IAM 角色在不同账户间跳转。**默认情况下,CloudTrail 只记录假设角色后的角色身份,无法追溯到原始登录用户。**
|
||
|
||
Source Identity 通过在 `AssumeRole` 请求中携带 `SourceIdentity` 参数,解决了这一问题:
|
||
|
||
```
|
||
aws sts assume-role \
|
||
--role-arn arn:aws:iam::123456789012:role/MyRole \
|
||
--source-identity alice@example.com
|
||
```
|
||
|
||
## 核心价值
|
||
|
||
| 维度 | 无 Source Identity | 有 Source Identity |
|
||
|------|-------------------|-------------------|
|
||
| 审计追踪 | 只能看到角色身份 | 可见原始用户身份 |
|
||
| FinOps 场景 | 无法关联账户支出到具体用户 | 可将成本责任追溯到个人 |
|
||
| 安全调查 | 难以定位跨角色操作的发起人 | 可完整还原操作路径 |
|
||
| 合规审计 | 不满足最小权限追溯要求 | 满足审计链要求 |
|
||
|
||
## 在 FinOps 中的应用
|
||
|
||
在 [[Budget-Control-Automation]] 场景中,SRE Core 团队通过 Source Identity 实现:
|
||
- **用户维度的成本归因**:通过 CloudTrail + Source Identity 将每个 AWS API 调用关联到具体个人
|
||
- **Top Users 报告**:利用 Cost Explorer 数据 + CloudTrail Source Identity 识别账户内日度支出最高的用户
|
||
- **成本责任到人**:账户 owner 可精确定位哪些团队成员产生了异常支出
|
||
|
||
## 与 AWS 服务的集成
|
||
|
||
- **CloudTrail**:Source Identity 字段记录在 CloudTrail 日志的 `userIdentity` 块中
|
||
- **STS (Security Token Service)**:`AssumeRole`、`AssumeRoleWithSAML`、`AssumeRoleWithWebIdentity` 均支持 Source Identity
|
||
- **Cost Explorer**:结合 Source Identity 数据可实现用户维度的成本分析
|
||
- **AWS Budgets**:告警流程中的 Lambda 函数可查询 CloudTrail Source Identity 数据进行用户归因
|
||
|
||
## 关键约束
|
||
|
||
- Source Identity 只能**设置**,不能**覆盖**:一旦设置为某个值,在当前会话期间无法更改
|
||
- Source Identity 有长度限制(最大 64 字符)
|
||
- 需要 IAM 角色显式授权 `sts:TagSession` 和 `sts:SourceIdentity` 权限才能使用
|
||
- NetIQ Access Manager 等联邦 IdP 需要配置为在假设角色请求中传递 Source Identity
|
||
|
||
## 相关概念
|
||
|
||
- [[CloudTrail]]:AWS 审计日志服务,Source Identity 使其具备跨角色用户追踪能力
|
||
- [[IAM-Roles]]:Source Identity 在角色假设场景中使用
|
||
- [[Federated-Identity]]:联邦身份管理(如 NetIQ),Source Identity 解决其跨角色追踪盲区
|
||
- [[FinOps]]:FinOps 审计和成本归因需要 Source Identity 提供用户级可见性
|
||
|
||
## 来源
|
||
|
||
本概念页基于 [[public-cloud-learning-sessions-budget-control-20240319]](SRE Core 团队 Budget Control 自动化学习分享)中关于 Source Identity 实现细节的记录。
|