From 90458c9b296438c19eeb35a62f6ba3d63b87550c Mon Sep 17 00:00:00 2001 From: cytopia Date: Mon, 14 May 2018 21:33:36 +0200 Subject: [PATCH] Trust custom certificates/CA if you choose to --- .../41-update-ca-certificates.sh | 26 +++++++++++++++++++ Dockerfiles/work/data/docker-entrypoint.sh | 6 +++++ README.md | 6 ++++- 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100755 Dockerfiles/work/data/docker-entrypoint.d/41-update-ca-certificates.sh diff --git a/Dockerfiles/work/data/docker-entrypoint.d/41-update-ca-certificates.sh b/Dockerfiles/work/data/docker-entrypoint.d/41-update-ca-certificates.sh new file mode 100755 index 00000000..53c21b3d --- /dev/null +++ b/Dockerfiles/work/data/docker-entrypoint.d/41-update-ca-certificates.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -e +set -u +set -o pipefail + + +############################################################ +# Functions +############################################################ + +### +### Include certificates/CAs into own system +### +update_ca_certificates() { + local dir="${1}" + local debug="${2}" + + if [ -d "${dir}" ]; then + for cert in $( find "${dir}" -name \*.crt ); do + name="$( basename "${cert}" )" + run "cp ${cert} /usr/local/share/ca-certificates/devilbox-${name}" "${debug}" + done + fi + run "update-ca-certificates" "${debug}" +} diff --git a/Dockerfiles/work/data/docker-entrypoint.sh b/Dockerfiles/work/data/docker-entrypoint.sh index fceedc10..f5ffc668 100755 --- a/Dockerfiles/work/data/docker-entrypoint.sh +++ b/Dockerfiles/work/data/docker-entrypoint.sh @@ -182,6 +182,12 @@ run "chmod 0755 /shared/backups" "${DEBUG_LEVEL}" run "chmod 0755 /shared/httpd" "${DEBUG_LEVEL}" +### +### Update ca-certificates +### +update_ca_certificates "/ca" "${DEBUG_LEVEL}" + + ### ### Startup ### diff --git a/README.md b/README.md index af402cba..0a72336c 100644 --- a/README.md +++ b/README.md @@ -697,7 +697,7 @@ Have a look at the following table to see all offered volumes for each Docker im - work + work /etc/bashrc-devilbox.d Mount this directory into your host computer and add custom configuration files for bash and other tools. @@ -705,6 +705,10 @@ Have a look at the following table to see all offered volumes for each Docker im /shared/backups Mount this directory into your host computer to access MySQL backups created by mysqldump-secure. + + /ca + Mount this directory into your host computer to bake any *.crt file that is located in there as a trusted SSL entity. +