#!/bin/bash
echo "Введите название сертификата"
read cert
echo "Введите имя домена"
read domainname
openssl genrsa -out $cert.key 4096
cat > $cert.conf  <<EOF
[req]
default_bits = 4096
prompt = no
default_md = sha256
req_extensions = v3_req
distinguished_name = dn
[dn]
C = RU
ST = MSK
L = MSK
O = BNPL
OU = IT
CN = $domainname

[v3_req]
extendedKeyUsage = serverAuth
subjectAltName = @alt_names
[alt_names]
DNS.1 = $domainname
EOF
openssl req -new -key $cert.key -out $cert.csr -sha256 -config $cert.conf

