Skip to content

Instantly share code, notes, and snippets.

@kingbin
Created November 15, 2019 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kingbin/c6a1473d8c8ce2f70762bca4a4d2bf8c to your computer and use it in GitHub Desktop.
Save kingbin/c6a1473d8c8ce2f70762bca4a4d2bf8c to your computer and use it in GitHub Desktop.
Docker API exposed from Mac Docker Desktop w TLS
export FILENAME=server
openssl genrsa -out $FILENAME.key 2048
openssl req -new -key $FILENAME.key -x509 -days 3653 -out $FILENAME.crt
cat $FILENAME.key $FILENAME.crt >$FILENAME.pem
chmod 600 $FILENAME.key $FILENAME.pem
export FILENAME=client
openssl genrsa -out $FILENAME.key 2048
openssl req -new -key $FILENAME.key -x509 -days 3653 -out $FILENAME.crt
cat $FILENAME.key $FILENAME.crt >$FILENAME.pem
chmod 600 $FILENAME.key $FILENAME.pem
socat OPENSSL-LISTEN:2376,bind=x.x.x.x,fork,reuseaddr,cert=server.pem,cafile=client.crt UNIX-CLIENT:/var/run/docker.sock
** TLS with client verification only **
TLS certificate: client.crt
TLS Key: client.key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment