Skip to content

Instantly share code, notes, and snippets.

@hanoii
Created November 21, 2017 13:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hanoii/e9b4d4e70d1fa44964300e2cfd9a57c4 to your computer and use it in GitHub Desktop.
Save hanoii/e9b4d4e70d1fa44964300e2cfd9a57c4 to your computer and use it in GitHub Desktop.
Bash script to create a self-signed wildcard certificate with SAN extension
#!/bin/bash
openssl req \
-newkey rsa:2048 \
-x509 \
-nodes \
-keyout localhost.key \
-new \
-out localhost.crt \
-subj /CN=dev.localhost \
-reqexts SAN \
-extensions SAN \
-config <(cat /System/Library/OpenSSL/openssl.cnf \
<(printf '[SAN]\nsubjectAltName=DNS:dev.localhost,DNS:*.dev.localhost')) \
-sha256 \
-days 3650
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment