Portus icon indicating copy to clipboard operation
Portus copied to clipboard

Incorrect "error authorizing context: authorization token required"

Open Vad1mo opened this issue 6 years ago • 7 comments

No sure if that is a bug in the Registry or in Portus.

I have a Registry with Portus where I successfully can login/push/pull images just fine

However I see quite often this type of errors in the registry:

2018-04-04T20:19:50.908671064Z time="2018-04-04T20:19:50.908429545Z" level=warning msg="error authorizing context: authorization token required" go.version=go1.8.7 http.request.host=registry.example.com http.request.id=bdde2f61-c2fa-461c-b36b-b66ba48ba2f9 http.request.method=GET http.request.remoteaddr=51.51.211.166 http.request.uri="/v2/io/credit-api/manifests/21" http.request.useragent=Ruby vars.name="io/credit-api" vars.reference=21 
2018-04-04T20:19:50.908750484Z 172.18.0.6 - - [04/Apr/2018:20:19:50 +0000] "GET /v2/io/credit-api/manifests/21 HTTP/1.1" 401 158 "" "Ruby"
2018-04-04T20:19:51.529064814Z 172.18.0.6 - - [04/Apr/2018:20:19:51 +0000] "GET /v2/io/credit-api/manifests/21 HTTP/1.1" 200 1780 "" "Ruby"

If I read it correctly the first request fails and the following retry works. At least I guess that it is a working retry on the second line.

My Registry auth part is this
      REGISTRY_AUTH_TOKEN_REALM: https://${MACHINE_FQDN}/v2/token
      REGISTRY_AUTH_TOKEN_SERVICE: ${MACHINE_FQDN}
      REGISTRY_AUTH_TOKEN_ISSUER: ${MACHINE_FQDN}

MACHINE_FQDN = registry.example.com

Vad1mo avatar Apr 04 '18 20:04 Vad1mo

Hopefully I didn't read this too fast, but take a look at this method which is used on all Registry calls. It's the usual procedure for fetching the token to be used when performing requests to the registry.

mssola avatar Apr 05 '18 08:04 mssola

thx, make sense as I expected. What I wonder is why does this happen on actually all requests? Shouldn't it happen only from time to time or after a idle period where the token expired?

Vad1mo avatar Apr 05 '18 08:04 Vad1mo

That's because the token is not cached from the Portus side iirc. So a new token has to be requested every time. Maybe this is something worth exploring.

mssola avatar Apr 11 '18 14:04 mssola

Thanks for all your contributions! This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Jul 10 '18 15:07 stale[bot]

Tagging as enhancement just in case we find a way to improve this situation.

mssola avatar Jul 12 '18 14:07 mssola

Mee have a similar problem:

time="2018-10-11T07:16:33Z" level=warning msg="error authorizing context: authorization token required" go.version=go1.7.6 http.request.host=registry.xxx.xx http.request.id=9de36727-228f-492c-a292-c177915afb41 http.request.method=GET http.request.remoteaddr=172.19.0.1 http.request.uri="/v2/" http.request.useragent=Ruby instance.id=c240a915-580a-49ad-8194-5edb166ac782 version=v2.6.2

But all works OK . ¿This is a Bug or a real problem? Have a solution?

Nitrosito avatar Oct 11 '18 07:10 Nitrosito

¿Any new? I have every minute:

time="2018-12-18T08:11:20Z" level=warning msg="error authorizing context: authorization token required" go.version=go1.7.6 http.request.host="registry.xxx.org:5000" http.request.id=c3ad7bbe-b9ea-471e-8217-299d1723698b http.request.method=GET http.request.remoteaddr="192.168.64.1:43416" http.request.uri="/v2/" http.request.useragent=Ruby instance.id=59aadd27-dcd3-4c5f-b9c2-de2be58af8f2 version=v2.6.2

But portus (2.4 on docker-compose )looks work welll

So... you have Get to

/v2/io/credit-api/manifests/21

And i

/v2/

Maybe diferent problems... So i get this updates from 192.168.64.1 (the gateway of portus network) ... Maybe external servers are making requests to the registry for something? How long is a login? It is not necessary to logout, right? I dont know :(

Nitrosito avatar Dec 18 '18 08:12 Nitrosito