Repository navigation
Closed
Labels
Description
moved from moby/moby#22158
Steps to reproduce the issue:
- Request a token from dockerhub (
GET https://auth.docker.io/token?scope=repository%3Alibrary%2Fmysql%3Apull&service=registry.docker.io) - Immediately use the token to make an API request
Describe the results you received:
A 401 response is sometimes returned
Describe the results you expected:
Tokens are immediately usable
Additional information you deem important (e.g. issue happens only occasionally):
- The JWT tokens returned from dockerhub have a
nbf(not before) set to exactly the current timestamp of the granting server - If that token is immediately used against dockerhub and is load-balanced to a server with a clock skewed in the past, the token is rejected
- Test case at https://gist.github.com/liggitt/e7d06dc1cbc9d44034f762c5654c6fff (worked recreatably with less than 50 attempts when written, but varies due to server clock skew)
$ go run token.go
............................................
Got 401 response using newly granted token
Token response date header: Tue, 19 Apr 2016 15:36:40 GMT
Manifest response date header: Tue, 19 Apr 2016 15:36:39 GMT
Token:
eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsIng1YyI6WyJNSUlDTHpDQ0FkU2dBd0lCQWdJQkFEQUtCZ2dxaGtqT1BRUURBakJHTVVRd1FnWURWUVFERXp0Uk5Gb3pPa2RYTjBrNldGUlFSRHBJVFRSUk9rOVVWRmc2TmtGRlF6cFNUVE5ET2tGU01rTTZUMFkzTnpwQ1ZrVkJPa2xHUlVrNlExazFTekFlRncweE5UQTJNalV4T1RVMU5EWmFGdzB4TmpBMk1qUXhPVFUxTkRaYU1FWXhSREJDQmdOVkJBTVRPMGhHU1UwNldGZFZWam8yUVZkSU9sWlpUVEk2TTFnMVREcFNWREkxT2s5VFNrbzZTMVExUmpwWVRsSklPbFJMTmtnNlMxUkxOanBCUVV0VU1Ga3dFd1lIS29aSXpqMENBUVlJS29aSXpqMERBUWNEUWdBRXl2UzIvdEI3T3JlMkVxcGRDeFdtS1NqV1N2VmJ2TWUrWGVFTUNVMDByQjI0akNiUVhreFdmOSs0MUxQMlZNQ29BK0RMRkIwVjBGZGdwajlOWU5rL2pxT0JzakNCcnpBT0JnTlZIUThCQWY4RUJBTUNBSUF3RHdZRFZSMGxCQWd3QmdZRVZSMGxBREJFQmdOVkhRNEVQUVE3U0VaSlRUcFlWMVZXT2paQlYwZzZWbGxOTWpveldEVk1PbEpVTWpVNlQxTktTanBMVkRWR09saE9Va2c2VkVzMlNEcExWRXMyT2tGQlMxUXdSZ1lEVlIwakJEOHdQWUE3VVRSYU16cEhWemRKT2xoVVVFUTZTRTAwVVRwUFZGUllPalpCUlVNNlVrMHpRenBCVWpKRE9rOUdOemM2UWxaRlFUcEpSa1ZKT2tOWk5Vc3dDZ1lJS29aSXpqMEVBd0lEU1FBd1JnSWhBTXZiT2h4cHhrTktqSDRhMFBNS0lFdXRmTjZtRDFvMWs4ZEJOVGxuWVFudkFpRUF0YVJGSGJSR2o4ZlVSSzZ4UVJHRURvQm1ZZ3dZelR3Z3BMaGJBZzNOUmFvPSJdfQ.eyJhY2Nlc3MiOlt7InR5cGUiOiJyZXBvc2l0b3J5IiwibmFtZSI6ImxpYnJhcnkvbXlzcWwiLCJhY3Rpb25zIjpbInB1bGwiXX1dLCJhdWQiOiJyZWdpc3RyeS5kb2NrZXIuaW8iLCJleHAiOjE0NjEwODA1MDAsImlhdCI6MTQ2MTA4MDIwMCwiaXNzIjoiYXV0aC5kb2NrZXIuaW8iLCJqdGkiOiJYWVVBbXllaVhhR2Zlb2dyeEtEeCIsIm5iZiI6MTQ2MTA4MDIwMCwic3ViIjoiIn0.9CBqwHk70dMdKLZrp_Frdwdx-ndKjEYmKzTUpmyJNpz7PLpF9PDzfbRcDO12ruYmLSlUxzgVVKPb1ljzmyv26A
Either of the following fixes would work:
- Create the JWT with a
nbffar enough in the past to account for clock-skew between the servers in the auth domain - Allow for clock skew when validating the
nbfin a presented JWT.
Activity
marcusmartins commentedon Apr 19, 2016
Thanks for detailed report and test case. We're investigating.
cc @nwt
vito commentedon Apr 26, 2016
We're seeing this pretty frequently. I really don't want to add retry logic for this since
401 Unauthorizedis especially "fatal". I suppose we could add a sleep instead but it depends on how drifty your clocks are. :)marcusmartins commentedon Apr 26, 2016
We're working on a fix and it should be live soon.
soltysh commentedon May 6, 2016
@marcusmartins any news on the progress?
soltysh commentedon Jun 1, 2016
@marcusmartins ping
marcusmartins commentedon Jun 2, 2016
@soltysh @liggitt are you experiencing the issue? We have deployed a couple of fixes in the last month that should address that issue
soltysh commentedon Jun 2, 2016
@marcusmartins nope I haven't seen it appearing anywhere in our test cases so far. Iow. I'm ok with closing this issue.
marcusmartins commentedon Jun 3, 2016
thanks @soltysh. Closing it for now.