Last active
August 7, 2020 18:44
-
-
Save ultimagriever/5e50a3e3ec6e921a67d0f1391a37ba61 to your computer and use it in GitHub Desktop.
Generate self-signed certificate in Mac OS
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
# sh self-signed-certificate.sh [domain_name] | |
DOMAIN_NAME=$1 | |
openssl req -new -subj "/C=/ST=/O=/localityName=/commonName=$DOMAIN_NAME/organizationalUnitName=/emailAddress=/" \ | |
-addext "subjectAltName = DNS:www.$DOMAIN_NAME" \ | |
-newkey rsa:4096 | |
-keyout $DOMAIN_NAME.key -out $DOMAIN_NAME.csr | |
openssl x509 -req -days 365 -in $DOMAIN_NAME.csr -signkey $DOMAIN_NAME.key -out $DOMAIN_NAME.crt | |
openssl rsa -in $DOMAIN_NAME.key -out $DOMAIN_NAME.key | |
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain $DOMAIN_NAME.crt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment