amazon-ssm-agent icon indicating copy to clipboard operation
amazon-ssm-agent copied to clipboard

Session Manager OS-level admin controlled by IAM policies

Open bryanburke opened this issue 8 years ago • 6 comments

We are starting to use Session Manager at my organization, and it is simplifying how we grant direct access to EC2 instances for administrators. However, we also grant unprivileged OS-level access to some users via RDP/SSH. Being able to give those users unprivileged access via Session Manager would further simplify our configuration.

Would it be possible in the future to add IAM integration into Session Manager such that the Agent grants either unprivileged (non-sudo/non-Administrators) or privileged (sudo/Administrators) OS-level access to a connecting user based on an IAM policy?

bryanburke avatar Oct 23 '18 17:10 bryanburke

Hello bryanburke@ Thank you for sharing the feedback! We will explore ways to support this scenario.

munindradas avatar Oct 23 '18 18:10 munindradas

The new Run As Support for Linux Instances (see also: What's New post) appears to partially meet this need, by checking for a specific OS username tag on the IAM user or role. The actual OS user account and whether it is a sudoer or not needs to be provisioned separately.

SSM Agent 2.3.672.0+ supports this new feature.

cflee avatar Jul 10 '19 09:07 cflee

It doesn't look like the resolving OS user from role tagging is actually working. (Tested on 2.3.760.0)

ghost avatar Nov 25 '19 18:11 ghost

@cudandres, would you please help explain how you configured Run As user and what was the outcome. Thanks!

munindradas avatar Nov 26 '19 06:11 munindradas

Digging around more it seems simply to be a matter of waiting for state to update. I configured "Run As default user" and would start session and it behaved as expected. I'd tag an IAM user and it then start a new session and the session would start as with the default user and not the tagged username. I did this a few times and noticed after a ~2-9minutes then the username would resolve to the IAM tag.

I think adding details to the documentation about there being state synchronization you may need to wait for will be useful.

ghost avatar Nov 26 '19 19:11 ghost

IAM is eventual consistent and when you add the tag for RunAs, it takes some time to sync and be effective. Good feedback on updating the documentation, thanks for sharing!

munindradas avatar Nov 26 '19 23:11 munindradas