Skip to content

Instantly share code, notes, and snippets.

@danreedy
Created April 8, 2011 16:05
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save danreedy/910179 to your computer and use it in GitHub Desktop.
Save danreedy/910179 to your computer and use it in GitHub Desktop.
Scripting the automation of an interactive script to generate a self-signed certificate for POW usage
# Generate our local key
openssl genrsa 2048 > local.key
# Create the self-signed certificate for all *.dev addresses
openssl req -new -x509 -nodes -sha1 -days 3650 -key local.key << ANSWERS > local.cert
US
IL
Chicago
Myself
Me
*.dev
admin@localhost
ANSWERS
# Create the fingerprint file
openssl x509 -noout -fingerprint -text < local.cert > local.info
# Combine our key and self-signed cert into a certificate
cat local.cert local.key > local.pem
# Add the certificate to our trusted root
sudo /usr/bin/security add-trusted-cert -d -r trustRoot -k "/Library/Keychains/System.keychain" "local.pem"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment