#!/bin/bash echo "Saisir le nom de domaine ?" read domain openssl genpkey -algorithm RSA -out ${domain}.key echo "Generation fichier clé" cat > ${domain}.cnf << EOF [req] distinguished_name=req_distinguished_name req_extasions=v3_req prompt=no [req_distinguished_name] C=FR ST=Nord L=Roubaix O=Tips-Of-Mine OU=Tips-Of-Mine IT CN=${domain} [v3_req] subjectAltName=@alt_names [alt_names] DNS.1=${domain} EOF echo "Fichier clé crée" echo "Generation fichier CSR" openssl req -new -key ${domain}.key -out ${domain}.csr -config ${domain}.cnf echo "Fichier CSR crée" echo "Transferet du fichier CSR" cp ${domain}.csr /etc/ssl/CA/ #sshpass -p "root" scp ${domain}.csr root@SLPKIWOSP01:etc/ssl/CA/" echo "CSR transmit" sleep 2 echo "Transferet du fichier CNF" cp ${domain}.cnf /etc/ssl/CA/ #sshpass -p "root" scp ${domain}.conf root@SLPKIWOSP01:etc/ssl/CA/" echo "Config transmit" sleep 3 echo "Transferet du fichier key" cp ${domain}.key /var/www/html/keys/ #sshpass -p "root" scp ${domain}.conf root@SLPKIWOSP01:/var/www/html/keys/" echo "Config transmit" sleep 4 echo "Téléchargement du certificat" wget https://slpkiwosp01/certs/${domain}.crt -P /etc/ssl/private/localcerts/ sleep 5