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

remove Expect: 100-continue header when requesting an IMDSv2 access t… #1766

Merged
merged 1 commit into from Sep 8, 2021

Conversation

kamilJ96
Copy link
Contributor

@kamilJ96 kamilJ96 commented Sep 8, 2021

Relevant Issue (if applicable)

Fixes #1765 by explicitly setting the Expect header to be empty before making the request to retrieve the IMDSv2 token from /latest/api/token

Potentially fixes #1581 as well. Verified on my ec2-instance that the Expect 100 is removed from the request:

Sep  8 10:28:51:      Get IAM Role name
Sep  8 10:28:51: *   Trying 169.254.169.254:80...
Sep  8 10:28:51: * Connected to 169.254.169.254 (169.254.169.254) port 80 (#0)
Sep  8 10:28:51: > PUT /latest/api/token HTTP/1.1
Sep  8 10:28:51: > Host: 169.254.169.254
Sep  8 10:28:51: > User-Agent: s3fs/1.90 (commit hash 9d1552a; OpenSSL)
Sep  8 10:28:51: > Accept: */*
Sep  8 10:28:51: > Transfer-Encoding: chunked
Sep  8 10:28:51: > X-aws-ec2-metadata-token-ttl-seconds: 21600
Sep  8 10:28:51: >
Sep  8 10:28:51: * Signaling end of chunked upload via terminating chunk.
Sep  8 10:28:51: * Mark bundle as not supporting multiuse
Sep  8 10:28:51: * HTTP 1.0, assume close after body
Sep  8 10:28:51: < HTTP/1.0 200 OK
Sep  8 10:28:51: < Content-Length: 56
Sep  8 10:28:51: < Content-Type: text/plain
Sep  8 10:28:51: < Date: Wed, 08 Sep 2021 10:28:51 GMT
Sep  8 10:28:51: < X-Aws-Ec2-Metadata-Token-Ttl-Seconds: 21600
Sep  8 10:28:51: < Connection: close
Sep  8 10:28:51: < Server: EC2ws
Sep  8 10:28:51: <
Sep  8 10:28:51: * Closing connection 0
Sep  8 10:28:51:      HTTP response code 200
Sep  8 10:28:51:      Setting AWS IMDSv2 API token to *********************************

@gaul
Copy link
Member

gaul commented Sep 8, 2021

@nmeyerhans could you test and review this PR?

Copy link
Contributor

@nmeyerhans nmeyerhans left a comment

Choose a reason for hiding this comment

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

Changes look good to me. I can confirm that s3fs does not send a Expect: 100-continue header and it is able to retrieve an IMDS token on both Xen and Nitro instance types with the changes.

@gaul gaul merged commit b4edad8 into s3fs-fuse:master Sep 8, 2021
@gaul
Copy link
Member

gaul commented Sep 8, 2021

@kamilJ96 Thank you for your contribution!

@nmeyerhans Thank you for testing and reviewing!

@gaul
Copy link
Member

gaul commented Sep 8, 2021

@kamilJ96 kamilJ96 deleted the imdsv2-token-expect-header branch September 8, 2021 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants