3 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
9 -subj "/C=US/ST=California/L=San Francisco/O=LULZCorp/OU=web/CN=localhost" \
11 -config <( cat $( [[ "Darwin" = "$(uname -s)" ]] && echo /System/Library/OpenSSL/openssl.cnf || echo /etc/ssl/openssl.cnf ) \
12 <(printf "[SAN]\nsubjectAltName='DNS:alttp.desktop-dk'")) \
13 -keyout "${DIR}/${NAME}.key" \
14 -out "${DIR}/${NAME}.crt"
17 echo "* Generated $NAME.key and $NAME.crt files in local directory"
20 if [[ "$OSTYPE" == "darwin"* ]]; then
21 echo "* Installing cert into local Keychain."
22 echo "* To see or modify, run 'Keychain Access' app and look in the 'System' Folder"
23 sudo security add-trusted-cert -d -p ssl -r trustRoot -k "/Library/Keychains/System.keychain" "${DIR}/${NAME}.crt"
25 echo "* Please install and trust cert at conf/$NAME.crt"
28 if [[ ! -d "${DIR}/../conf/" ]]; then
29 mkdir "${DIR}/../conf/"
31 mv ${NAME}.{key,crt} "${DIR}/../conf/"