dregsy icon indicating copy to clipboard operation
dregsy copied to clipboard

unauthorized to list catalog

Open badsmoke opened this issue 2 years ago • 2 comments

Hello I get a "unauthorized to list catalog",

i want to sync images from a harbor instance, the login is correct (checked several times, i can push to it with the same credentials), the link works too.

level=error msg="error getting catalog page: GET https://hub.domain.com/v2/_catalog?last=&n=100: UNAUTHORIZED: unauthorized to list catalog"

to the config:

i would like to syncronize two namespaces with the help of regex, harbor itself offers this possibility only very limited.

?last=&n=100 what still surprises me is that the number of tags to be retrieved is set to 100, even though 1000 is set in the config.

i use the latest xelalex/dregsy docker image version

in another sync job, i push to the same harbor instance, that works.

But with the list there are problems

I hope you can help me

badsmoke avatar Sep 06 '22 09:09 badsmoke

Sorry for the late reply! I'm not familiar with Harbor, and don't have an instance available for testing right now. In general, push&pull authorization may not necessarily be the same as authorization for listing catalogs. It's also possible that Harbor doesn't fully implement v2/_catalog, or does it in a slightly different way.

Could you try to retrieve the catalog with curl using the URL from the error message? We need to find out whether Harbor's implementation of the v2/_catalog API possibly requires a bearer token for authentication. dregsy currently uses basic auth by default, and bearer token only for GCR registries. You will probably have to experiment a little to get the right bearer token into the curl request.

?last=&n=100 what still surprises me is that the number of tags to be retrieved is set to 100, even though 1000 is set in the config.

The n=100 is just the page size. If you set lister.maxItems to 1000, then at most 10 pages will be retrieved.

xelalexv avatar Sep 22 '22 06:09 xelalexv

now i have lost sight of it myself.

with basic auth i can get everything without problems

curl https://user:[email protected]/v2/_catalog?last=&n=1000

badsmoke avatar Nov 08 '22 07:11 badsmoke