Génération du certificat autosigné
Génération d'un certificat auto-signé pour *.megaproduction.local
Ce guide vous permet de générer une autorité de certification (CA) auto-signée, puis un certificat wildcard pour \*.megaproduction.local signé par cette CA.
Étape 1 : Créer une autorité de certification (CA)
mkdir -p ~/certs && cd ~/certs
# Générer la clé privée de la CA
openssl genrsa -out megaproduction-rootCA.key 4096
# Générer le certificat de la CA (valide 10 ans)
openssl req -x509 -new -nodes -key megaproduction-rootCA.key -sha256 -days 3650 -out megaproduction-rootCA.pem \\
-subj "/C=FR/ST=IDF/L=Paris/O=MegaProduction/OU=IT/CN=MegaProduction Root CA"
Étape 2 : Générer un certificat wildcard pour *.megaproduction.local
2.1 Générer une clé privée pour le certificat
openssl genrsa -out megaproduction.local.key 2048
2.2 Créer un fichier de configuration OpenSSL (megaproduction.ext)
Créer un fichier megaproduction.ext avec le contenu suivant :
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt\_names
\[alt\_names\]
DNS.1 = \*.megaproduction.local
DNS.2 = megaproduction.local
2.3 Créer une CSR (Certificate Signing Request)
openssl req -new -key megaproduction.local.key -out megaproduction.local.csr \\
-subj "/C=FR/ST=IDF/L=Paris/O=MegaProduction/OU=IT/CN=\*.megaproduction.local"
2.4 Signer le certificat avec la CA
openssl x509 -req -in megaproduction.local.csr -CA megaproduction-rootCA.pem -CAkey megaproduction-rootCA.key \\
-CAcreateserial -out megaproduction.local.crt -days 825 -sha256 -extfile megaproduction.ext
Résultat
- megaproduction.local.key : clé privée du certificat
- megaproduction.local.crt : certificat wildcard
- megaproduction-rootCA.pem : certificat de l'autorité de certification à importer dans Firefox
No comments to display
No comments to display