-
Notifications
You must be signed in to change notification settings - Fork 620
Add automatic TLS generation (and enable it by default in 19.03+) #166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
For images which don't support this feature, this will be a no-op.
|
Test updated in docker-library/official-images@7e44f39 👍 |
|
(We should probably also add a new |
|
(dat +529 −40 tho 😭) |
| [ -z "${DOCKER_TLS_SAN:-}" ] || echo "$DOCKER_TLS_SAN" | ||
| } | sort -u | xargs printf '%s,' | sed "s/,\$//" | ||
| } | ||
| _tls_generate_certs() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any chance to split this to a separate script so that it can be called from rootless entrypoint script? #165
This adds a `DOCKER_TLS_CERTDIR` environment variable that, when present, will auto-enable TLS on `dockerd` by default (and will set the appropriate client flags if the necessary certificates exist). It will attempt to generate a suitable `subjectAltName` extension value based on all available container IP addresses and hostnames, but the default generation can be extended via the `DOCKER_TLS_SAN` environment variable (in the standard OpenSSL format, ala `IP:n.n.n.n,DNS:foobar,...`). For users of 18.09 who wish to enable this behavior, simply set `DOCKER_TLS_CERTDIR` to a path within the container into which you want certificates generated (and share at least the `client` subdirectory of that path with your client containers). The default value in 19.03+ is `/certs` (so to mimic that, something like `-e DOCKER_TLS_CERTDIR=/certs` would be sufficient/appropriate). For users of 19.03+ who wish to *disable* this behavior (not recommended), simply set `DOCKER_TLS_CERTDIR` to the empty string (`-e DOCKER_TLS_CERTDIR=`).
|
opened #168 for splitting tls script |
Changes: - docker-library/docker@cad4d26: Merge pull request docker-library/docker#166 from infosiftr/auto-tls - docker-library/docker@651c075: Merge pull request docker-library/docker#167 from infosiftr/simpler-dind-example
|
Documentation PR is now open at docker-library/docs#1538 👍 |
Docker added a new TLS cert option in v19+, which is breaking dind usage in pipelines. This disables the 'auto-enable TLS' feature. see: - docker-library/docker#166 - https://gitlab.com/gitlab-com/gl-infra/production/issues/982 - https://gitlab.com/gitlab-org/gitlab-ce/issues/64968
The docker-in-docker image now enables TLS by default (added in docker-library/docker#166), which complicates testing in our environment, and isn't needed for the tests we're running. This patch sets the `DOCKER_TLS_CERTDIR` to an empty value to disable TLS. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The docker-in-docker image now enables TLS by default (added in docker-library/docker#166), which complicates testing in our environment, and isn't needed for the tests we're running. This patch sets the `DOCKER_TLS_CERTDIR` to an empty value to disable TLS. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit b1a3c1a) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The docker-in-docker image now enables TLS by default (added in docker-library/docker#166), which complicates testing in our environment, and isn't needed for the tests we're running. This patch sets the `DOCKER_TLS_CERTDIR` to an empty value to disable TLS. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit b1a3c1a) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The docker-in-docker image now enables TLS by default (added in docker-library/docker#166), which complicates testing in our environment, and isn't needed for the tests we're running. This patch sets the `DOCKER_TLS_CERTDIR` to an empty value to disable TLS. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit b1a3c1a) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The docker-in-docker image now enables TLS by default (added in docker-library/docker#166), which complicates testing in our environment, and isn't needed for the tests we're running. This patch sets the `DOCKER_TLS_CERTDIR` to an empty value to disable TLS. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit b1a3c1a) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The docker-in-docker image now enables TLS by default (added in docker-library/docker#166), which complicates testing in our environment, and isn't needed for the tests we're running. This patch sets the `DOCKER_TLS_CERTDIR` to an empty value to disable TLS. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Upstream-commit: b1a3c1aad1d802975af11c16fce1177f09d1d97e Component: cli
The docker-in-docker image now enables TLS by default (added in docker-library/docker#166), which complicates testing in our environment, and isn't needed for the tests we're running. This patch sets the `DOCKER_TLS_CERTDIR` to an empty value to disable TLS. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit b1a3c1aad1d802975af11c16fce1177f09d1d97e) Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Upstream-commit: 9c8ac0a1233944b0b3929bb34edc66d27c290293 Component: cli
The docker-in-docker image now enables TLS by default (added in docker-library/docker#166), which complicates testing in our environment, and isn't needed for the tests we're running. This patch sets the `DOCKER_TLS_CERTDIR` to an empty value to disable TLS. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit b1a3c1aad1d802975af11c16fce1177f09d1d97e) Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Upstream-commit: f357def0361cc2ae5f101ac95dff486ba4cd86c2 Component: cli
The `docker` Docker Hub repository lists what versions of the image are supported and 18.6 is not among them at all. Use the current stable line of 18.09 instead, to stay on supported versions. See more info at: https://hub.docker.com/_/docker Also add a required parameter to run images from 18.09.8-dind onwards, due to this change: docker-library/docker#166 Change-type: minor Signed-off-by: Gergely Imreh <gergely@balena.io>
The `docker` Docker Hub repository lists what versions of the image are supported and 18.6 is not among them at all. Use the current stable line of 18.09 instead, to stay on supported versions. See more info at: https://hub.docker.com/_/docker Also add a required parameter to run images from 18.09.8-dind onwards, due to this change: docker-library/docker#166 Here in effect disabling AutoTLS for the moment (TLS communication with the daemon) since it's all local anyways. Change-type: minor Signed-off-by: Gergely Imreh <gergely@balena.io>
The `docker` Docker Hub repository lists what versions of the image are supported and 18.6 is not among them at all. Use the current stable line of 18.09 instead, to stay on supported versions. See more info at: https://hub.docker.com/_/docker Also add a required parameter to run images from 18.09.8-dind onwards, due to this change: docker-library/docker#166 Update the test checking for docker being up, too. Change-type: minor Signed-off-by: Gergely Imreh <gergely@balena.io>
The `docker` Docker Hub repository lists what versions of the image are supported and 18.6 is not among them at all. Use the current stable line of 18.09 instead, to stay on supported versions. See more info at: https://hub.docker.com/_/docker Also added `DOCKER_HOST` as it affects `v18.09.8-dind` (which is trying to use tcp socket instead, it seems: docker-library/docker#175 after it enabled AutoTLS in docker-library/docker#166 Change-type: minor Signed-off-by: Gergely Imreh <gergely@balena.io>
- name: docker:dind
entrypoint: ["env", "-u", "DOCKER_HOST"]
command: ["dockerd-entrypoint.sh"]
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
# See docker-library/docker#166
DOCKER_TLS_CERTDIR: ""
- name: docker:dind
entrypoint: ["env", "-u", "DOCKER_HOST"]
command: ["dockerd-entrypoint.sh"]
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
# See docker-library/docker#166
DOCKER_TLS_CERTDIR: ""
- name: docker:dind
entrypoint: ["env", "-u", "DOCKER_HOST"]
command: ["dockerd-entrypoint.sh"]
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
# See docker-library/docker#166
DOCKER_TLS_CERTDIR: ""
Closes #164
Refs docker-library/docs#1525
This adds a
DOCKER_TLS_CERTDIRenvironment variable that, when present, will auto-enable TLS ondockerdby default (and will set the appropriate client flags if the necessary certificates exist).It will attempt to generate a suitable
subjectAltNameextension value based on all available container IP addresses and hostnames, but the default generation can be extended via theDOCKER_TLS_SANenvironment variable (in the standard OpenSSL format, alaIP:n.n.n.n,DNS:foobar,...).For users of 18.09 who wish to enable this behavior, simply set
DOCKER_TLS_CERTDIRto a path within the container into which you want certificates generated (and share at least theclientsubdirectory of that path with your client containers). The default value in 19.03+ is/certs(so to mimic that, something like-e DOCKER_TLS_CERTDIR=/certswould be sufficient/appropriate).For users of 19.03+ who wish to disable this behavior (not recommended), simply set
DOCKER_TLS_CERTDIRto the empty string (-e DOCKER_TLS_CERTDIR=).