Commit Graph

319 Commits

Author SHA1 Message Date
f40bfd3ca4 Merge pull request #13815 from tiborvass/do-not-send-basic-auth-on-302
Do not set auth headers for registry v1 if 302
Upstream-commit: 13baeb3b70c5f145614cbbd582daa8a6fcbd2b79
Component: engine
2015-06-09 15:34:53 -07:00
366768923f Registry: remove unwanted return variable name
Signed-off-by: xiekeyang <xiekeyang@huawei.com>
Upstream-commit: a31be2512136444ce473235a35d6fd47634e3f13
Component: engine
2015-06-09 10:58:33 +08:00
f87511cc9a Do not set auth headers if 302
This patch ensures no auth headers are set for v1 registries if there
was a 302 redirect.

This also ensures v2 does not use authTransport.

Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: 123a0582b2f9522bdfb95cceabf8dd21af758300
Component: engine
2015-06-08 19:59:39 -04:00
649fae7e21 Merge pull request #13648 from tiborvass/print-debugtransport-to-test-output
registry: debugTransport should print with testing.T.Log
Upstream-commit: a06e0bb8b49819402180331d325d919f865a5fbd
Component: engine
2015-06-05 00:42:22 +02:00
3494783c1d Merge pull request #13650 from jvgogh/master
Upon HTTP 302 redirect do not include "Authorization" header on 'untr…
Upstream-commit: 278798236bdf073dd7c66e32e21d81bbf9243656
Component: engine
2015-06-02 14:23:20 -04:00
49338919a2 Merge pull request #13576 from stevvooe/verify-digests
Properly verify manifests and layer digests on pull
Upstream-commit: 274baf70bf806678d12adc1e1de2c8d7774de645
Component: engine
2015-06-02 11:16:23 -07:00
4475beb8ff Upon HTTP 302 redirect do not include "Authorization" header on 'untrusted' registries.
Refactoring in Docker 1.7 changed the behavior to add this header where as Docker <= 1.6 wouldn't emit this Header on a HTTP 302 redirect.

This closes #13649

Signed-off-by: Jeffrey van Gogh <jvg@google.com>
Upstream-commit: 65c5105fcca76c34335f689336a663c78786fd9c
Component: engine
2015-06-01 16:12:56 -07:00
6623778ef1 registry: debugTransport should print with testing.T.Log
It should not print to STDOUT so that it only prints the debugTransport
output if there was an error in one of the registry tests.

Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: 78bc233a0123e9e0a808b566c4c6d46c84e79f71
Component: engine
2015-06-01 17:48:30 -04:00
a965e4e763 Fix race condition in registry/session
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 9d98c28855035ba1a968f2031f50302d0c41e208
Component: engine
2015-06-01 13:25:18 -07:00
395ceacd61 Properly verify manifests and layer digests on pull
To ensure manifest integrity when pulling by digest, this changeset ensures
that not only the remote digest provided by the registry is verified but also
that the digest provided on the command line is checked, as well. If this check
fails, the pull is cancelled as with an error. Inspection also should that
while layers were being verified against their digests, the error was being
treated as tech preview image signing verification error. This, in fact, is not
a tech preview and opens up the docker daemon to man in the middle attacks that
can be avoided with the v2 registry protocol.

As a matter of cleanliness, the digest package from the distribution project
has been updated to latest version. There were some recent improvements in the
digest package.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
Upstream-commit: 06612cc0fee103bf6f46429e3cd572725ef72948
Component: engine
2015-05-29 15:20:28 -07:00
6226136075 Remove PortSpecs from Config
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: 15134a3320fbacee36e86a0342e7ffb49285f297
Component: engine
2015-05-29 22:38:09 +02:00
b27566c00b Merge pull request #13430 from runcom/fix-race-modify-request
Fix race in httpsRequestModifier.ModifyRequest when writing tlsConfig
Upstream-commit: 3bda841e3e2e32ca3b35887e5affa96db506bcd6
Component: engine
2015-05-28 11:31:04 -07:00
521590a1df Registry v2 mirror support.
The v2 registry will act as a pull-through cache, and needs to be
handled differently by the client to the v1 registry mirror.

See docker/distribution#459 for details

Configuration

Only one v2 registry can be configured as a mirror. Acceptable configurations
in this chanage are: 0...n v1 mirrors or 1 v2 mirror. A mixture of v1 and v2
mirrors is considered an error.

Pull

If a v2 mirror is configured, all pulls are redirected to that mirror. The
mirror will serve the content locally or attempt a pull from the upstream mirror,
cache it locally, and then serve to the client.

Push

If an image is tagged to a mirror, it will be pushed to the mirror and be
stored locally there. Otherwise, images are pushed to the hub. This is
unchanged behavior.

