Don’t have ubuntu so I have no idea if this works.
NAME=${1:-testing}
openssl req
-newkey rsa:4096
-days 1001
-nodes
-x509
-subj “/C=US/ST=California/L=San Francisco/O=Twitch/OU=web/CN=localhost”
-extensions SAN
-config <( cat $( [[ “Darwin” -eq “$(uname -s)” ]] && echo /System/Library/OpenSSL/openssl.cnf || echo /etc/ssl/openssl.cnf )
<(printf “[SAN]\nsubjectAltName=‘DNS:localhost’”))
-keyout “${NAME}.key”
-out “${NAME}.crt”
echo “”
echo “Generated $NAME.key and $NAME.crt files in local directory”
echo “”
if [[ “$OSTYPE” == “darwin”* ]]; then
echo “Installing cert into local Keychain.”
echo “To see or modify, run ‘Keychain Access’ app and look in the ‘System’ Folder”
sudo security add-trusted-cert -d -p ssl -r trustRoot -k “/Library/Keychains/System.keychain” “${NAME}.crt”
else
sudo cp testing.crt /usr/local/share/ca-certificates/testing.crt
sudo dpkg-reconfigure ca-certificates
sudo update-ca-certificates
fi
It seems like the original script doesn’t handle installing the generated key in any OS besides Mac? In any case I added what I think you want it to do based off this. If it doesn’t work, perhaps you could just manually copy the generated “testing.cert” in /boilerplate/certs to /usr/local/share/ca-certificates/