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

s3auth file doesn't work for provided credentials. #48

Open
stephen-m-shubin opened this issue Sep 27, 2019 · 6 comments
Open

s3auth file doesn't work for provided credentials. #48

stephen-m-shubin opened this issue Sep 27, 2019 · 6 comments

Comments

@stephen-m-shubin
Copy link

stephen-m-shubin commented Sep 27, 2019

When setting: AccessKeyId and SecretAccessKey in /etc/apt/s3auth.conf we are greeted with the following error:

root/# apt-get update
Region: us-west-2
Using config file for credentials
Traceback (most recent call last):
  File "/usr/lib/apt/methods/s3", line 551, in <module>
    method = S3_method(config)
  File "/usr/lib/apt/methods/s3", line 364, in __init__
    self.iam.get_credentials()
  File "/usr/lib/apt/methods/s3", line 171, in get_credentials
    self.token = data['Token']
  File "/usr/lib/python2.7/dist-packages/configobj.py", line 554, in __getitem__
    val = dict.__getitem__(self, key)
KeyError: 'Token'

I have validated the key(s) are valid and have access.

Now I've tried this with IAM permissions assigned to an EC2 instance and that works as expected, only when I set the keys in the config do things not work as expected.

Glancing through the code it doesn't appear as though the token never gets called/created in that particular scenario. In fact the only two ways I ever see the session token being assigned is when it's read from the ENV Var:

        if data.get("AccessKeyId") is None:
            data['AccessKeyId'] = os.environ.get("AWS_ACCESS_KEY_ID", None)
            data['SecretAccessKey'] = os.environ.get(
                "AWS_SECRET_ACCESS_KEY", None)
            data['Token'] = os.environ.get("AWS_SESSION_TOKEN", None)

OR it's attempted to connect locally (when in AWS and IAM is assigned to the instance):

        if data.get("AccessKeyId") is None:
            self.__get_role()
            data = self.__request_json(urllib.parse.urljoin(self.credentials_metadata,
                                                            self.iamrole))

keep in mind my Python knowledge is minimal and this is from the best I can figure out, unless there is something I messed up on my end (possibly) however I'm just not finding out where exactly it's hung up.

Thanks,
Stephen

@greg-plume
Copy link

greg-plume commented Oct 30, 2019

This is my working /etc/apt/s3.auth.conf file, note where values are quoted and where they are not quoted:

AccessKeyId = AKIAEXAMPLEEXAMPLE
SecretAccessKey = EXAMpleEXAMpleEXAMPLEexample
Region = 'us-west-2'
Token = ''

Yes, the "Token" parameter seems to be necessary, even if it's not being used. This is consistent with the "Region" parameter and not consistent with the "AccessKeyId" and "SecretAccessKey" parameters.

@jikawa-az
Copy link

Hello, I see that the next release addressing this issue has been tagged 7 days ago:
https://github.com/MayaraCloud/apt-transport-s3/releases/tag/v2.1.0

However it doesn't appear to have been released since apt-get is still vending 2.0.0.
Can we please have this version released as soon as possible? Thank you!!
@vorlock

@vorlock
Copy link
Member

vorlock commented Apr 20, 2021

It can be release in the next couple of days in here after a bit more testing by people, but it won't find it's way to Debian anytime soon as Debian is in deep freeze we're probably around a month from the release, so it will have to wait a bit before I'm going to upload it to Debian archive.

@jikawa-az
Copy link

Understood, thanks for the update!

@jikawa-az
Copy link

Hello, any updates on this release?

@jikawa-az
Copy link

@vorlock Bump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants