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

Authentication to gcr.io registries is broken #11

Open
caipre opened this issue May 10, 2018 · 2 comments
Open

Authentication to gcr.io registries is broken #11

caipre opened this issue May 10, 2018 · 2 comments

Comments

@caipre
Copy link
Contributor

caipre commented May 10, 2018

The token retrieved via docker.AuthRegistry isn't threaded into the call to docker.GetRegistry:

https://github.com/target/portauthority/blob/master/api/v1/routes.go#L388-L405

I hacked a fix that I'll try to polish up tomorrow; making an issue in case anyone runs into this problem in the meantime. Also useful to know that the way to make the request is as follows:

$ curl -XPOST -H 'content-type: application/json' localhost:31700/v1/images -d <<<EOF
{"Image":{
  "Registry":"https://gcr.io",
  "Repo":"<project-id>/<image-name>",
  "Tag":"<image-tag>",
  "RegistryPassword":"$(cat credentials.json | jq tostring)"
}} 
EOF
@ErikThoreson
Copy link
Contributor

@caipre can you share the error you are getting?

One thing you will need if you are using a gcr service account. Is to set the RegistryUser like so: "RegistryUser":"_json_key" then like in your example you can pass in the json credentials file as a string.

@ErikThoreson
Copy link
Contributor

ErikThoreson commented May 11, 2018

Also to share context. on post image request we auth twice because I needed a custom/hacky way to pull out the bearer token to pass to Clair.. which is used here:

https://github.com/target/portauthority/blob/master/api/v1/routes.go#L414

The second auth uses an internal auth to pull manifests and repo data.

Long term I'd like to collapse things into a single auth.

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

2 participants