-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Can't use Docker Registry V2 HTTPS API w/ Harbor Registry. #13653
Comments
@Clovel Hi,Clovel. Read document https://docs.docker.com/registry/spec/auth/token/ first pls. If you want access the standard v2 APIs, you need retrive |
Thanks for the answer @kofj. How come I can access other registries with Basic Auth but not Harbor's Docker registry ? Also, I can't seem to get the Bearer Token : $ curl -X GET -u user:password "https://ID.gra7.container-registry.ovh.net/service/token"
Unable to handle service: This looks like something our sys admin should activate. Any clues ? |
curl -v --basic -u admin:Harbor12345 ${YOUR_HARBOR_DOMAIN}/v2/_catalog |
Version
Version v1.10.0-6b84b62f Basic Auth
This simply doesn't work, and results in $ curl -v -X GET --basic -u <username>:<password> "https://<ID>.gra7.container-registry.ovh.net/v2/_catalog"
Note: Unnecessary use of -X or --request, GET is already inferred.
* Trying <IP_ADDR>:443...
* TCP_NODELAY set
* Connected to <ID>.gra7.container-registry.ovh.net (<IP_ADDR>) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server accepted to use h2
* Server certificate:
* subject: CN=*.gra7.container-registry.ovh.net
* start date: Nov 12 00:00:00 2020 GMT
* expire date: Nov 12 23:59:59 2021 GMT
* subjectAltName: host "<ID>.gra7.container-registry.ovh.net" matched cert\'s "*.gra7.container-registry.ovh.net"
* issuer: C=GB; ST=Greater Manchester; L=Salford; O=Sectigo Limited; CN=Sectigo RSA Domain Validation Secure Server CA
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Server auth using Basic with user '<username>'
* Using Stream ID: 1 (easy handle <?????>)
> GET /v2/_catalog HTTP/2
> Host: <ID>.gra7.container-registry.ovh.net
> authorization: Basic <B64_AUTH>
> user-agent: curl/7.68.0
> accept: */*
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
< HTTP/2 401
< date: Mon, 07 Dec 2020 11:04:13 GMT
< content-type: application/json; charset=utf-8
< content-length: 145
< docker-distribution-api-version: registry/2.0
< www-authenticate: Bearer realm="https://<ID>.gra7.container-registry.ovh.net/service/token",service="harbor-registry",scope="registry:catalog:*"
< x-content-type-options: nosniff
< strict-transport-security: max-age=15724800; includeSubDomains
< x-ovh-ingress: public-ingress
<
{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":[{"Type":"registry","Class":"","Name":"catalog","Action":"*"}]}]}
* Connection #0 to host <ID>.gra7.container-registry.ovh.net left intact It seems that Harbor is falling back to the Bearer token method and doesn't accept basic auth. |
Bumping the issue. Any ideas ? |
hi,I met a same question,have you solve it now? |
I'm sorry @Lanyujiex, I haven't. I switched from the OVH Docker registry provider to a self-hosted registry. |
This is fixed in version 2.2.1 - I've just confirmed it. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
It seems anonymous access still doesn't work without providing some authentication on the latest version (v2.3.3-a0a9ed8a). If I create a public image, then try to fetch a manifest, I get
However, if I use basic auth with some random username and password (not corresponding to an actual user) then it is successful. |
Hi @wy65701436 I'm using Harbor v1.8.2-1c3a3d53 (sadly I don't have admin privileges and can't update it to a newer version), I tried to use bearer token. I can get a token using informations from
|
This issue is being marked stale due to a period of inactivity. If this issue is still relevant, please comment or remove the stale label. Otherwise, this issue will close in 30 days. |
I've retested with 2.5.3 and it still doesn't allow anonymously fetching the manifest for a public image (while succeeding when made-up Basic auth credentials are given). |
Hi,
With this robot I was able to call "GET {harbor-host}/v2/_catalog" successfully BUT trying to call Get "{harbor-host}/v2/{project}/{repo}/tags/list": http: non-successful response (status=401 body="{"errors":[{"code":"UNAUTHORIZED","message":"unauthorized to access repository: {project}/{repo}, action: pull: unauthorized to access repository: {project}/{repo}, action: pull"}]}\n") I think this "if" https://github.com/goharbor/harbor/blob/v2.5.3/src/server/middleware/v2auth/auth.go#L76 is returning "false" for some reason (unknown to me). |
This issue is being marked stale due to a period of inactivity. If this issue is still relevant, please comment or remove the stale label. Otherwise, this issue will close in 30 days. |
This issue was closed because it has been stalled for 30 days with no activity. If this issue is still relevant, please re-open a new issue. |
I am also seeing this behavior. Is this seen as a non-issue by the maintainers? |
i just had the same problem. I have correct Harbor account and password, correct default-Registry account in "/opt/harbor/common/config/core/env". |
I found this
I tried changing the |
Same issue here (Harbor v2.7.4): Get "{harbor-host}/v2/{project}/{repo}/tags/list": http: non-successful response (status=401 body="{"errors":[{"code":"UNAUTHORIZED","message":"unauthorized to access repository: {project}/{repo}, action: pull: unauthorized to access repository: {project}/{repo}, action: pull"}]}\n") |
Issue
By trying to use the standard Docker Registry V2 HTTPS API with
node-fetch
& with cURL, I only get theUNAUTHORIZED
error code.Here is an example request :
curl -X GET -u user:password "https://ID.gra7.container-registry.ovh.net/v2/_catalog"
and the result
The user and the password work to connect to the Harbor GUI & also work with
docker login
.I cannot find any resources online about this issue. I need access to the following standard API requests :
GET /_catalog
GET /{repository}/tags/list
HEAD /{repository}/manifests/{tag}
DELETE /{repository}/manifests/{tag}
These requests work as intended with other standard Docker Registries. How can I use them with Harbor ?
Thanks for your help.
More results
GET /_catalog
GET /{repository}/tags/list
HEAD /{repository}/manifests/{tag}
DELETE /{repository}/manifests/{tag}
The text was updated successfully, but these errors were encountered: