Ensure amazon-ssm-agent is up-to-date if present #1519
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes:
In the original PR (#1501), the intention was to optimize the AMI build process by avoiding the reinstallation of the
amazon-ssm-agent
if it was already installed. The original logic was sound for its purpose—there's no need to install something that's already there. However, this introduced a regression: the script no longer ensured that theamazon-ssm-agent
was updated to the latest version if it was pre-installed in the upstream AMI. The downstream effect of this change was that any AMIs built from this script inadvertently shipped with an out-of-date version of theamazon-ssm-agent
, version3.2.1705.0-1
, which contains several CVEs, including ALAS-2023-2303.This change retain the efficiency of not re-installing the agent unnecessarily while addressing the packing regression. The yum update command will pull the latest version from the repositories, ensuring that the secure version, amazon-ssm-agent 3.2.1705.0-1.amzn2, is correctly shipped as before the regression occurred.
Testing Done
On the latest AMI
amazon-eks-node-1.25-v20231116
running the upgrade command for theamazon-ssm-agent
correctly installs the3.2.1705.0-1.amzn2
version of the package which has the latest security updates.