Re-evaluate amazon-ssm-agent.rpm GPG key
It's been a while since you last closed the same request without giving any reason, so I'd like to revive that one as it is still valid (or at least should be to security aware people): Kudos go to @ferricoxide
Please gpg-sign amazon-ssm-agent.rpm for gpg-check-enabled yum For reasons please see #28 and have the evil internet in mind
Cross-reference: #28 #161 #3
Thanks for your interest about amazon ssm agent. We’ll work on this feature request.
Thanks for your interest about amazon ssm agent. We’ll work on this feature request.
Cool. I don't like having to put my PGP key on a package produced by someone else. Yeah, it gets me past our security settings, but isn't exactly a kosher way to do so.
Do you have a status update on this? We would like to use the amazon ssm agent to utilize the system manager services however we need the agent to be signed.
Really need resolution to this (other than "summarily close without fixing or providing valid reason for closing").
We're starting to roll onto EL8 AMIs/EC2s. Our security requirements dictate that we enable FIPS-mode on our EC2s. However, EL8 is more strict about RPM-signing than FIPS-mode on EL7 was. Now, when attempting to install the SSM Agent from the download URL, yum/dnf aborts the installation with the following error:
# yum install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm
Last metadata expiration check: 0:25:39 ago on Wed 29 Apr 2020 05:54:15 PM UTC.
amazon-ssm-agent.rpm 43 MB/s | 31 MB 00:00
Dependencies resolved.
================================================================================================================================================================
Package Architecture Version Repository Size
================================================================================================================================================================
Installing:
amazon-ssm-agent x86_64 2.3.978.0-1 @commandline 31 M
Transaction Summary
================================================================================================================================================================
Install 1 Package
Total size: 31 M
Installed size: 119 M
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Error: Transaction check error:
package amazon-ssm-agent-2.3.978.0-1.x86_64 does not verify: no digest
Another +1 asking for valid signatures on packages you produce.
I know this is not a resolution to the problem in this issue or #28, but you can use the AL2 repo and include a package whitelist, and those packages are signed. I did a very crude comparison of the AL2 repo against the others to see the unique packages and pulled out the ones specific to "amazon", "aws", or "ec2". I removed packages that simply don't install in CentOS 8.
The following is from a CentOS 8 container:
dnf -y install 'dnf-command(download)' epel-release
dnf -y install distribution-gpg-keys
rpm --import /usr/share/distribution-gpg-keys/amazon-linux/RPM-GPG-KEY-amazon-linux-2
cat > /etc/yum.repos.d/amzn2-core.repo <<'EOF'
[amzn2-core]
name=Amazon Linux 2 core repository
mirrorlist=http://amazonlinux.default.amazonaws.com/2/core/latest/$basearch/mirror.list
gpgcheck=1
gpgkey=file:///usr/share/distribution-gpg-keys/amazon-linux/RPM-GPG-KEY-amazon-linux-2
enabled=1
# Package whitelist for use outside of Amazon Linux
includepkgs=amazon-cloudwatch-agent \
amazon-efs-utils \
amazon-ssm-agent \
aws-amitools-ec2 \
aws-apitools-as \
aws-apitools-cfn \
aws-apitools-common \
aws-apitools-ec2 \
aws-apitools-elb \
aws-kinesis-agent \
ec2-hibinit-agent \
ec2-instance-connect \
ec2-net-utils \
ec2-utils \
ec2sys-autotune
EOF
dnf download amazon-ssm-agent
rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} %{SIGPGP:pgpsig} %{SIGGPG:pgpsig}\n' -p amazon-ssm-agent*.rpm
The last command returns:
amazon-ssm-agent-2.3.1319.0-1.amzn2 RSA/SHA256, Fri 10 Jul 2020 11:42:57 PM UTC, Key ID 11cf1f95c87f5b1a (none)
Disclaimer: I have not run this in production, and even if I did, I would likely only trust installing the Golang-based utilities due to others potentially having dynamic-linking issues.
Also, don't try this for CentOS 7; its version of libcurl used with yum is too old (https://github.com/aws/containers-roadmap/issues/160#issuecomment-462447943).
Seeing this issue when trying to install SSM Agent through Ansible on RHEL8 AMI.
Ansible Code:
...
- name: Install / update SSM Agent
yum:
name: https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm
state: latest
...
When running ansible code:
...
TASK [Install / update SSM Agent] ************************************************************************************************************************************************
fatal: [127.0.0.1]: FAILED! => {"changed": false, "msg": "Failed to validate GPG signature for amazon-ssm-agent-2.3.1644.0-1.x86_64"}
...
OS Info:
cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="8.2 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.2"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.2 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8.2:GA"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.2
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.2"
Work around: Add disable_gpg_check: yes to yum stanza in Ansible Playbook.
We recently released a feature to verify SSM Agent signtures. See https://docs.aws.amazon.com/systems-manager/latest/userguide/verify-agent-signature.html
Closing.
We recently released a feature to verify SSM Agent signtures. See https://docs.aws.amazon.com/systems-manager/latest/userguide/verify-agent-signature.html
Closing.
Has this actually been validated to work on a fully-hardened Enterprise Linux system? I know that where I'd particularly run into RPM-signing issues was on fully-hardened EL (FIPS-mode enabled) since the signing was done with an invalid signature-algorithm for the envelope. Unfortunately, been so long since I encountered the error, can't remember if it was this package or a different one (just remember that AWS had been using elderly keys for package-signing that cause the validation-error)
Looking at the full signature for the key:
$ rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} %{SIGPGP:pgpsig} %{SIGGPG:pgpsig}\n' -p amazon-ssm-agent.rpm
amazon-ssm-agent-3.0.655.0-1 RSA/SHA1, Fri Jan 22 20:25:30 2021, Key ID 54f4f56e693eca21 (none)
This signature may not work on FIPS-enabled EL8: see the "Disabled in the FIPS policy in addition to the DEFAULT policy" section of Red Hat Article #3642912.
Hello,
This whole verification is very cumbersome! Couldn't you provide a public key URL? This thing does not play well bundled in an Ansible role.
Thanks.
Hello,
This whole verification is very cumbersome! Couldn't you provide a public key URL? This thing does not play well bundled in an Ansible role.
Thanks.
agree too, wondering if the gpg key is shipped somewhere so that we can use URL wherever required.
Certainly would be nice if https://docs.aws.amazon.com/systems-manager/latest/userguide/verify-agent-signature.html mentioned here is also a Public Parameter that holds the key. /aws/service/ssm-agent/latest/public-key
(yes, I left feedback on that page. Commenting here for visibility of others running into this)