Skip to content

Instantly share code, notes, and snippets.

@virtualLast
Last active August 14, 2018 12:00
Show Gist options
  • Save virtualLast/d7956e5e4a94d06ddd133f15fc97a4dc to your computer and use it in GitHub Desktop.
Save virtualLast/d7956e5e4a94d06ddd133f15fc97a4dc to your computer and use it in GitHub Desktop.
Create a self signed openSSL certificate for macOS
#server.key can be named anything you like, remember to update the .conf files accordingly
1 ) openssl genrsa -des3 -out server.key 2048
#update localhost to whatever dynamic dns you have set up, or use IP:127.0.0.1
2 ) openssl req \
-newkey rsa:2048 \
-x509 \
-nodes \
-keyout server.key \
-new \
-out server.crt \
-subj /CN=localhost \
-reqexts SAN \
-extensions SAN \
-config <(cat /System/Library/OpenSSL/openssl.cnf \
<(printf '[SAN]\nsubjectAltName=DNS:localhost')) \
-sha256 \
-days 3650
3 ) cp server.key server.tmp
4 ) openssl rsa -in server.tmp -out server.key
5 ) cp server.crt /Applications/MAMP/conf/apache
6 ) cp server.key /Applications/MAMP/conf/apache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment