Last active
December 13, 2017 17:01
-
-
Save tharsheblows/84b0acf6f5d88393ee001c9b9a8357e1 to your computer and use it in GitHub Desktop.
Add a ssl certificate and key in VVV. Run this in vagrant-local.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# add an ssl folder to the site with key and certificate as per https://github.com/Varying-Vagrant-Vagrants/VVV/wiki/Site-specific-self-signed-SSL-certificates | |
# this goes in vagrant-local directory or whichever directory holds your www dir | |
echo -e "Enter the directory name of the site for which you'd like a certificate: " | |
read site | |
cd www/$site | |
if [ ! -d "ssl" ]; then | |
mkdir ssl | |
fi | |
cd ssl | |
if [ ! -f $site.dev.key ]; then | |
openssl req -newkey rsa:2048 -x509 -nodes -keyout $site.dev.key -new -out $site.dev.cert -subj /CN=$site.dev -reqexts SAN -extensions SAN -config <(cat /etc/ssl/openssl.cnf <(printf "[SAN]\nsubjectAltName=DNS:$site.dev")) -sha256 -days 3650 | |
fi | |
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain $site.dev.cert | |
ls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment