Source controller support for Instance Metadata Service v2 (IMDSv2) on AWS
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
该 issue 提到了 source-controller 和 minio-go 库,但没有提到任何仓库文件或测试。首先跟踪 S3 Bucket source 的 AWS 凭证设置和 IMDS 请求,然后验证在要求 IMDSv2 的实例上进行 reconciliation,并确认经过 token 身份验证的请求能够消除 401 错误。
由索引模型根据 Issue 内容生成。
描述
I get the following error message in source-controller when Flux is configured to use S3 bucket source,:
{
"level": "error",
"ts": "2022-06-03T13:29:32.250Z",
"logger": "controller.bucket",
"msg": "Reconciler error",
"reconciler group": "source.toolkit.fluxcd.io",
"reconciler kind": "Bucket",
"name": "deploy-bucket",
"namespace": "flux-system",
"error": "failed to confirm existence of 'retracted-flux-1ejashffo6o0p' bucket: 401 Unauthorized"
}
I have created the bucket source with the following command:
flux create source bucket deploy-bucket \
--bucket-name=retracted-flux-1ejashffo6o0p \
--provider=aws \
--endpoint=s3.amazonaws.com \
--region=eu-central-1 \
--interval=5m
.. and receive the following error message:
✚ generating Bucket source
► applying Bucket source
✔ Bucket source created
◎ waiting for Bucket source reconciliation
✗ failed to confirm existence of 'retracted-flux-1ejashffo6o0p' bucket: 401 Unauthorized
It appears that minio-go library uses Instance Metadata Service (IMDS) at 169.254.169.254 to create temporary credentials to access the S3 bucket (from captured traffic):
GET /latest/meta-data/iam/security-credentials/ HTTP/1.1
Host: 169.254.169.254
User-Agent: Go-http-client/1.1
Accept-Encoding: gzip
This is not permitted, because my configuration requires Instance Metadata Service v2 (IMDSv2) since doing so avoids some vulnerabilities:
HTTP/1.1 401 Unauthorized
Content-Length: 0
Date: Fri, 03 Jun 2022 13:29:32 GMT
Server: EC2ws
Connection: close
Content-Type: text/plain
The fix would be to use Instance Metadata Service v2 (IMDSv2) compatible client with the minio-go library. This adds a session token to the requests.
I was able to workaround by creating an IAM user with an access key, then creating the source with--access-key and --secret-key args.
I am running Flux v0.30.2 on EKS with the Kubernetes version v1.21. I have created the IAM policy to access the bucket as instructed by documentation. Instances receive this policy from the instance profile. The access works when tested with AWS CLI aws s3 ls command.
Resources:
- AWS: Use IMDSv2
- aws/containers-roadmap issue EKS: Support for IMDSv2 #930
- 主要语言
- Go
- 星标
- 285
- 派生
- 259
- 平均合并
- 2 天 8 小时
- 30 天内合并 PR
- 11
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
fluxcd/source-controller 的其他 Issue
-
Improve documentation on debugging the controller locally可能重新可做 @Bryandero98 于 33 天前认领,目前没有进行中的 PR。 未关闭area/docs good first issue help wanted
难度 2/5 1-3 小时 新手友好度 82/100
fluxcd/source-controller#666 · 2 条评论 ·
维护者通常 1 天内回复
-
area/oci enhancement
难度 5/5 一周以上 新手友好度 35/100
fluxcd/source-controller#2180 ·
维护者通常 1 天内回复
-
`OCIRepository`/cosign verification: support TSA-only trusted roots (no transparency log) for private Sigstore instances like GitHub Artifact Attestations可能已有人在做 @stealthybox 于 146 天前认领。 未关闭area/oci area/security enhancement
难度 4/5 3-5 天 新手友好度 68/100
fluxcd/source-controller#2167 · 4 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 45/100
fluxcd/source-controller#2150 ·
维护者通常 1 天内回复
-
GitRepository `.spec.ref.commit` + `.spec.ref.branch` does not shallow clone, contrary to the docs未关闭
难度 5/5 一周以上 新手友好度 42/100
fluxcd/source-controller#2146 · 2 条评论 ·
维护者通常 1 天内回复
查看 fluxcd/source-controller 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
oasdiff/oasdiff#1337 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
dataiku/kiji-proxy#635 ·
-
难度 2/5 1-3 小时 新手友好度 67/100
hyperledger-firefly/signer#126 ·
-
agent-review-finding chore
难度 2/5 1-3 小时 新手友好度 73/100
jordansmall/spindrift#5748 ·
维护者通常 1 天内回复