Created
August 11, 2016 18:27
-
-
Save shawnjohnson/a9b1c969d93d1f3ffdc01dbbc5ba7fc9 to your computer and use it in GitHub Desktop.
inject custom 'proxy' certificate to docker-for-mac beta (1.12.0-rc4-beta20 build:10404)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$#" -ne 2 ] || ! [ -d "$1" ]; then | |
echo "Usage: $0 /Path/To/Certificate CERT_NAME" >&2 | |
exit 1 | |
fi | |
# This assumes the cert is in the same directory as the script | |
source="$( cd $1 && pwd )" | |
# ca-certificate of the VM | |
destination=/usr/local/share/ca-certificates/ | |
proxycert=proxy.crt | |
# Send a new line to wake it up, then login as root with a blank password | |
cat <<HERE > ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty | |
root | |
HERE | |
# Give it a second to get logged in, copy the cert and log back out | |
cat <<HERE > ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty | |
mkdir -p $destination | |
# copy cert to new file | |
cat $source/$2 >> $destination$proxycert | |
update-ca-certificates | |
exit | |
HERE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment