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

Resolve-tags gives UNAUTHORIZED #366

Open
steakunderscore opened this issue Jul 23, 2019 · 7 comments
Open

Resolve-tags gives UNAUTHORIZED #366

steakunderscore opened this issue Jul 23, 2019 · 7 comments
Assignees

Comments

@steakunderscore
Copy link
Contributor

Expected Behaviour

I have an image in a private registry gcr.io/some-project/foo:v1.0.0, how can I get resolve-tags to resolve the image tag to digest?

There's reference to this issue in docs/tutorial.md. But it has been left as a TODO.

Actual Behavior

Currently trying to call resolve-tags with a k8s config including the provate image fails giving the error:

Error: unable to resolve: Digest(gcr.io/private-project/foo:v1.0.0): UNAUTHORIZED: "You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication"

Steps to Reproduce the Problem

Where gcr.io/private-project/foo:v1.0.0 is an image in a registry which is private.

  1. cat /tmp/test.yaml
apiVersion: v1
kind: Pod
metadata:
  labels:
    app: test
spec:
  containers:
  - image: gcr.io/private-project/foo:v1.0.0
    name: foo
  1. make ./out/resolve-tags
mkdir -p ./out
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "" -tags "" -o out/resolve-tags-linux-amd64 github.com/grafeas/kritis/cmd/kritis/kubectl/plugins/resolve
cp ./out/resolve-tags-linux-amd64 out/resolve-tags
  1. ./out/resolve-tags -f /tmp/test.yaml
Error: unable to resolve: Digest(gcr.io/private-project/foo:v1.0.0): UNAUTHORIZED: "You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication"

Additional info

Note that I have replaced my actual project and image name.

@aysylu
Copy link
Contributor

aysylu commented Jul 26, 2019

Hi @steakunderscore, thanks for filing the issue. Would you be interested in driving the fix? Happy to review the PR and discuss any questions that might come up.

@steakunderscore
Copy link
Contributor Author

Hi @aysylu, sure thing. I should have time to get to this coming week. I was looking at how crane works in the same regard. I think I'll use it as inspiration.

@aysylu
Copy link
Contributor

aysylu commented Jul 27, 2019

@steakunderscore perfect, looking forward to your contribution! Could you please clarify which part of crane you're specifically interested in adopting?

@steakunderscore
Copy link
Contributor Author

I was specifically thinking about crane digest which does almost exactly what resolve-tags does, however seems to try using the ~/.docker/config before falling back to unauthenticated access to the registry. Should be a couple of lines of code changed, plus some better docs.

@sharkannon
Copy link

Do you guys know a work around for this? I'm working on implementing Kritis/BinAuthz in GCP and w/out this tool it makes things a lot more difficult (Having the same problem)

@andyroyle
Copy link

I stumbled across this recently when trying to get the plugin to work using a private registry. According to the docs for the authn package in go-containerregistry it should be pretty simple, but y'know, famous last words.

I'll be poking about this week to see if I can get it working

@ooq
Copy link
Contributor

ooq commented Feb 18, 2020

That would be great! @andyroyle

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

No branches or pull requests

6 participants