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

Explore No-Credentials "Authentication" For Blocking Misbehaving Clients #197

Closed
BenTheElder opened this issue Mar 23, 2023 · 7 comments
Closed
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/backlog Higher priority than priority/awaiting-more-evidence. sig/k8s-infra Categorizes an issue or PR as relevant to SIG K8s Infra.

Comments

@BenTheElder
Copy link
Member

BenTheElder commented Mar 23, 2023

Unfortunately the OCI Distribution spec doesn't talk much about auth, however it's relatively common to require obtaining an auth token even for public read registries that don't otherwise require credentials from the client. Roughly: Clients ping /v2/, receive 401, and fetch a token scoped to the image, which is used in subsequent API calls within a pull. Tokens don't cross redirects.

We could phase in some relatively cheap token handler just to make it easier to reject poorly behaved clients automatically.

E.G. perhaps we could simply encrypt the image scope and current time with a key common to all instances and require a valid and sufficiently recently signed value in order to make API calls.

I'm not sure this is a good idea yet, but we've been getting a ton of /v2/$image/list? calls for images we don't host,from an Artifactory client that does not appear to every hit /v2/ or other APIs (it does request various /.jfrog/....) which had me thinking:

  • we could try to reach out to the user
  • we could configure cloud armor to block this misconfigured instance

.... but none of those scale to the next N instances, and we don't want people regularly poking around the logs anyhow. I'm only looking at our logs currently as part of monitoring https://kubernetes.io/blog/2023/03/10/image-registry-redirect/

NOTE: This needs to wait until after the Code Freeze #181 , but going ahead and filing this so we're tracking.

cc @jonjohnsonjr

/sig k8s-infra
/kind feature

@k8s-ci-robot k8s-ci-robot added sig/k8s-infra Categorizes an issue or PR as relevant to SIG K8s Infra. kind/feature Categorizes issue or PR as related to a new feature. labels Mar 23, 2023
@ameukam
Copy link
Member

ameukam commented Mar 23, 2023

/milestone v1.28
/priority backlog

@k8s-ci-robot k8s-ci-robot added the priority/backlog Higher priority than priority/awaiting-more-evidence. label Mar 23, 2023
@BenTheElder
Copy link
Member Author

To clarify: we currently never require an auth token of any sort, which is unusual and limiting for future direction, but supported. See the request handling doc.

@BenTheElder
Copy link
Member Author

BenTheElder commented Mar 30, 2023

... And all major clients handle the no-credentials auth workflow, it's required for most major registries. GCR/AR are seemingly unusual in permitting public read with truly no auth if configured for public read (and registry.k8s.io currently). cc @jonjohnsonjr 🙏

GCR/AR under normal usage serve 401 at /v2/ and have a token request.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 28, 2023
@BenTheElder BenTheElder added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Sep 13, 2023
@BenTheElder
Copy link
Member Author

cc @sftim per prior conversation: if we combined this (pseudo-auth at the root of image download request) + only allow signed URLs to backing hosts we could put ourselves more in control of rate limits / spam blocking.

will file another issue for signed-urls

@sftim
Copy link

sftim commented Mar 27, 2024

We'd certainly have more visibility over requests if we do that.

@BenTheElder
Copy link
Member Author

We block a lot of nonsense now by way of the WAF only accepting requests with valid API paths.

We could switch to signed URLs without doing this change, but doing this change would also make it slightly more straightforward to track pulls.

On balance, I don't think this is worthwhile. However we should consider #278 or #194

@github-project-automation github-project-automation bot moved this from Backlog to Reporting, Audit & Logging in registry.k8s.io (SIG K8S Infra) Jul 25, 2024
@BenTheElder BenTheElder reopened this Jul 25, 2024
@BenTheElder BenTheElder closed this as not planned Won't fix, can't repro, duplicate, stale Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/backlog Higher priority than priority/awaiting-more-evidence. sig/k8s-infra Categorizes an issue or PR as relevant to SIG K8s Infra.
Projects
Status: Reporting, Audit & Logging
Development

No branches or pull requests

5 participants