Skip to content

Instantly share code, notes, and snippets.

@dragomirr
Created February 27, 2019 18:54
Show Gist options
  • Save dragomirr/205cbb3eb948c2961ecb0e9639bfba57 to your computer and use it in GitHub Desktop.
Save dragomirr/205cbb3eb948c2961ecb0e9639bfba57 to your computer and use it in GitHub Desktop.
Build self signed ssl certificate
# generate root ca key
openssl genrsa -out rootCA.key 2048
# use generated ca key to create root ssl certificate
openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -out rootCA.pem
# create server.csr.cnf with following content
[req]
default_bits = 2048
prompt = no
default_md = sha256
distinguished_name = dn
[dn]
C=RS
ST=NS
L=NS
O=NS
OU=NS
[email protected]
CN = localhost
# Create a certificate key for localhost using the configuration settings stored in server.csr.cnf. This key is stored in server.key
openssl req -new -sha256 -nodes -out server.csr -newkey rsa:2048 -keyout server.key -config <( cat server.csr.cnf )
# create v3.ext with following content
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = *.example.com
IP.1 = 10.0.0.1
IP.2 = 192.168.0.1
IP.3 = 172.16.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment