aws / aws/amazon-ssm-agent

credentials precedence in release >= 3.2.1297.0

Open
#526 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.2k
Forks
357
PR merge metrics
No merged PRs in 30d

Description

Hi,

I suspect that release **3.2.1297.0** introduced a, perhaps involuntary, change in the credentials precedence logic. What we are experiencing in all our EC2 managed instances is that the agent (for instance when running AWS-RunPatchBaseline) is using the default profile credentials from `/root/.aws/credentials` instead of the EC2 instance profile role. Versions before 3.2.1297.0 were using the instance profile role although there was a `/root/.aws/credentials` present.

To make things more confusing, the [documentation](https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-agent-technical-details.html) states that the precedence should indeed be `/root/.aws/credentials` first and EC2 instance profile role last but only for _"SSM Agent version 3.1.1927.0 or earlier, and for Amazon ECS container instances"_. In our case none of the instances is an ECS container instance and all of them are running amazon-ssm-agent version 3.2.1297.0.

Furthermore, in the same documentation page it is clearly stated that (highlighting is mine)

> **Starting with version 3.2.183.0** of SSM Agent, the agent stores a set of temporary credentials at /var/lib/amazon/ssm/credentials (for Linux and macOS) or %PROGRAMFILES%\Amazon\SSM\credentials (for Windows Server). The temporary credentials have the permissions you specify for the IAM role you chose for Default Host Management Configuration, **or the instance profile attached to your managed node.**

This part of the documentation is not mentioning `/root/.aws/credentials` at all, so I guess starting with version 3.2.183.0 the Default Host Management Configuration or the instance profile role is used.

I understand that the documentation might be out of sync. Nevertheless, releases before **3.2.1297.0** were not using (or not giving higher precedence)`/root/.aws/credentials` but release **3.2.1297.0** does. So my question is first what is the expected behaviour of release **3.2.1297.0** regarding the credentials precedence and second do you believe that the documentation is reflecting this precedence?

Contributor guide

Open the contributing guide

Research direction

Reproduce the credential selection on amazon-ssm-agent 3.2.1297.0 with both /root/.aws/credentials and an EC2 instance profile, then compare it with an earlier version. Trace the credential resolution entry point and review the linked AWS documentation; done means the expected precedence is established and the agent behavior and documentation agree.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, go
Domain
cloud, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.