Skip to content

Instantly share code, notes, and snippets.

@fermayo
Last active August 29, 2015 14:01
Show Gist options
  • Select an option

  • Save fermayo/84d59bbd257acdfbd5d7 to your computer and use it in GitHub Desktop.

Select an option

Save fermayo/84d59bbd257acdfbd5d7 to your computer and use it in GitHub Desktop.
Generate a key pair for Docker
#!/bin/sh
CERT_PATH="$HOME/.docker"
mkdir -p ${CERT_PATH}
if [ ! -f "$CERT_PATH/key.pem" ]; then
echo "Generating a new certificate in $CERT_PATH..."
openssl req -new -newkey rsa:4096 -days 3650 -nodes -x509 -subj "/C=US/ST=NewYork/L=NYC/O=Tutum/CN=tutum.user" -keyout ${CERT_PATH}/key.pem -out ${CERT_PATH}/cert.pem >/dev/null 2>&1
echo "This is your new public certificate which you can add to your Tutum account:"
else
echo "WARNING: An existing certificate has been found in $CERT_PATH"
echo "This is your existing public certificate which you can add to your Tutum account:"
fi
cat ${CERT_PATH}/cert.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment