Generate self-signed SSL certificate with SAN field
Based on https://gist.github.com/KeithYeh/bb07cadd23645a6a62509b1ec8986bbc openssl genrsa -out example.com.key 2048 openssl req -new -key example.com.key -out example.com.csr Create config file for SAN touch v3.ext File content subjectKeyIdentifier = hash authorityKeyIdentifier = keyid:always,issuer:always keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment, keyAgreement, keyCertSign subjectAltName = DNS:example.com, DNS:*.example.com issuerAltName = issuer:copy openssl x509 -req -in example.com.csr -signkey example.com.key -out example.com.crt -days 760 -sha256 -extfile v3.ext create a root CA openssl req -x509 -new -nodes -key example.com.key -sha256 -days 3500 -out rootCA.pem Then use is to sign the certificate openssl x509 -req -in example.com.csr -CA rootCA.pem -CAkey example.com.key -CAcreateserial -out example.com.crt -days 760 -sha256 -extfile v3.ext