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

How could we authenticate with a service account key with image-syncer? #62

Closed
pakkeiC opened this issue Jan 20, 2021 · 3 comments · Fixed by #93
Closed

How could we authenticate with a service account key with image-syncer? #62

pakkeiC opened this issue Jan 20, 2021 · 3 comments · Fixed by #93

Comments

@pakkeiC
Copy link

pakkeiC commented Jan 20, 2021

To give you more context of my problem, we are trying to sync image between the cloud registry and our on-prem registry. For the cloud registry, we need to authenticate with a service account which has no password, only the service account key json.

How could we authenticate using image syncer for this case? Should we paste the service account key json to the password field? I tried to do so, but seems it is not possible and not a good way.

Kindly seek your help on that. Thank you!

@pakkeiC
Copy link
Author

pakkeiC commented Jan 21, 2021

my question is actually same as the next question. My use case is to sync the gcr.io to a on-prem nexus registry. And for the service account in gcr.io, it use service account key json to authenticate to the registry. How could we achieve that in image-syncer? Thanks!

@hhyasdf
Copy link
Collaborator

hhyasdf commented Jan 25, 2021

As a tool image synchronization for more scenarios, it's hard for image-syncer to adapter to all kinds of registry, because there are so many different ways to authenticate. But for now, I do believe username/password is the most general authenticating way for all registries.

For GCR, maybe this doc can get you a little help, https://cloud.google.com/container-registry/docs/advanced-authentication

@DennisD2
Copy link
Contributor

DennisD2 commented Mar 21, 2022

I had the same situation, wanted to sync images from an internal registry to Google Cloud registry at eu.gcr.io.
While the service account token failed (I tried "_json_token" as user and the service account token as password), it was possible to synchronize using a temporary token (then using "oauth2accesstoken" as user and the temp token as password).

This workaround is possible, but not so nice. A temp token is only valid for 60 minutes.

It would be nice, if image-syncer creates the temp services from the service account credentials, using the Google API.
This is implemented for example in dregsy (https://github.com/xelalexv/dregsy, https://github.com/xelalexv/dregsy/blob/master/internal/pkg/auth/gcr.go),

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

Successfully merging a pull request may close this issue.

3 participants