Signed-off-by: Richard Scothern <richard.scothern@gmail.com>
Upstream-commit: 13deed380127d4a0e7982bb0d4f6529d0962116b
Component: engine
2015-05-26 11:08:19 -07:00
05d1a111f6 Fix race in httpsRequestModifier.ModifyRequest when writing tlsConfig
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: a27395e6dffcd5a454f8ec0dca4934a51fbe70f6
Component: engine
2015-05-23 23:50:08 +02:00
ebafe2bed3 registry: fix auth bug
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: fc29f7f70b34ae11e1084a66cf401ff11b4573e7
Component: engine
2015-05-21 16:53:22 -04:00
6cea31194f Fix wording in comment
Signed-off-by: Jacob Atzen <jatzen@gmail.com>
Upstream-commit: 007269ba2405bd95c73343513f6ef9a7b2772da0
Component: engine
2015-05-20 18:03:46 +02:00
0f0f3f437f Windows: fix registry filepath and location
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: 81e7d3571be357205fc7ab65012771cadc2a967b
Component: engine
2015-05-19 10:58:45 -07:00
04b3252768 Add transport package to support CancelRequest
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: 73823e5e56446b23ce01bb8e44a9670ab2552b0a
Component: engine
2015-05-18 23:31:42 -04:00
a10bf833ac requestdecorator: repurpose the package and rename to useragent
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: cf8c0d0f56021fbea7bc89e378bb937b53aeca3b
Component: engine
2015-05-18 21:51:54 -04:00
14d2347fac registry: Refactor requestfactory to use http.RoundTrippers
This patch removes the need for requestFactories and decorators
by implementing http.RoundTripper transports instead.

It refactors some challenging-to-read code.

NewSession now takes an *http.Client that can already have a
custom Transport, it will add its own auth transport by wrapping
it.

The idea is that callers of http.Client should not bother
setting custom headers for every handler but instead it should
be transparent to the callers of a same context.

This patch is needed for future refactorings of registry,
namely refactoring of the v1 client code.

Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: a01cc3ca7729c3ce635fef7c1db837b5c6ae1028
Component: engine
2015-05-18 21:51:53 -04:00
7f04f5c4bf Increase default connection timeout to 30s
Closes #13307
Signed-off-by: James Lal <jlal@mozilla.com>
Upstream-commit: f5e6f50a1ef193c1f3f5736829a0284c8f96a661
Component: engine
2015-05-18 13:26:33 -07:00
9babc5a64f Fix invalid tag name
Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: e00cfbb6f2b953301bfcd7270e9bdfde1a2d17c7
Component: engine
2015-05-13 14:28:52 +08:00
0b5b481a6d Merge pull request #12828 from tdmackey/trivial-spelling
trivial: typo cleanup
Upstream-commit: 0153edcda1527cd19f5952046b51c4e8358d01ed
Component: engine
2015-04-27 17:05:46 -04:00
ae74d9f34f trivial: typo cleanup
Signed-off-by: David Mackey <tdmackey@booleanhaiku.com>
Upstream-commit: 3941623fbc3fa724d61f53121513ffd87d03b61c
Component: engine
2015-04-27 13:35:08 -07:00
954f940156 Small if err cleaning
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: 844538142d95c1b7dda1bb2903179510105fe9b5
Component: engine
2015-04-27 21:50:33 +02:00
aa65355e58 Merge pull request #12417 from hashneo/patch-1
What if authConfig or factory is Nill?
Upstream-commit: 6b8d8a5847cc92ef8d96067da6b104b6e66ceaaf
Component: engine
2015-04-23 13:54:47 -07:00
c8f1332dce Move CLI config processing out from under registry dir
No logic changes should be in here, just moving things around.

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: bb9da6ba9294a8eab8f4dfaf7cf07c57959fe608
Component: engine
2015-04-23 10:18:38 -07:00
988e520cc7 Make .docker dir have 0700 perms not 0600
Thanks to @dmcgowan for noticing.

Added a testcase to make sure Save() can create the dir and then
read from it.

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: bfeb98a23607c835c1d9241e282b84acd8dc3606
Component: engine
2015-04-20 14:16:50 -07:00
44c88b9112 Add .docker/config.json and support for HTTP Headers
This PR does the following:
- migrated ~/.dockerfg to ~/.docker/config.json. The data is migrated
  but the old file remains in case its needed
- moves the auth json in that fie into an "auth" property so we can add new
  top-level properties w/o messing with the auth stuff
- adds support for an HttpHeaders property in ~/.docker/config.json
  which adds these http headers to all msgs from the cli

In a follow-on PR I'll move the config file process out from under
"registry" since it not specific to that any more. I didn't do it here
because I wanted the diff to be smaller so people can make sure I didn't
break/miss any auth code during my edits.

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 18c9b6c6455f116ae59cde8544413b3d7d294a5e
Component: engine
2015-04-20 13:05:24 -07:00
0b57229dc6 Removes redundant else in registry/session.go
Fixes #12523

