Do not encrypt private keys in the first place, if the encryption
is stripped anyway.
Signed-off-by: Lorenz Leutgeb <lorenz.leutgeb@gmail.com>
| ... | ... |
@@ -15,13 +15,13 @@ In the daemon mode, it will only allow connections from clients |
| 15 | 15 |
authenticated by a certificate signed by that CA. In the client mode, |
| 16 | 16 |
it will only connect to servers with a certificate signed by that CA. |
| 17 | 17 |
|
| 18 |
-> **Warning**: |
|
| 18 |
+> **Warning**: |
|
| 19 | 19 |
> Using TLS and managing a CA is an advanced topic. Please familiarize yourself |
| 20 | 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. |
| 24 |
-> Mac OS X comes with a version of OpenSSL that is incompatible with the |
|
| 24 |
+> Mac OS X comes with a version of OpenSSL that is incompatible with the |
|
| 25 | 25 |
> certificates that Docker requires. |
| 26 | 26 |
|
| 27 | 27 |
## Create a CA, server and client keys with OpenSSL |
| ... | ... |
@@ -58,15 +58,12 @@ Now that we have a CA, you can create a server key and certificate |
| 58 | 58 |
signing request (CSR). Make sure that "Common Name" (i.e. server FQDN or YOUR |
| 59 | 59 |
name) matches the hostname you will use to connect to Docker: |
| 60 | 60 |
|
| 61 |
- $ openssl genrsa -des3 -out server-key.pem 2048 |
|
| 61 |
+ $ openssl genrsa -out server-key.pem 2048 |
|
| 62 | 62 |
Generating RSA private key, 2048 bit long modulus |
| 63 | 63 |
......................................................+++ |
| 64 | 64 |
............................................+++ |
| 65 | 65 |
e is 65537 (0x10001) |
| 66 |
- Enter pass phrase for server-key.pem: |
|
| 67 |
- Verifying - Enter pass phrase for server-key.pem: |
|
| 68 | 66 |
$ openssl req -subj '/CN=<Your Hostname Here>' -new -key server-key.pem -out server.csr |
| 69 |
- Enter pass phrase for server-key.pem: |
|
| 70 | 67 |
|
| 71 | 68 |
Next, we're going to sign the key with our CA: |
| 72 | 69 |
|
| ... | ... |
@@ -80,15 +77,12 @@ Next, we're going to sign the key with our CA: |
| 80 | 80 |
For client authentication, create a client key and certificate signing |
| 81 | 81 |
request: |
| 82 | 82 |
|
| 83 |
- $ openssl genrsa -des3 -out key.pem 2048 |
|
| 83 |
+ $ openssl genrsa -out key.pem 2048 |
|
| 84 | 84 |
Generating RSA private key, 2048 bit long modulus |
| 85 | 85 |
...............................................+++ |
| 86 | 86 |
...............................................................+++ |
| 87 | 87 |
e is 65537 (0x10001) |
| 88 |
- Enter pass phrase for key.pem: |
|
| 89 |
- Verifying - Enter pass phrase for key.pem: |
|
| 90 | 88 |
$ openssl req -subj '/CN=client' -new -key key.pem -out client.csr |
| 91 |
- Enter pass phrase for key.pem: |
|
| 92 | 89 |
|
| 93 | 90 |
To make the key suitable for client authentication, create an extensions |
| 94 | 91 |
config file: |
| ... | ... |
@@ -104,15 +98,6 @@ Now sign the key: |
| 104 | 104 |
Getting CA Private Key |
| 105 | 105 |
Enter pass phrase for ca-key.pem: |
| 106 | 106 |
|
| 107 |
-Finally, you need to remove the passphrase from the client and server key: |
|
| 108 |
- |
|
| 109 |
- $ openssl rsa -in server-key.pem -out server-key.pem |
|
| 110 |
- Enter pass phrase for server-key.pem: |
|
| 111 |
- writing RSA key |
|
| 112 |
- $ openssl rsa -in key.pem -out key.pem |
|
| 113 |
- Enter pass phrase for key.pem: |
|
| 114 |
- writing RSA key |
|
| 115 |
- |
|
| 116 | 107 |
Now you can make the Docker daemon only accept connections from clients |
| 117 | 108 |
providing a certificate trusted by our CA: |
| 118 | 109 |
|
| ... | ... |
@@ -128,7 +113,7 @@ need to provide your client keys, certificates and trusted CA: |
| 128 | 128 |
> **Note**: |
| 129 | 129 |
> Docker over TLS should run on TCP port 2376. |
| 130 | 130 |
|
| 131 |
-> **Warning**: |
|
| 131 |
+> **Warning**: |
|
| 132 | 132 |
> As shown in the example above, you don't have to run the `docker` client |
| 133 | 133 |
> with `sudo` or the `docker` group when you use certificate authentication. |
| 134 | 134 |
> That means anyone with the keys can give any instructions to your Docker |
| ... | ... |
@@ -137,7 +122,7 @@ need to provide your client keys, certificates and trusted CA: |
| 137 | 137 |
|
| 138 | 138 |
## Secure by default |
| 139 | 139 |
|
| 140 |
-If you want to secure your Docker client connections by default, you can move |
|
| 140 |
+If you want to secure your Docker client connections by default, you can move |
|
| 141 | 141 |
the files to the `.docker` directory in your home directory - and set the |
| 142 | 142 |
`DOCKER_HOST` and `DOCKER_TLS_VERIFY` variables as well (instead of passing |
| 143 | 143 |
`-H=tcp://:2376` and `--tlsverify` on every call). |