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

Error in Web UI with basic authentication #97

Open
JoSell95 opened this issue Sep 4, 2018 · 6 comments
Open

Error in Web UI with basic authentication #97

JoSell95 opened this issue Sep 4, 2018 · 6 comments

Comments

@JoSell95
Copy link

JoSell95 commented Sep 4, 2018

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

@lhenry7
Copy link

lhenry7 commented Jan 10, 2019

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?

@mkuchin
Copy link
Owner

mkuchin commented Jan 10, 2019

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

@lhenry7
Copy link

lhenry7 commented Jan 11, 2019

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
Copy link

lhenry7 commented Jun 5, 2019

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

@lylevip
Copy link

lylevip commented Jul 10, 2019

I am also troubled by this problem.

@MeiNagano
Copy link

so it cant work with htpasswd?

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

5 participants