docker-registry-web icon indicating copy to clipboard operation
docker-registry-web copied to clipboard

Error in Web UI with basic authentication

Open JoSell95 opened this issue 6 years ago • 6 comments

Hello,

when I try to use basic authentication in web ui the following error comes up:

status=401 UNAUTHORIZED {"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":[{"Type":"registry","Class":"","Name":"catalog","Action":"*"}]}]}

I tried these command, described in the documentation:

docker run -it -p 8080:8080 --name registry-web --link registry-srv
-e REGISTRY_URL=https://registry-srv:5000/v2
-e REGISTRY_TRUST_ANY_SSL=true
-e REGISTRY_BASIC_AUTH="YWRtaW46Y2hhbmdlbWU="
-e REGISTRY_NAME=localhost:5000 hyper/docker-registry-web

What have I to put behind REGISTRY_BASIC_AUTH? Is it the password or the hash or somethin else?

Thanks in advance,

Jonas

JoSell95 avatar Sep 04 '18 12:09 JoSell95

What is the answer here? I assume some hash based on the htpasswd file I created? what is the best way to get/generate what is needed for docker-registry-web?

lhenry7 avatar Jan 10 '19 21:01 lhenry7

YWRtaW46Y2hhbmdlbWU= is base64 encoded string of user:password, in this example it is admin:changeme

mkuchin avatar Jan 10 '19 22:01 mkuchin

Ok, I'm using the base64 encode value for my usr:pw, but I wonder if this is right for the bcrypt encryption that registry:2 now requires?

my docker-registry-web log just adds this line when I try and connect: WARN web.RepositoryController - URI: '_catalog?n=100' responseCode: 401

My registry:2 log has this: time="2019-01-11T18:04:06.835682765Z" level=debug msg="authorizing request" go.version=go1.7.6 http.request.host=dsg-registry http.request.id=259b87ef-65fd-4ceb-99c8-174783e7cc2a http.request.method=GET http.request.remoteaddr="172.19.0.3:60954" http.request.uri="/v2/_catalog?n=100" http.request.useragent="Java/1.7.0_111" instance.id=a3324e00-bbc3-44dd-918f-baa942a5eccd version=v2.6.2-14-ga66a4c3 time="2019-01-11T18:04:06.836558561Z" level=warning msg="error authorizing context: basic authentication challenge for realm "Registry Realm": invalid authorization credential" go.version=go1.7.6 http.request.host=dsg-registry http.request.id=259b87ef-65fd-4ceb-99c8-174783e7cc2a http.request.method=GET http.request.remoteaddr="172.19.0.3:60954" http.request.uri="/v2/_catalog?n=100" http.request.useragent="Java/1.7.0_111" instance.id=a3324e00-bbc3-44dd-918f-baa942a5eccd version=v2.6.2-14-ga66a4c3

And yes, my docker login straight to the repository:2 container works. Here is my docker-registry-web ENV vars: -e REGISTRY_READONLY=false
-e REGISTRY_TRUST_ANY_SSL=true
-e REGISTRY_URL=https://dsg-registry/v2
-e REGISTRY_NAME=dsg.infra
-e REGISTRY_AUTH_ENABLED=true
-e REGISTRY_AUTH_KEY=/conf/auth.key
-e REGISTRY_BASIC_AUTH=Z2V3ZWI6RGlnaXRhbDE0Ng==

Here is my registry config.yml: version: 0.1

storage: filesystem: rootdirectory: /registry delete: enabled: true

http: addr: 0.0.0.0:443 tls: certificate: /certs/my-registry.crt key: /certs/my-registry.key

auth: htpasswd: realm: Registry Realm path: /auth/registry-htpasswd

log: level: debug

lhenry7 avatar Jan 11 '19 18:01 lhenry7

Wanted to leave an update, I did finally get this working without Basic Auth but with a nginx proxy for the UI frontend.

lhenry7 avatar Jun 05 '19 22:06 lhenry7

I am also troubled by this problem.

lylevip avatar Jul 10 '19 08:07 lylevip

so it cant work with htpasswd?

MeiNagano avatar Mar 09 '22 03:03 MeiNagano