Skip to content

Instantly share code, notes, and snippets.

@simontraill
Created October 18, 2017 13:17
Show Gist options
  • Save simontraill/7c50331ddb152f7b918b11d56ee00ccc to your computer and use it in GitHub Desktop.
Save simontraill/7c50331ddb152f7b918b11d56ee00ccc to your computer and use it in GitHub Desktop.
Install a self signed SSL certificate into the local machine's trust store
#!/usr/bin/env bash
set -x
HOST=$1
if [ -d /etc/pki/ca-trust/source/anchors/ ] ; then
echo -n | openssl s_client -connect ${HOST}| sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /etc/pki/ca-trust/source/anchors/ssman.crt
update-ca-trust enable
update-ca-trust extract
elif [ -d /usr/local/share/ca-certificates ] ; then
echo -n | openssl s_client -connect ${HOST} | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /usr/local/share/ca-certificates/ssman.crt
update-ca-certificates
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment