Commit Graph

64 Commits

Author SHA1 Message Date
d02918ddb2 Format code with gofmt -s from go-1.11beta1
This should eliminate a bunch of new (go-1.11 related) validation
errors telling that the code is not formatted with `gofmt -s`.

No functional change, just whitespace (i.e.
`git show --ignore-space-change` shows nothing).

Patch generated with:

> git ls-files | grep -v ^vendor/ | grep .go$ | xargs gofmt -s -w

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 9b0097a69900009ab5c2480e047952cba60462a7)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: ee28567c7066368207a947e02c6242db7a4adb16
Component: engine
2019-06-20 11:23:45 +02:00
006734c577 If url includes scheme, urlPath will drop hostname, which would not match the auth check
Signed-off-by: Jameson Hyde <jameson.hyde@docker.com>
(cherry picked from commit 754fb8d9d03895ae3ab60d2ad778152b0d835206)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
Upstream-commit: a79fabbfe84117696a19671f4aa88b82d0f64fc1
Component: engine
2019-01-09 17:31:53 +00:00
0b021f6648 Authz plugin security fixes for 0-length content and path validation Signed-off-by: Jameson Hyde <jameson.hyde@docker.com>
fix comments

(cherry picked from commit 9659c3a52bac57e615b5fb49b0652baca448643e)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
Upstream-commit: fc274cd2ff4cf3b48c91697fb327dd1fb95588fb
Component: engine
2019-01-09 17:31:53 +00:00
4cadaa03f8 Update tests to use gotest.tools 👼
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 38457285242e57306c5b7ee652c7ccbb9fbd6713
Component: engine
2018-06-13 09:04:30 +02:00
e3af8e0774 Switch from x/net/context -> context
Since Go 1.7, context is a standard package. Since Go 1.9, everything
that is provided by "x/net/context" is a couple of type aliases to
types in "context".

Many vendored packages still use x/net/context, so vendor entry remains
for now.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Upstream-commit: 7d62e40f7e4f3c17d229a7687d6fcca5448de813
Component: engine
2018-04-23 13:52:44 -07:00
21cd6af613 Merge pull request #36778 from odg0318/master
Using authorization plugin, I changed Content-Type check routine.
Upstream-commit: ff6a103067dec1eec6de023ec813355c419246f6
Component: engine
2018-04-12 17:39:38 -07:00
ad813c4199 Limit authz response buffer
When the authz response buffer limit is hit, perform a flush.
This prevents excessive buffer sizes, especially on large responses
(e.g. `/containers/<id>/archive` or `/containers/<id>/export`).

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 74f8e47352e71aad4015d8d9dea8f16e7a055863
Component: engine
2018-04-11 15:36:36 -04:00
12207142e4 If Content-Type is application/json;charset=UTF-8, RequestBody is empty.
Signed-off-by: odg0318 <odg0318@gmail.com>
Upstream-commit: 6ac73d34e4d8f2b6303f0ed49b58d0a92c19c6f1
Component: engine
2018-04-05 04:03:45 -04:00
60daf5fa97 Automated migration using
gty-migrate-from-testify --ignore-build-tags

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 6be0f709830113966f295401327b027ec2f0bbca
Component: engine
2018-03-16 11:03:43 -04:00
be83c11fb0 Add canonical import comment
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 4f0d95fa6ee7f865597c03b9e63702cdcb0f7067
Component: engine
2018-02-05 16:51:57 -05:00
044d7f995b Update libcontainerd to use containerd 1.0
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: ddae20c032058a0fd42c34c2e9750ee8f6296ac8
Component: engine
2017-10-20 07:11:37 -07:00
18c29c5c5f Add gosimple linter
Update gometalinter

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: f7f101d57ef8cbf2d8723a18b7d723c5c5dd04b6
Component: engine
2017-09-12 12:09:59 -04:00
30f1b651e2 Remove string checking in API error handling
Use strongly typed errors to set HTTP status codes.
Error interfaces are defined in the api/errors package and errors
returned from controllers are checked against these interfaces.

Errors can be wraeped in a pkg/errors.Causer, as long as somewhere in the
line of causes one of the interfaces is implemented. The special error
interfaces take precedence over Causer, meaning if both Causer and one
of the new error interfaces are implemented, the Causer is not
traversed.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: ebcb7d6b406fe50ea9a237c73004d75884184c33
Component: engine
2017-08-15 16:01:11 -04:00
d659edcaf5 Update logrus to v1.0.1
Fixes case sensitivity issue

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
Upstream-commit: 1009e6a40b295187e038b67e184e9c0384d95538
Component: engine
2017-07-31 13:16:46 -07:00
643654c2f0 Spelling fixes
* additional
* ambiguous
* anonymous
* anything
* application
* because
* before
* building
* capabilities
* circumstances
* commit
* committer
* compresses
* concatenated
* config
* container
* container's
* current
* definition
* delimiter
* disassociates
* discovery
* distributed
* doesnotexist
* downloads
* duplicates
* either
* enhancing
* enumerate
* escapable
* exactly
* expect
* expectations
* expected
* explicitly
* false
* filesystem
* following
* forbidden
* git with
* healthcheck
* ignore
* independent
* inheritance
* investigating
* irrelevant
* it
* logging
* looking
* membership
* mimic
* minimum
* modify
* mountpoint
* multiline
* notifier
* outputting
* outside
* overridden
* override
* parsable
* plugins
* precedence
* propagation
* provided
* provides
* registries
* repositories
* returning
* settings
* should
* signals
* someone
* something
* specifically
* successfully
* synchronize
* they've
* thinking
* uninitialized
* unintentionally
* unmarshaling
* unnamed
* unreferenced
* verify

Signed-off-by: Josh Soref <jsoref@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 39bcaee47b8a284a46b761afe218ba7deda0d482
Component: engine
2017-07-03 13:13:09 -07:00
a79192f925 Increase test Coverage of pkg/authorization
Signed-off-by: Raja Sami <raja.sami@tenpearls.com>
Upstream-commit: f1eb0c0ebb85af2ae5373f16fd529588c07815cc
Component: engine
2017-06-23 12:35:46 +05:00
142f748495 authz: remove and hide unused and local-only methods respectively
Signed-off-by: David Sheets <dsheets@docker.com>
Upstream-commit: 24264697c54843ea8dbd30ac37652409943e7bf4
Component: engine
2017-06-13 13:51:11 +01:00
8857822260 authz: eliminate race during plugin removal from middleware
Also, this removes the use of a questionable golang range feature which
corrects for mutation of a slice during iteration over that slice. This
makes the filter operation easier to read and reason about.

Signed-off-by: David Sheets <dsheets@docker.com>
Upstream-commit: 7da3986297e04b419ce08b19766633dba36b7d30
Component: engine
2017-06-13 13:51:07 +01:00
2034662b7a When authz plugin is disabled, remove from authz middleware chain.
When the daemon is configured to run with an authorization-plugin and if
the plugin is disabled, the daemon continues to send API requests to the
plugin and expect it to respond. But the plugin has been disabled. As a
result, all API requests are blocked. Fix this behavior by removing the
disabled plugin from the authz middleware chain.

Tested using riyaz/authz-no-volume-plugin and observed that after
disabling the plugin, API request/response is functional.

Fixes #31836

Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>
Upstream-commit: 38de272bd4dfea945985b7031cd353ac5f6507c5
Component: engine
2017-03-22 12:07:39 -07:00
b1d58a6a62 Fixed a typo within pkg/authorization/api.go
Signed-off-by: Diego Romero <idiegoromero@gmail.com>
Upstream-commit: 48b8f54876ff3269db46443eb91adeab2ea8b74b
Component: engine
2017-01-17 21:51:16 -05:00
8b3646ee75 plugingetter: Avoid all caps for constant declarations
Go style calls for mixed caps instead of all caps:
https://golang.org/doc/effective_go.html#mixed-caps

Change LOOKUP, ACQUIRE, and RELEASE to Lookup, Acquire, and Release.

This vendors a fork of libnetwork for now, to deal with a cyclic
dependency issue. The change will be upstream to libnetwork once this is
merged.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 428600108cce0a11e65ec4ebd9e439e947b55da7
Component: engine
2017-01-04 10:19:04 -08:00
e5912f7d7e Rename Remote API to Engine API
Implementation of https://github.com/docker/docker/issues/28319

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
Upstream-commit: f0d55cd081c6e8ad2a8222c787d54f9aae15723f
Component: engine
2016-11-22 12:49:38 +00:00
abdf1bbec3 Revert "Update authz plugin list on failure."
This reverts commit fae904af02a184833d2cd5ce9fdd61a4083707c7.

Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
Upstream-commit: a64fc8eea3266968c8e0082dbe6a2f5a8a5bbdc0
Component: engine
2016-11-03 15:49:21 -07:00
19be62abc4 pkg/authorization: send request's TLS peer certificates to plugins
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: 1452c1cc718006c72c4b7876d4b3c0a08281074e
Component: engine
2016-10-31 17:37:19 +01:00
78119ce904 Update authz plugin list on failure.
When daemon fails to load an authz plugin, it should be removed from
the plugin list. Else the plugin is retried on every request and
response, resulting in undesired behavior (eg. daemon panic)

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: fae904af02a184833d2cd5ce9fdd61a4083707c7
Component: engine
2016-10-28 11:16:06 -07:00
8fb804fc58 Fix the typo of URLs
Signed-off-by: YuPengZTE <yu.peng36@zte.com.cn>
Upstream-commit: fa378413f88054d0a336d675e7280930ddc86cb2
Component: engine
2016-10-19 17:46:27 +08:00
3643ef102a Merge pull request #27267 from ezrasilvera/plugin_fix
Call the AuthZRes function also when the daemon  returns error
Upstream-commit: 194f04bbbe5b4de06235bf56b8842cadac0294dc
Component: engine
2016-10-18 21:53:43 -07:00
1f94129ec0 Merge pull request #27293 from anusha-ragunathan/use-pluginv2-authz
Make authz use pluginv2
Upstream-commit: 8658748ef716e43a5f6d834825d818012ed6e2c4
Component: engine
2016-10-13 00:28:43 +02:00
2a20bc38c9 pkg/authorization: make it goroutine-safe
It was racy on config reload

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: a616cf3b88ee264b9a565dc0c25e583444ba64e2
Component: engine
2016-10-11 16:31:45 -07:00
d71f1080b9 Make authorization plugins use pluginv2.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: c5393ee147e981ded8fdf12c8da790abd1130175
Component: engine
2016-10-11 13:09:28 -07:00
8544599d78 Call the AuthZRes function also when the daemon returns error
Signed-off-by: Ezra Silvera <ezra@il.ibm.com>
Upstream-commit: 5a8ff4025408ed7a30a829008edf509c02f7a258
Component: engine
2016-10-11 09:53:30 +03:00
1a72f2bb5c Fix AuthZ plugins headers change issue
This fix tries to address the issue raised in 25927 where
the HTTP headers have been chaged when AUthZ plugin is in
place.

This issue is that in `FlushAll` (`pkg/authorization/response.go`),
the headers have been written (with `WriteHeader`) before all the
headers have bee copied.

This fix fixes the issue by placing `WriteHeader` after.

A test has been added to cover the changes.`

This fix fixes 25927

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 9cb8fb6ea03fcd78010ce7dd33585d96cd73e38c
Component: engine
2016-08-23 21:08:23 -07:00
565fab494f Enable to dynamically reload authorization plugins via daemon.config
Following #22729, enable to dynamically reload/remove the daemon
authorization plugins (via standard reloading mechanism).
https://docs.docker.com/engine/reference/commandline/daemon/#daemon-
configuration-file

Daemon must store a reference to the authorization middleware to refresh
the plugin on configuration changes.

Signed-off-by: Liron Levin <liron@twistlock.com>
Upstream-commit: 4192fe9c06d150fadfe18f228a6f9c3875227b8a
Component: engine
2016-07-30 14:59:07 +03:00
8e3d8789cb Merge pull request #24963 from allencloud/fix-typos
fix typos
Upstream-commit: 40044cb18fd4ff0ed13d8cdd41ec4dcecdac0703
Component: engine
2016-07-25 09:39:48 +02:00
7ce557c2bc Func name wrong in notes of response.go
Signed-off-by: lixiaobing10051267 <li.xiaobing1@zte.com.cn>
Upstream-commit: d6556a6ef716387122574e37cce4f009b1e21c25
Component: engine
2016-07-23 16:03:27 +08:00
1c3431e16a fix typos
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 4e959ef2f7f063803d04e06166f459257eb94b5c
Component: engine
2016-07-23 11:32:23 +08:00
7f898cc8b4 Use const http status code instead of just numbers see #24783
Signed-off-by: Doron Podoleanu <doronp@il.ibm.com>
Upstream-commit: 6bec735c91c378e1c9cde1744e7c8aca7397104a
Component: engine
2016-07-19 10:40:20 +03:00
848e510213 plugins: experimental support for new plugin management
This patch introduces a new experimental engine-level plugin management
with a new API and command line. Plugins can be distributed via a Docker
registry, and their lifecycle is managed by the engine.
This makes plugins a first-class construct.

For more background, have a look at issue #20363.

Documentation is in a separate commit. If you want to understand how the
new plugin system works, you can start by reading the documentation.

Note: backwards compatibility with existing plugins is maintained,
albeit they won't benefit from the advantages of the new system.

Signed-off-by: Tibor Vass <tibor@docker.com>
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: f37117045c5398fd3dca8016ea8ca0cb47e7312b
Component: engine
2016-06-14 14:20:27 -07:00
abe6b8e4ec Merge pull request #23425 from runcom/authz-race
pkg: authorization: lock when lazy loading
Upstream-commit: 5338ae713347aa8c1139cbcfd8e07746eff52a51
Component: engine
2016-06-13 23:20:37 +02:00
87c4c2885f authz: cleanups
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: d1b7e8373bde77819a25fce94bdfa9725608215e
Component: engine
2016-06-12 17:23:19 +02:00
a734e84285 pkg: authorization: lock when lazy loading
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: ceb9c5a88b5fa7d0b6c0901fa6b44ec89e81c2dc
Component: engine
2016-06-12 17:19:43 +02:00
04ae4edf2f Fix logrus formatting
This fix tries to fix logrus formatting by removing `f` from
`logrus.[Error|Warn|Debug|Fatal|Panic|Info]f` when formatting string
is not present.

This fix fixes #23459.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: a72b45dbec3caeb3237d1af5aedd04adeb083571
Component: engine
2016-06-11 13:16:55 -07:00
35c5774373 fix typos
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: c1be45fa38e82054dcad606d71446a662524f2d5
Component: engine
2016-06-02 17:17:22 +08:00
ec0b8580b4 Fix racy tests in pkg/authorization
Fix #23012

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Upstream-commit: f437e2d1485bfb64ac0ecc85ac3b14975e9f51f6
Component: engine
2016-06-01 03:25:56 +00:00
2e52fc323e pkg: authorization: cleanup tests
- do use use log pkg
- do not t.Fatal in goroutine
- cleanups

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: 6a96684442a7e9d6e2d00e9b11d23ea6caa88a2a
Component: engine
2016-05-08 14:18:38 +02:00
fe5c78bee9 fix typos
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 3f77baf2ce3a607fd1eb8fbe6e9dd9da44a8db49
Component: engine
2016-05-06 18:23:11 +08:00
b33e8d5489 Fix authorization issue - when request is denied return forbbiden exist code (403).
- Return 403 (forbidden) when request is denied in authorization flows
(including integration test)
- Fix #22428
- Close #22431

Signed-off-by: Liron Levin <liron@twistlock.com>
Upstream-commit: 526abc00b138a168fb248c98efd1b90fdf679036
Component: engine
2016-05-02 19:14:48 +03:00
8194e834c4 Move middleware to interfaces.
This makes separating middlewares from the core api easier.
As an example, the authorization middleware is moved to
it's own package.

Initialize all static middlewares when the server is created, reducing
allocations every time a route is wrapper with the middlewares.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 8d3467626ee26cad48ad84f2181552dce7afccb6
Component: engine
2016-04-11 09:19:27 -07:00
7c3f3d665e pkg: cleanup some unused code
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 07b568cb5342789839aabba0ee6d41e7275099e8
Component: engine
2016-03-31 11:39:59 -07:00
ae0977f1d1 fix variables that werent being called
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
Upstream-commit: 0e025b4bb16c0d4cc6b3f0c040713d061b9b051a
Component: engine
2016-03-17 13:19:55 -07:00