Signed-off-by: Dima Stopel <dima@twistlock.com>
| ... | ... |
@@ -13,7 +13,7 @@ weight = -1 |
| 13 | 13 |
# Create an authorization plugin |
| 14 | 14 |
|
| 15 | 15 |
Docker’s out-of-the-box authorization model is all or nothing. Any user with |
| 16 |
-permission to access to the Docker daemon can run any Docker client command. The |
|
| 16 |
+permission to access the Docker daemon can run any Docker client command. The |
|
| 17 | 17 |
same is true for callers using Docker's remote API to contact the daemon. If you |
| 18 | 18 |
require greater access control, you can create authorization plugins and add |
| 19 | 19 |
them to your Docker daemon configuration. Using an authorization plugin, a |
| ... | ... |
@@ -27,13 +27,13 @@ and methods information available to an authorization plugin developer. |
| 27 | 27 |
|
| 28 | 28 |
## Basic principles |
| 29 | 29 |
|
| 30 |
-Docker's [plugin infrastructure](http://docs.docker.com/engine/extend/plugin_api) enables |
|
| 31 |
-extending Docker by dynamically loading, removing and communicating with |
|
| 30 |
+Docker's [plugin infrastructure](plugin_api.md) enables |
|
| 31 |
+extending Docker by loading, removing and communicating with |
|
| 32 | 32 |
third-party components using a generic API. The access authorization subsystem |
| 33 | 33 |
was built using this mechanism. |
| 34 | 34 |
|
| 35 | 35 |
Using this subsystem, you don't need to rebuild the Docker daemon to add an |
| 36 |
-authorization plugin. You can add a plugin to a installed Docker daemon. You do |
|
| 36 |
+authorization plugin. You can add a plugin to an installed Docker daemon. You do |
|
| 37 | 37 |
need to restart the Docker daemon to add a new plugin. |
| 38 | 38 |
|
| 39 | 39 |
An authorization plugin approves or denies requests to the Docker daemon based |
| ... | ... |
@@ -41,9 +41,9 @@ on both the current authentication context and the command context. The |
| 41 | 41 |
authentication context contains all user details and the authentication method. |
| 42 | 42 |
The command context contains all the relevant request data. |
| 43 | 43 |
|
| 44 |
-Authorization plugins must follow the rules described in [Docker Plugin API](http://docs.docker.com/engine/extend/plugin_api/). |
|
| 45 |
-Each plugin must reside within directories described under the [plugin discovery](http://docs.docker.com/engine/extend/plugin_api/#plugin-discovery) |
|
| 46 |
-section. |
|
| 44 |
+Authorization plugins must follow the rules described in [Docker Plugin API](plugin_api.md). |
|
| 45 |
+Each plugin must reside within directories described under the |
|
| 46 |
+[Plugin discovery](plugin_api.md#plugin-discovery) section. |
|
| 47 | 47 |
|
| 48 | 48 |
## Basic architecture |
| 49 | 49 |
|
| ... | ... |
@@ -58,12 +58,11 @@ authentication plugin(s). The request contains the user (caller) and command |
| 58 | 58 |
context. The plugin is responsible for deciding whether to allow or deny the |
| 59 | 59 |
request. |
| 60 | 60 |
|
| 61 |
-Below please find tow sequence diagrams describing the *allow* and *deny* |
|
| 62 |
-authorization flows: |
|
| 61 |
+The sequence diagrams below depict an allow and deny authorization flow: |
|
| 63 | 62 |
|
| 64 |
- |
|
| 63 |
+ |
|
| 65 | 64 |
|
| 66 |
- |
|
| 65 |
+ |
|
| 67 | 66 |
|
| 68 | 67 |
Each request sent to the plugin includes the authenticated user, the HTTP |
| 69 | 68 |
headers, and the request/response body. Only the user name and the |
| ... | ... |
@@ -72,15 +71,15 @@ credentials or tokens are passed. Finally, not all request/response bodies |
| 72 | 72 |
are sent to the authorization plugin. Only those request/response bodies where |
| 73 | 73 |
the `Content-Type` is either `text/*` or `application/json` are sent. |
| 74 | 74 |
|
| 75 |
-For commands that can potentially the hijack the HTTP connection (`HTTP |
|
| 76 |
-Upgrade`), such as `exec`, the authorization plugin are only called for the |
|
| 75 |
+For commands that can potentially hijack the HTTP connection (`HTTP |
|
| 76 |
+Upgrade`), such as `exec`, the authorization plugin is only called for the |
|
| 77 | 77 |
initial HTTP requests. Once the plugin approves the command, authorization is |
| 78 | 78 |
not applied to the rest of the flow. Specifically, the streaming data is not |
| 79 | 79 |
passed to the authorization plugins. For commands that return chunked HTTP |
| 80 |
-response, such as `logs` and `events`, only the HTTP request are sent to the |
|
| 81 |
-authorization plugins as well. |
|
| 80 |
+response, such as `logs` and `events`, only the HTTP request is sent to the |
|
| 81 |
+authorization plugins. |
|
| 82 | 82 |
|
| 83 |
-During request/response processing, some authorization plugins flows might |
|
| 83 |
+During request/response processing, some authorization flows might |
|
| 84 | 84 |
need to do additional queries to the Docker daemon. To complete such flows, |
| 85 | 85 |
plugins can call the daemon API similar to a regular user. To enable these |
| 86 | 86 |
additional queries, the plugin must provide the means for an administrator to |
| ... | ... |
@@ -88,7 +87,8 @@ configure proper authentication and security policies. |
| 88 | 88 |
|
| 89 | 89 |
## Docker client flows |
| 90 | 90 |
|
| 91 |
-To enable and configure the authorization plugin, the plugin developer must support the Docker client interactions detailed in this section. |
|
| 91 |
+To enable and configure the authorization plugin, the plugin developer must |
|
| 92 |
+support the Docker client interactions detailed in this section. |
|
| 92 | 93 |
|
| 93 | 94 |
### Setting up Docker daemon |
| 94 | 95 |
|
| ... | ... |
@@ -96,17 +96,18 @@ Enable the authorization plugin with a dedicated command line flag in the |
| 96 | 96 |
`--authz-plugins=PLUGIN_ID` format. The flag supplies a `PLUGIN_ID` value. |
| 97 | 97 |
This value can be the plugin’s socket or a path to a specification file. |
| 98 | 98 |
|
| 99 |
-``` |
|
| 100 |
-$ docker daemon --authz-plugins=plugin1 --auth-plugins=plugin2,... |
|
| 99 |
+```bash |
|
| 100 |
+$ docker daemon --authz-plugins=plugin1 --authz-plugins=plugin2,... |
|
| 101 | 101 |
``` |
| 102 | 102 |
|
| 103 |
-Docker's authorization subsystem supports multiple `--authz-plugin` parameters. |
|
| 103 |
+Docker's authorization subsystem supports multiple `--authz-plugins` parameters. |
|
| 104 | 104 |
|
| 105 | 105 |
### Calling authorized command (allow) |
| 106 | 106 |
|
| 107 |
-Your plugin must support calling the `allow` command to authorize a command. This call does not impact Docker's command line. |
|
| 107 |
+Your plugin must support calling the `allow` command to authorize a command. |
|
| 108 |
+This call does not impact Docker's command line. |
|
| 108 | 109 |
|
| 109 |
-``` |
|
| 110 |
+```bash |
|
| 110 | 111 |
$ docker pull centos |
| 111 | 112 |
... |
| 112 | 113 |
f1b10cd84249: Pull complete |
| ... | ... |
@@ -115,12 +116,17 @@ f1b10cd84249: Pull complete |
| 115 | 115 |
|
| 116 | 116 |
### Calling unauthorized command (deny) |
| 117 | 117 |
|
| 118 |
-Your plugin must support calling the `deny` command to report on the outcome of a plugin interaction. This call returns messages to Docker's command line informing the user of the outcome of each call. |
|
| 118 |
+Your plugin must support calling the `deny` command to report on the outcome of |
|
| 119 |
+a plugin interaction. This call returns messages to Docker's command line informing |
|
| 120 |
+the user of the outcome of each call. |
|
| 119 | 121 |
|
| 120 |
-``` |
|
| 122 |
+```bash |
|
| 121 | 123 |
$ docker pull centos |
| 122 | 124 |
… |
| 123 |
-Authorization failed. Pull command for user 'john_doe' is denied by authorization plugin 'ACME' with message ‘[ACME] User 'john_doe' is not allowed to perform the pull command’ |
|
| 125 |
+Authorization failed. Pull command for user 'john_doe' is |
|
| 126 |
+denied by authorization plugin 'ACME' with message |
|
| 127 |
+‘[ACME] User 'john_doe' is not allowed to perform the pull |
|
| 128 |
+command’ |
|
| 124 | 129 |
``` |
| 125 | 130 |
|
| 126 | 131 |
Where multiple authorization plugins are installed, multiple messages are expected. |
| ... | ... |
@@ -128,7 +134,8 @@ Where multiple authorization plugins are installed, multiple messages are expect |
| 128 | 128 |
|
| 129 | 129 |
## API schema and implementation |
| 130 | 130 |
|
| 131 |
-Sample code for a typical plugin can be found here [ADD LINK]. In addition to Docker's standard plugin registration method, each plugin should implement the following two methods: |
|
| 131 |
+In addition to Docker's standard plugin registration method, each plugin |
|
| 132 |
+should implement the following two methods: |
|
| 132 | 133 |
|
| 133 | 134 |
* `/AuthzPlugin.AuthZReq` This authorize request method is called before the Docker daemon processes the client request. |
| 134 | 135 |
|
| ... | ... |
@@ -138,7 +145,7 @@ Sample code for a typical plugin can be found here [ADD LINK]. In addition to Do |
| 138 | 138 |
|
| 139 | 139 |
**Request**: |
| 140 | 140 |
|
| 141 |
-``` |
|
| 141 |
+```json |
|
| 142 | 142 |
{
|
| 143 | 143 |
"User": "The user identification" |
| 144 | 144 |
"UserAuthNMethod": "The authentication method used" |
| ... | ... |
@@ -152,7 +159,7 @@ Sample code for a typical plugin can be found here [ADD LINK]. In addition to Do |
| 152 | 152 |
|
| 153 | 153 |
**Response**: |
| 154 | 154 |
|
| 155 |
-``` |
|
| 155 |
+```json |
|
| 156 | 156 |
{
|
| 157 | 157 |
"Allow" : "Determined whether the user is allowed or not" |
| 158 | 158 |
"Msg": "The authorization message" |
| ... | ... |
@@ -162,7 +169,8 @@ Sample code for a typical plugin can be found here [ADD LINK]. In addition to Do |
| 162 | 162 |
#### /AuthzPlugin.AuthZRes |
| 163 | 163 |
|
| 164 | 164 |
**Request**: |
| 165 |
-``` |
|
| 165 |
+ |
|
| 166 |
+```json |
|
| 166 | 167 |
{
|
| 167 | 168 |
"User": "The user identification" |
| 168 | 169 |
"UserAuthNMethod": "The authentication method used" |
| ... | ... |
@@ -178,7 +186,8 @@ Sample code for a typical plugin can be found here [ADD LINK]. In addition to Do |
| 178 | 178 |
``` |
| 179 | 179 |
|
| 180 | 180 |
**Response**: |
| 181 |
-``` |
|
| 181 |
+ |
|
| 182 |
+```json |
|
| 182 | 183 |
{
|
| 183 | 184 |
"Allow" : "Determined whether the user is allowed or not" |
| 184 | 185 |
"Msg": "The authorization message" |
| ... | ... |
@@ -610,7 +610,7 @@ authorization plugins when you start the Docker `daemon` using the |
| 610 | 610 |
`--authz-plugins=PLUGIN_ID` option. |
| 611 | 611 |
|
| 612 | 612 |
```bash |
| 613 |
-docker daemon --authz-plugins=plugin1 --auth-plugins=plugin2,... |
|
| 613 |
+docker daemon --authz-plugins=plugin1 --authz-plugins=plugin2,... |
|
| 614 | 614 |
``` |
| 615 | 615 |
|
| 616 | 616 |
The `PLUGIN_ID` value is either the plugin's name or a path to its specification |
| ... | ... |
@@ -624,8 +624,7 @@ multiple plugins installed, at least one must allow the request for it to |
| 624 | 624 |
complete. |
| 625 | 625 |
|
| 626 | 626 |
For information about how to create an authorization plugin, see [authorization |
| 627 |
-plugin](https://docs.docker.com/engine/extend/authorization/) section in the |
|
| 628 |
-Docker extend section of this documentation. |
|
| 627 |
+plugin](../../extend/authorization.md) section in the Docker extend section of this documentation. |
|
| 629 | 628 |
|
| 630 | 629 |
|
| 631 | 630 |
## Miscellaneous options |
| ... | ... |
@@ -7,6 +7,7 @@ docker-daemon - Enable daemon mode |
| 7 | 7 |
# SYNOPSIS |
| 8 | 8 |
**docker daemon** |
| 9 | 9 |
[**--api-cors-header**=[=*API-CORS-HEADER*]] |
| 10 |
+[**--authz-plugins**[=*[]*]] |
|
| 10 | 11 |
[**-b**|**--bridge**[=*BRIDGE*]] |
| 11 | 12 |
[**--bip**[=*BIP*]] |
| 12 | 13 |
[**--cluster-store**[=*[]*]] |
| ... | ... |
@@ -70,6 +71,9 @@ format. |
| 70 | 70 |
**--api-cors-header**="" |
| 71 | 71 |
Set CORS headers in the remote API. Default is cors disabled. Give urls like "http://foo, http://bar, ...". Give "*" to allow all. |
| 72 | 72 |
|
| 73 |
+**--authz-plugins**="" |
|
| 74 |
+ Set authorization plugins to load |
|
| 75 |
+ |
|
| 73 | 76 |
**-b**, **--bridge**="" |
| 74 | 77 |
Attach containers to a pre\-existing network bridge; use 'none' to disable container networking |
| 75 | 78 |
|
| ... | ... |
@@ -456,6 +460,31 @@ Specifies the path to a local file with a PEM encoded private key. This |
| 456 | 456 |
private key is used as the client key for communication with the |
| 457 | 457 |
Key/Value store. |
| 458 | 458 |
|
| 459 |
+# Access authorization |
|
| 460 |
+ |
|
| 461 |
+Docker's access authorization can be extended by authorization plugins that your |
|
| 462 |
+organization can purchase or build themselves. You can install one or more |
|
| 463 |
+authorization plugins when you start the Docker `daemon` using the |
|
| 464 |
+`--authz-plugins=PLUGIN_ID` option. |
|
| 465 |
+ |
|
| 466 |
+```bash |
|
| 467 |
+docker daemon --authz-plugins=plugin1 --authz-plugins=plugin2,... |
|
| 468 |
+``` |
|
| 469 |
+ |
|
| 470 |
+The `PLUGIN_ID` value is either the plugin's name or a path to its specification |
|
| 471 |
+file. The plugin's implementation determines whether you can specify a name or |
|
| 472 |
+path. Consult with your Docker administrator to get information about the |
|
| 473 |
+plugins available to you. |
|
| 474 |
+ |
|
| 475 |
+Once a plugin is installed, requests made to the `daemon` through the command |
|
| 476 |
+line or Docker's remote API are allowed or denied by the plugin. If you have |
|
| 477 |
+multiple plugins installed, at least one must allow the request for it to |
|
| 478 |
+complete. |
|
| 479 |
+ |
|
| 480 |
+For information about how to create an authorization plugin, see [authorization |
|
| 481 |
+plugin](https://docs.docker.com/engine/extend/authorization.md) section in the |
|
| 482 |
+Docker extend section of this documentation. |
|
| 483 |
+ |
|
| 459 | 484 |
|
| 460 | 485 |
# HISTORY |
| 461 | 486 |
Sept 2015, Originally compiled by Shishir Mahajan <shishir.mahajan@redhat.com> |