跳至內容

Support for programmatically terminating active sessions from permission sets

0

Currently it is only possible to terminate active sessions for permission sets via the UI. This prevents using necessary automations to ensure permission set assignments do not have a dangling session and are brought to least privilege. When we can get support for allowing a programmatic solution here?

Thanks!

已提問 4 個月前檢視次數 96 次
1 個回答
0

When working with IAM Identity Center (formerly AWS SSO), there currently isn't a direct API method to programmatically terminate active sessions for permission sets specifically.

For IAM roles, you can programmatically revoke active sessions by attaching the AWSRevokeOlderSessions policy to the role, which denies access to users who assumed the role before a specific time. This can be done through the AWS CLI or SDK.

For SSM sessions, you can programmatically terminate them using the ssm:TerminateSession action. You can create policies that allow users to terminate their own sessions by using policy variables like ${aws:userid} in the resource element:

{
"Effect": "Allow",
"Action": "ssm:TerminateSession",
"Resource": "arn:aws:ssm:*:*:session/${aws:userid}-*"
}

For IAM Identity Center users, you would use ${aws:userid} instead of ${aws:username} in your policies, as the latter isn't available for federated users.

Regarding automation for removing disabled users and their permission sets, you could implement a solution using AWS Lambda that periodically checks for disabled users in IAM Identity Center and programmatically removes their permission set assignments. However, this doesn't directly terminate active sessions.

AWS hasn't announced when programmatic termination of active sessions for permission sets will be supported. For now, you'll need to rely on the UI for this specific functionality or implement workarounds using existing APIs.
Sources
Policy variable for IAM Identity Center user | AWS re:Post
Removal of user and permission sets | AWS re:Post
Revoke IAM role temporary security credentials - AWS Identity and Access Management
End a session - AWS Systems Manager

已回答 4 個月前
AWS
支援工程師
已審閱 4 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。