Skip to content

Instantly share code, notes, and snippets.

@m-x-k
Created September 1, 2017 07:31
Show Gist options
  • Save m-x-k/1027a7bd51784d746a6d9128066314ea to your computer and use it in GitHub Desktop.
Save m-x-k/1027a7bd51784d746a6d9128066314ea to your computer and use it in GitHub Desktop.
Install self signed certificate on debian machine
#!/bin/bash
if [ $# -eq 0 ]
then
echo "./installCertificate.sh <HOSTNAME> <PORT>"
exit
fi
HOSTNAME=$1
PORT=$2
openssl s_client -connect ${HOSTNAME}:${PORT} -showcerts </dev/null 2>/dev/null | openssl x509 -text > /tmp/${HOSTNAME}.crt
cp /tmp/${HOSTNAME}.crt /usr/local/share/ca-certificates/
chmod 644 /usr/local/share/ca-certificates/${HOSTNAME}.crt
update-ca-certificates --verbose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment