Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk patch aws/aws-sdk-go-v2 dependencies #1395

Merged
merged 2 commits into from
Nov 28, 2024

Conversation

leighlondon
Copy link
Contributor

Fixes #

Requirements

All new code should be covered with tests, documentation should be updated. CI should pass.

Description of the Change

Updates the github.com/aws/aws-sdk-go-v2/... dependencies due to a failing authentication issue when trying the most recent builds.

Checklist

  • unit-test added (if change is algorithm)
  • functional test added/updated (if change is functional)
  • man page updated (if applicable)
  • bash completion updated (if applicable)
  • documentation updated
  • author name in AUTHORS

@neolynx
Copy link
Member

neolynx commented Nov 20, 2024

could you share more about the failing authentication issue ?

would be great if the CI tests would catch this, as it uses real S3 for testing...

@sf-nwaller
Copy link
Contributor

sf-nwaller commented Nov 21, 2024

@neolynx I saw the same issue and it was specific to EC2 IMDS (perhaps isolated to IMDSv2) combined with publish to S3. Maybe your CI tests publish to S3 but aren't using EC2 IMDS to obtain the access keys?

The error is reproducible on an EC2 instance (or a container image running on an EC2 instance) with IMDSv2 enabled, and no specific IAM policies required. The error happens before IAM policy policy evaluation. The issue is explained very well here:

aws/aws-sdk-go-v2#2370 (comment)

Steps To Reproduce

Using a container is recommended, but not required.

docker run --rm -ti ubuntu:22.04

The issue can be reproduced consistently.

# Prepare to install Aptly
apt-get update && apt-get -y install wget jq
wget -O /etc/apt/keyrings/aptly.asc https://www.aptly.info/pubkey.txt
cat <(echo "deb [signed-by=/etc/apt/keyrings/aptly.asc] http://repo.aptly.info/ci jammy main") > /etc/apt/sources.list.d/aptlyci.list

# actually install Aptly
apt-get update && apt-get -y install aptly

# create a repo and the default aptly.conf
aptly repo create test

# add S3PublishEndpoints to aptly.conf
cp ~/.aptly.conf ~/.aptly.conf.orig
jq '.S3PublishEndpoints={"test":{"region":"us-east-1","bucket":"dontcare"}}' ~/.aptly.conf.orig > ~/.aptly.conf

# attempt to publish repo
aptly publish repo -architectures=amd64 -distribution=test -skip-signing test s3:test:

The following error is observed

Warning: publishing from empty source, architectures list should be complete, it can't be changed after publishing (use -architectures flag)
Loading packages...
Generating metadata files and linking package files...
Finalizing metadata files...
ERROR: unable to publish: unable to publish file: error uploading /tmp/aptly1351411402/main_binary-amd64_Packages to S3: us-east-1:dontcare/: operation error S3: PutObject, get identity: get credentials: failed to refresh cached credentials, no EC2 IMDS role found, not found, Signing

I would highlight this part of the error message in particular:

get credentials: failed to refresh cached credentials, no EC2 IMDS role found, not found, Signing

Despite the error message, EC2 IMDS is indeed available.

root@eb7e71c33e06:/# apt-get -y install cloud-utils
root@eb7e71c33e06:/# ec2metadata --instance-type
c6a.2xlarge

Version under test

root@eb7e71c33e06:/# aptly version
aptly version: 1.6.0~rc1+20241117171302.763b810c

root@eb7e71c33e06:/# apt-cache policy aptly
aptly:
  Installed: 1.6.0~rc1+20241117171302.763b810c

@neolynx neolynx self-assigned this Nov 21, 2024
Copy link
Member

@neolynx neolynx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for explaining !

the aptly test are not using EC2 IMDS, and I think it would be too complicated to setup, as it is a upstream bug...

@neolynx neolynx marked this pull request as ready for review November 28, 2024 12:56
@neolynx neolynx merged commit b7e91f0 into aptly-dev:master Nov 28, 2024
41 checks passed
@leighlondon leighlondon deleted the patching-aws-sdk-go-v2 branch November 28, 2024 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants