Skip to content

Instantly share code, notes, and snippets.

@tough-griff
Last active November 4, 2016 15:56
Show Gist options
  • Save tough-griff/6cee486de8ca22bc27d4c2060e69710a to your computer and use it in GitHub Desktop.
Save tough-griff/6cee486de8ca22bc27d4c2060e69710a to your computer and use it in GitHub Desktop.
Creating a local cert file for lvh.me
[req]
distinguished_name = req_distinguished_name
x509_extensions = v3_req
prompt = no
[req_distinguished_name]
CN = lvh.me
[v3_req]
keyUsage = keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names
[alt_names]
DNS.1 = *.lvh.me
DNS.2 = lvh.me

I used the following configuration file:

cert.cnf

[req]
distinguished_name = req_distinguished_name
x509_extensions = v3_req
prompt = no
[req_distinguished_name]
CN = lvh.me
[v3_req]
keyUsage = keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names
[alt_names]
DNS.1 = *.lvh.me
DNS.2 = lvh.me

and ran the following shell scripts:

openssl req -new \
  -newkey rsa:2048 \
  -sha256 \
  -days 3650 \
  -nodes \
  -x509 \
  -keyout lvh.me.key \
  -out lvh.me.crt \
  -config cert.cnf

cat lvh.me.key lvh.me.crt > lvh.me.pem
cp lvh.me.* /usr/local/etc/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment