1 2 3 4 5 6 7 8 9 10
| domain=$1
mkdir -p $domain
openssl genrsa -out $domain/$domain.key
openssl req -new -key $domain/$domain.key -out $domain/$domain.csr -subj "/C=CN/ST=XXX/L=XXX/O=XXX/OU=XXX/CN=$domain/emailAddress=XXX@XXX.com" -addext "subjectAltName=DNS:*.$domain,DNS:$domain"
openssl x509 -req -in $domain/$domain.csr -CA ../rootca/root.cer -CAkey ../rootca/root.key -CAcreateserial -out $domain/$domain.crt -days 730 -extfile <(printf "subjectKeyIdentifier=hash\nauthorityKeyIdentifier=keyid,issuer\nbasicConstraints=CA:FALSE\nkeyUsage=digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment\nextendedKeyUsage=serverAuth,OCSPSigning\nsubjectAltName=DNS:*.$domain,DNS:$domain")
|