TLS Einfacher per Skript

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
 #!/bin/bash
CN=$1
openssl genrsa -out $CN.key 4096
openssl req -new -key $CN.key -out $CN.csr
cat<<HERE > /tmp/ext.cnf
[ v3_req ]
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
subjectAltName = @alt_names

[alt_names]
DNS.1   =  $CN
HERE
openssl x509 -req -days 730 -in $CN.csr  -CA ca.crt  -CAkey ca.key -CAcreateserial -out $CN.crt -extensions v3_req -extfile /tmp/ext.cnf
openssl x509 -noout -text -in ${CN}.crt