부록 G. STS에서 특성 기반 액세스 제어에 세션 태그를 사용하는 예
다음 목록에는 STS의 특성 기반 액세스 제어(ABAC)에 대한 세션 태그 사용 예가 나와 있습니다.
웹 토큰의 Keycloak에서 전달하는 세션 태그의 예
{ "jti": "947960a3-7e91-4027-99f6-da719b0d4059", "exp": 1627438044, "nbf": 0, "iat": 1627402044, "iss": "http://localhost:8080/auth/realms/quickstart", "aud": "app-profile-jsp", "sub": "test", "typ": "ID", "azp": "app-profile-jsp", "auth_time": 0, "session_state": "3a46e3e7-d198-4a64-8b51-69682bcfc670", "preferred_username": "test", "email_verified": false, "acr": "1", "https://aws.amazon.com/tags": [ { "principal_tags": { "Department": [ "Engineering", "Marketing" ] } } ], "client_id": "app-profile-jsp", "username": "test", "active": true }
{
"jti": "947960a3-7e91-4027-99f6-da719b0d4059",
"exp": 1627438044,
"nbf": 0,
"iat": 1627402044,
"iss": "http://localhost:8080/auth/realms/quickstart",
"aud": "app-profile-jsp",
"sub": "test",
"typ": "ID",
"azp": "app-profile-jsp",
"auth_time": 0,
"session_state": "3a46e3e7-d198-4a64-8b51-69682bcfc670",
"preferred_username": "test",
"email_verified": false,
"acr": "1",
"https://aws.amazon.com/tags": [
{
"principal_tags": {
"Department": [
"Engineering",
"Marketing"
]
}
}
],
"client_id": "app-profile-jsp",
"username": "test",
"active": true
}
Copy to clipboardCopiedaws:RequestTag
의 예
{ "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":["sts:AssumeRoleWithWebIdentity","sts:TagSession"], "Principal":{"Federated":["arn:aws:iam:::oidc-provider/localhost:8080/auth/realms/quickstart"]}, "Condition":{"StringEquals":{"aws:RequestTag/Department":"Engineering"}} }] }
{
"Version":"2012-10-17",
"Statement":[
{
"Effect":"Allow",
"Action":["sts:AssumeRoleWithWebIdentity","sts:TagSession"],
"Principal":{"Federated":["arn:aws:iam:::oidc-provider/localhost:8080/auth/realms/quickstart"]},
"Condition":{"StringEquals":{"aws:RequestTag/Department":"Engineering"}}
}]
}
Copy to clipboardCopiedaws:PrincipalTag
의 예
{ "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":["s3:*"], "Resource":["arn:aws:s3::t1tenant:my-test-bucket","arn:aws:s3::t1tenant:my-test-bucket/*],"+ "Condition":{"StringEquals":{"aws:PrincipalTag/Department":"Engineering"}} }] }
{
"Version":"2012-10-17",
"Statement":[
{
"Effect":"Allow",
"Action":["s3:*"],
"Resource":["arn:aws:s3::t1tenant:my-test-bucket","arn:aws:s3::t1tenant:my-test-bucket/*],"+
"Condition":{"StringEquals":{"aws:PrincipalTag/Department":"Engineering"}}
}]
}
Copy to clipboardCopiedaws:ResourceTag
예
{ "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":["sts:AssumeRoleWithWebIdentity","sts:TagSession"], "Principal":{"Federated":["arn:aws:iam:::oidc-provider/localhost:8080/auth/realms/quickstart"]}, "Condition":{"StringEquals":{"iam:ResourceTag/Department":"Engineering"}}1 }] }
{
"Version":"2012-10-17",
"Statement":[
{
"Effect":"Allow",
"Action":["sts:AssumeRoleWithWebIdentity","sts:TagSession"],
"Principal":{"Federated":["arn:aws:iam:::oidc-provider/localhost:8080/auth/realms/quickstart"]},
"Condition":{"StringEquals":{"iam:ResourceTag/Department":"Engineering"}}1
}]
}
Copy to clipboardCopiedaws:TagKeys
의 예
{ "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":["sts:AssumeRoleWithWebIdentity","sts:TagSession"], "Principal":{"Federated":["arn:aws:iam:::oidc-provider/localhost:8080/auth/realms/quickstart"]}, "Condition":{"ForAllValues:StringEquals":{"aws:TagKeys":["Marketing,Engineering"]}}1 }] }
{
"Version":"2012-10-17",
"Statement":[
{
"Effect":"Allow",
"Action":["sts:AssumeRoleWithWebIdentity","sts:TagSession"],
"Principal":{"Federated":["arn:aws:iam:::oidc-provider/localhost:8080/auth/realms/quickstart"]},
"Condition":{"ForAllValues:StringEquals":{"aws:TagKeys":["Marketing,Engineering"]}}1
}]
}
Copy to clipboardCopied- 1
ForAllValues:StringEquals
는 요청의 모든 태그 키가 정책의 태그 키 서브 세트인지 여부를 테스트합니다. 따라서 조건은 요청에 전달된 태그 키를 제한합니다.
s3:ResourceTag
의 예
{ "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":["s3:PutBucketTagging"], "Resource":["arn:aws:s3::t1tenant:my-test-bucket\","arn:aws:s3::t1tenant:my-test-bucket/*"] }, { "Effect":"Allow", "Action":["s3:*"], "Resource":["*"], "Condition":{"StringEquals":{"s3:ResourceTag/Department":\"Engineering"}}1 } }
{
"Version":"2012-10-17",
"Statement":[
{
"Effect":"Allow",
"Action":["s3:PutBucketTagging"],
"Resource":["arn:aws:s3::t1tenant:my-test-bucket\","arn:aws:s3::t1tenant:my-test-bucket/*"]
},
{
"Effect":"Allow",
"Action":["s3:*"],
"Resource":["*"],
"Condition":{"StringEquals":{"s3:ResourceTag/Department":\"Engineering"}}1
}
}
Copy to clipboardCopied- 1
- 위의 작업이 수행되려면 이 정책을 적용하려는 버킷 또는 오브젝트에 'Department=Engineering' 태그를 첨부해야 합니다.
aws:RequestTag
와 iam:ResourceTag
의 예
{ "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":["sts:AssumeRoleWithWebIdentity","sts:TagSession"], "Principal":{"Federated":["arn:aws:iam:::oidc-provider/localhost:8080/auth/realms/quickstart"]}, "Condition":{"StringEquals":{"aws:RequestTag/Department":"${iam:ResourceTag/Department}"}}1 }] }
{
"Version":"2012-10-17",
"Statement":[
{
"Effect":"Allow",
"Action":["sts:AssumeRoleWithWebIdentity","sts:TagSession"],
"Principal":{"Federated":["arn:aws:iam:::oidc-provider/localhost:8080/auth/realms/quickstart"]},
"Condition":{"StringEquals":{"aws:RequestTag/Department":"${iam:ResourceTag/Department}"}}1
}]
}
Copy to clipboardCopied- 1
- 이는 들어오는 요청의 태그와 역할에 연결된 태그를 일치시켜 역할을 가정하기 위한 것입니다.
AWS:RequestTag
는 JSON 웹 토큰(JWT)에서 들어오는 태그이며iam:ResourceTag
는 가정되는 역할에 연결된 태그입니다.
s3:ResourceTag
가 있는 aws:PrincipalTag
의 예
{ "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":["s3:PutBucketTagging"], "Resource":["arn:aws:s3::t1tenant:my-test-bucket\","arn:aws:s3::t1tenant:my-test-bucket/*"] }, { "Effect":"Allow", "Action":["s3:*"], "Resource":["*"], "Condition":{"StringEquals":{"s3:ResourceTag/Department":"${aws:PrincipalTag/Department}"}}1 } }
{
"Version":"2012-10-17",
"Statement":[
{
"Effect":"Allow",
"Action":["s3:PutBucketTagging"],
"Resource":["arn:aws:s3::t1tenant:my-test-bucket\","arn:aws:s3::t1tenant:my-test-bucket/*"]
},
{
"Effect":"Allow",
"Action":["s3:*"],
"Resource":["*"],
"Condition":{"StringEquals":{"s3:ResourceTag/Department":"${aws:PrincipalTag/Department}"}}1
}
}
Copy to clipboardCopied- 1
- 이는 S3 리소스 태그와 주체 태그를 일치시켜 역할 권한 정책을 평가합니다.
AWS:PrincipalTag
는 임시 자격 증명과 함께 전달되는 태그이고s3:ResourceTag
는 오브젝트 또는 버킷인 S3 리소스에 연결된 태그입니다.