Signed-off-by: Rick Wieman <git@rickw.nl>
Upstream-commit: 5f2b051ec5a2f639857a1628f3c994fbfd0b3da0
Component: engine
2015-04-19 23:58:55 +02:00
af8b6cc8bb Refactor else branches
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: 8655214b3dc8abb4edbca3db3e04557e09a1149b
Component: engine
2015-04-19 15:32:54 +02:00
34b09a1968 What if authConfig or factory is Null?
Signed-off-by: Steven Taylor <steven.taylor@me.com>
Upstream-commit: d1855c6cc0cb28fed7426ee3024f147e74ac828e
Component: engine
2015-04-15 15:35:18 -07:00
a4111cba55 Refactor utils/utils, fixes #11923
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: c30a55f14dbbe3971ba0ac716ba69a60868f4490
Component: engine
2015-04-14 01:37:36 +02:00
f10bd173bd Merge pull request #11478 from dmcgowan/v2-vendored-api
Use v2 api from distribution
Upstream-commit: 563041b5c4acaca8e6ebb8fb4e81a3e7e7c37e81
Component: engine
2015-04-10 17:22:38 -04:00
938f87c2dd Remove engine.Table from docker search and fix missing field
registry/SearchResults was missing the "is_automated" field.
I added it back in.

Pull this 'table' removal one from the others because it fixed
a bug too

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 67b4cce0f6c835cf9e53313a026af2e825ba8b10
Component: engine
2015-04-03 11:27:30 -07:00
753b8ae08c Remove jobs from registry.Service
This makes `registry.Service` a first class type and does not use jobs
to interact with this type.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 03d3d79b2b3f8b720fff2d649aff0ef791cff417
Component: engine
2015-03-31 16:38:04 -07:00
fc0b67bcbc Use vendored v2 registry api
Update registry package to use the v2 registry api from distribution. Update interfaces to directly take in digests.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: 62009ef77efcbe30afea0cd124f3fbff0d5030cd
Component: engine
2015-03-31 15:02:27 -07:00
a62098f98e Refactor utils/http.go, fixes #11899
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: 0995ab5946b068a14cba05be8b2693c4181097e3
Component: engine
2015-03-30 17:59:57 +02:00
1c9316a817 Merge pull request #11788 from reikani/pchoi
Changed snake case naming to camelCase.
Upstream-commit: da5c863d20df8c030b3ffc6c4e95f976ed162721
Component: engine
2015-03-26 23:55:50 -07:00
e5b36a723c Replace aliased imports of logrus, fixes #11762
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: 6f4d847046cb4e072de61d042c0266190d73a8c9
Component: engine
2015-03-26 23:22:04 +01:00
0913f2905d Changed snake case naming to camelCase
Signed-off-by: Peter Choi <phkchoi89@gmail.com>
Upstream-commit: ae907e7af16136225417242ef5d55d3f6062fb3b
Component: engine
2015-03-26 15:05:45 -06:00
04f472f007 Fix for issue 9922: private registry search with auth returns 401
Signed-off-by: Don Kjer <don.kjer@gmail.com>
Upstream-commit: 6b2eeaf8965bac07022752c411b1f8a0f35f9571
Component: engine
2015-03-26 18:59:16 +00:00
a16f3d6cb4 Remove engine.Status and replace it with standard go error
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: c79b9bab541673af121d829ebc3b29ff1b01efa2
Component: engine
2015-03-25 22:32:08 +01:00
bca1423917 Add struct tags on v2 remote tags struct
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: 4925d98d1f638e9439e19b6c89c608a64a281a39
Component: engine
2015-03-23 14:33:52 -07:00
503249b833 Fix decode tags value error when call get /v2/<name>/tags/list in registry api v2.
Signed-off-by: Meaglith Ma <genedna@gmail.com>
Upstream-commit: 221e9624e3a7a7a9b81ffda9930657352080e32d
Component: engine
2015-03-23 14:33:52 -07:00
4b295342e5 Add check for 404 on get repository data
No longer add the body to the error when a 404 is received on get repository data.

closes #11510

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: c8d2ec93caf7c64f3e510e4e75f49614880ed9b9
Component: engine
2015-03-22 18:15:18 -07:00
6df3fa6b80 Merge pull request #11528 from jlhawn/separate_init_blob_upload
Separate init blob upload
Upstream-commit: ca3a912287b6befb5016d358a6b763b0aa72b701
Component: engine
2015-03-20 16:39:31 -07:00
e131073558 Separate init blob upload
Pushing a v2 image layer has two steps:

- POST to get a new upload URL
- PUT to that upload URL

We were previously not checking the response code of
the POST request and the PUT would fail in weird ways.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: 73b33db04b29a516bf8c50fbe646f563298fcfd9
Component: engine
2015-03-20 13:11:05 -07:00
54c09d3930 Add verification of image manifest digests
Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: 9ececa14ba860c9934d3cd8d3e704e53e828e22b
Component: engine
2015-03-20 09:34:39 -07:00
022bfbf5f3 Merge pull request #11477 from dmcgowan/fix-auth-http-client
Update auth client configuration to use proper tls config
Upstream-commit: 661c31737dde7770d6f9bd5125ce85751887c3b7
Component: engine
2015-03-19 14:17:47 -07:00