#!/bin/bash # Create the directory used for storing certs. mkdir -p certs cd certs # Generate CA private key and self-signed cert. openssl genrsa -out ca.key 2048 openssl req -x509 -new -nodes -key ca.key -sha256 -days 1024 -out ca.crt -subj "/C=CN/ST=Beijing/L=Beijing/O=Test CA/OU=IT/CN=Test CA" # Generate another CA private key and self-signed cert. openssl genrsa -out wrong-ca.key 2048 openssl req -x509 -new -nodes -key wrong-ca.key -sha256 -days 1024 -out wrong-ca.crt -subj "/C=CN/ST=Beijing/L=Beijing/O=Wrong CA/OU=IT/CN=Wrong CA" # Generate OpenSSL config file with SAN extention. cat >san.cnf <