blob: 298d76050c35b1e844a8d21a55eb2d155d31c1a6 [file] [log] [blame]
#!/bin/sh
die () {
echo "$*" >&2
exit 1
}
test $# = 0 &&
die "Usage: $0 <https hostname>"
cd "$(dirname "$0")" &&
host="$1"
host=${1#https://}
host=${host%%/*}
echo "Please press any key" >&2
out="$(openssl s_client -connect $host:443 </dev/null 2> /dev/null)" ||
die "Could not get certificate for $host"
mkdir -p certs &&
echo "$out" |
sed -n '/^-----BEGIN CERTIFICATE/,/^-----END CERTIFICATE/p' \
> certs/$host.pem