Docker-DCO-1.1-Signed-off-by: AJ Bowen <aj@gandi.net> (github: soulshake)
| ... | ... |
@@ -1,5 +1,5 @@ |
| 1 | 1 |
page_title: Docker HTTPS Setup |
| 2 |
-page_description: How to setup docker with https |
|
| 2 |
+page_description: How to set Docker up with https |
|
| 3 | 3 |
page_keywords: docker, example, https, daemon |
| 4 | 4 |
|
| 5 | 5 |
# Running Docker with https |
| ... | ... |
@@ -7,17 +7,17 @@ page_keywords: docker, example, https, daemon |
| 7 | 7 |
By default, Docker runs via a non-networked Unix socket. It can also |
| 8 | 8 |
optionally communicate using a HTTP socket. |
| 9 | 9 |
|
| 10 |
-If you need Docker reachable via the network in a safe manner, you can |
|
| 11 |
-enable TLS by specifying the tlsverify flag and pointing Docker's |
|
| 12 |
-tlscacert flag to a trusted CA certificate. |
|
| 10 |
+If you need Docker to be reachable via the network in a safe manner, you can |
|
| 11 |
+enable TLS by specifying the `tlsverify` flag and pointing Docker's |
|
| 12 |
+`tlscacert` flag to a trusted CA certificate. |
|
| 13 | 13 |
|
| 14 | 14 |
In daemon mode, it will only allow connections from clients |
| 15 | 15 |
authenticated by a certificate signed by that CA. In client mode, it |
| 16 | 16 |
will only connect to servers with a certificate signed by that CA. |
| 17 | 17 |
|
| 18 | 18 |
> **Warning**: |
| 19 |
-> Using TLS and managing a CA is an advanced topic. Please make you self |
|
| 20 |
-> familiar with OpenSSL, x509 and TLS before using it in production. |
|
| 19 |
+> Using TLS and managing a CA is an advanced topic. Please familiarize yourself |
|
| 20 |
+> with OpenSSL, x509 and TLS before using it in production. |
|
| 21 | 21 |
|
| 22 | 22 |
> **Warning**: |
| 23 | 23 |
> These TLS commands will only generate a working set of certificates on Linux. |
| ... | ... |
@@ -34,11 +34,11 @@ keys: |
| 34 | 34 |
$ openssl req -new -x509 -days 365 -key ca-key.pem -out ca.pem |
| 35 | 35 |
|
| 36 | 36 |
Now that we have a CA, you can create a server key and certificate |
| 37 |
-signing request. Make sure that "Common Name (e.g. server FQDN or YOUR |
|
| 38 |
-name)" matches the hostname you will use to connect to Docker: |
|
| 37 |
+signing request (CSR). Make sure that "Common Name" (i.e. server FQDN or YOUR |
|
| 38 |
+name) matches the hostname you will use to connect to Docker: |
|
| 39 | 39 |
|
| 40 | 40 |
$ openssl genrsa -des3 -out server-key.pem 2048 |
| 41 |
- $ openssl req -subj '/CN=**<Your Hostname Here>**' -new -key server-key.pem -out server.csr |
|
| 41 |
+ $ openssl req -subj '/CN=<Your Hostname Here>' -new -key server-key.pem -out server.csr |
|
| 42 | 42 |
|
| 43 | 43 |
Next we're going to sign the key with our CA: |
| 44 | 44 |
|
| ... | ... |
@@ -51,7 +51,7 @@ request: |
| 51 | 51 |
$ openssl genrsa -des3 -out client-key.pem 2048 |
| 52 | 52 |
$ openssl req -subj '/CN=client' -new -key client-key.pem -out client.csr |
| 53 | 53 |
|
| 54 |
-To make the key suitable for client authentication, create a extensions |
|
| 54 |
+To make the key suitable for client authentication, create an extensions |
|
| 55 | 55 |
config file: |
| 56 | 56 |
|
| 57 | 57 |
$ echo extendedKeyUsage = clientAuth > extfile.cnf |
| ... | ... |
@@ -61,8 +61,7 @@ Now sign the key: |
| 61 | 61 |
$ openssl x509 -req -days 365 -in client.csr -CA ca.pem -CAkey ca-key.pem \ |
| 62 | 62 |
-out client-cert.pem -extfile extfile.cnf |
| 63 | 63 |
|
| 64 |
-Finally you need to remove the passphrase from the client and server |
|
| 65 |
-key: |
|
| 64 |
+Finally, you need to remove the passphrase from the client and server key: |
|
| 66 | 65 |
|
| 67 | 66 |
$ openssl rsa -in server-key.pem -out server-key.pem |
| 68 | 67 |
$ openssl rsa -in client-key.pem -out client-key.pem |
| ... | ... |
@@ -83,9 +82,8 @@ need to provide your client keys, certificates and trusted CA: |
| 83 | 83 |
> Docker over TLS should run on TCP port 2376. |
| 84 | 84 |
|
| 85 | 85 |
> **Warning**: |
| 86 |
-> As shown in the example above, you don't have to run the |
|
| 87 |
-> `docker` client with `sudo` or |
|
| 88 |
-> the `docker` group when you use certificate |
|
| 86 |
+> As shown in the example above, you don't have to run the `docker` client |
|
| 87 |
+> with `sudo` or the `docker` group when you use certificate |
|
| 89 | 88 |
> authentication. That means anyone with the keys can give any |
| 90 | 89 |
> instructions to your Docker daemon, giving them root access to the |
| 91 | 90 |
> machine hosting the daemon. Guard these keys as you would a root |
| ... | ... |
@@ -112,20 +110,20 @@ Docker in various other modes by mixing the flags. |
| 112 | 112 |
|
| 113 | 113 |
### Daemon modes |
| 114 | 114 |
|
| 115 |
- - tlsverify, tlscacert, tlscert, tlskey set: Authenticate clients |
|
| 116 |
- - tls, tlscert, tlskey: Do not authenticate clients |
|
| 115 |
+ - `tlsverify`, `tlscacert`, `tlscert`, `tlskey` set: Authenticate clients |
|
| 116 |
+ - `tls`, `tlscert`, `tlskey`: Do not authenticate clients |
|
| 117 | 117 |
|
| 118 | 118 |
### Client modes |
| 119 | 119 |
|
| 120 |
- - tls: Authenticate server based on public/default CA pool |
|
| 121 |
- - tlsverify, tlscacert: Authenticate server based on given CA |
|
| 122 |
- - tls, tlscert, tlskey: Authenticate with client certificate, do not |
|
| 120 |
+ - `tls`: Authenticate server based on public/default CA pool |
|
| 121 |
+ - `tlsverify`, `tlscacert`: Authenticate server based on given CA |
|
| 122 |
+ - `tls`, `tlscert`, `tlskey`: Authenticate with client certificate, do not |
|
| 123 | 123 |
authenticate server based on given CA |
| 124 |
- - tlsverify, tlscacert, tlscert, tlskey: Authenticate with client |
|
| 125 |
- certificate, authenticate server based on given CA |
|
| 124 |
+ - `tlsverify`, `tlscacert`, `tlscert`, `tlskey`: Authenticate with client |
|
| 125 |
+ certificate and authenticate server based on given CA |
|
| 126 | 126 |
|
| 127 | 127 |
The client will send its client certificate if found, so you just need |
| 128 |
-to drop your keys into ~/.docker/<ca, cert or key>.pem. Alternatively, if you |
|
| 128 |
+to drop your keys into `~/.docker/<ca, cert or key>.pem`. Alternatively, if you |
|
| 129 | 129 |
want to store your keys in another location, you can specify that location |
| 130 | 130 |
using the environment variable `DOCKER_CONFIG`. |
| 131 | 131 |
|