Skip to content

Instantly share code, notes, and snippets.

@cgimenes
Created September 28, 2021 02:20
Show Gist options
  • Select an option

  • Save cgimenes/81e484130f962305bca85ef674a85b13 to your computer and use it in GitHub Desktop.

Select an option

Save cgimenes/81e484130f962305bca85ef674a85b13 to your computer and use it in GitHub Desktop.
Self signed certificate

Configuration file (csr.conf)

[req]
default_bits = 2048
distinguished_name = dn
prompt = no
default_md = sha1

[dn]
C="CA"
ST="BC"
L="Vancouver"
O="Dev Inc"
OU="Dev"
emailAddress="webmaster@localhost"
CN="dev.localhost"

[req_ext]
subjectAltName = @alt_names

[alt_names]
DNS.0 = *.dev.localhost

Commands

openssl genrsa -out self-ssl.key
openssl req -new -key self-ssl.key -out self-ssl.csr -config csr.conf
openssl x509 -req -days 3650 -in self-ssl.csr -signkey self-ssl.key -out self-ssl.crt -extensions req_ext -extfile csr.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment