howtossl:howto_certificats_ssl
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
howtossl:howto_certificats_ssl [2018/09/10 12:10] – créée ronan | howtossl:howto_certificats_ssl [2021/09/06 09:41] (Version actuelle) – ghusson | ||
---|---|---|---|
Ligne 27: | Ligne 27: | ||
Use the command that has the extension of your certificate replacing cert.xxx with the name of your certificate | Use the command that has the extension of your certificate replacing cert.xxx with the name of your certificate | ||
- | $ openssl x509 -in cert.pem -text -noout | + | <code bash> |
- | | + | openssl x509 -in cert.pem -text -noout |
- | | + | openssl x509 -in cert.cer -text -noout |
- | + | openssl x509 -in cert.crt -text -noout | |
+ | </ | ||
If you get the folowing error it means that you are trying to view a DER encoded certifciate and need to use the commands in the "View DER encoded certificate below" | If you get the folowing error it means that you are trying to view a DER encoded certifciate and need to use the commands in the "View DER encoded certificate below" | ||
Ligne 38: | Ligne 40: | ||
===== View DER encoded Certificate ===== | ===== View DER encoded Certificate ===== | ||
- | $ openssl x509 -in certificate.der -inform der -text -noout | + | <code bash> |
+ | openssl x509 -in certificate.der -inform der -text -noout | ||
+ | </ | ||
If you get the following error it means that you are trying to view a PEM encoded certificate with a command meant for DER encoded certs. Use a command in the "View PEM encoded certificate above" | If you get the following error it means that you are trying to view a PEM encoded certificate with a command meant for DER encoded certs. Use a command in the "View PEM encoded certificate above" | ||
Ligne 50: | Ligne 54: | ||
==== PEM to DER ==== | ==== PEM to DER ==== | ||
- | openssl x509 -in cert.crt -outform der -out cert.der | + | <code bash> |
+ | openssl x509 -in cert.crt -outform der -out cert.der | ||
+ | </ | ||
==== DER to PEM ==== | ==== DER to PEM ==== | ||
- | openssl x509 -in cert.crt -inform der -outform pem -out cert.pem | + | <code bash> |
+ | openssl x509 -in cert.crt -inform der -outform pem -out cert.pem | ||
+ | </ | ||
===== Combination/ | ===== Combination/ | ||
Ligne 62: | Ligne 70: | ||
==== Chained certificate ==== | ==== Chained certificate ==== | ||
- | cat mycert.crt > chainedcert.crt | + | <code bash> |
- | cat subauth.crt >> chainedcert.crt | + | cat mycert.crt > chainedcert.crt |
- | cat auth.crt >> chainedcert.crt | + | cat subauth.crt >> chainedcert.crt |
+ | cat auth.crt >> chainedcert.crt | ||
+ | </ | ||
Pour les certificats une adresse, la meilleure solution pour configurer votre certificat afin de sécuriser votre nom de domaine avec et sans www (ex : exemple.com et www.exemple.com) est de générer votre CSR avec le domaine seulement et non avec le sous domaine www. En effet, lorsque vous générez votre CSR pour le domaine seul, cela implique également l' | Pour les certificats une adresse, la meilleure solution pour configurer votre certificat afin de sécuriser votre nom de domaine avec et sans www (ex : exemple.com et www.exemple.com) est de générer votre CSR avec le domaine seulement et non avec le sous domaine www. En effet, lorsque vous générez votre CSR pour le domaine seul, cela implique également l' | ||
Ligne 71: | Ligne 81: | ||
===== Processus de demande de certificat ===== | ===== Processus de demande de certificat ===== | ||
- | * générer la clef SSL (sans mot de passe) : | + | * générer la clef SSL (sans mot de passe) : |
- | $ openssl genrsa -out monsite.dom-key.pem 2048 | + | <code bash> |
- | | + | openssl genrsa -out monsite.dom-key.pem 2048 |
+ | openssl req -new -key monsite.dom-key.pem -out monsite.dom-req.pem | ||
+ | </ | ||
Lors de cette étape, différentes questions vous seront posées afin de compléter la creation de la CSR et qui apparaîtront dans le certificat SSL. Les caractères suivants ne sont pas acceptés : < > ~! @ # $ % ^ * / \ ( ) ? . , & | Lors de cette étape, différentes questions vous seront posées afin de compléter la creation de la CSR et qui apparaîtront dans le certificat SSL. Les caractères suivants ne sont pas acceptés : < > ~! @ # $ % ^ * / \ ( ) ? . , & | ||
Ligne 107: | Ligne 119: | ||
===== Déchiffer une clef ===== | ===== Déchiffer une clef ===== | ||
- | | + | <code bash> |
- | openssl dsa < | + | openssl rsa < |
+ | openssl dsa < | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== key et crt => PKCS12/PFX ==== | ||
+ | <code bash> | ||
+ | openssl pkcs12 -export -out out_cert.pfx -inkey private.key -in domain.crt -certfile ca-bundle.crt | ||
+ | </ | ||
+ | |||
+ | ==== pcks12 => pem + key pour openssl (import de certificat depuis win) ==== | ||
+ | <code bash> | ||
+ | openssl pkcs12 -in infile.pfx -nocerts -nodes -out outfile.key | ||
+ | openssl pkcs12 -in infile.pfx -nokeys -out outfile_fullchain.pem | ||
+ | </ | ||
+ | |||
+ | ==== pcks7 => pem + hash pour openssl (import de root CA local pki AD) ==== | ||
+ | <code bash> | ||
+ | for CERTIF in $(find -name " | ||
+ | FILEBN=$(basename --suffix .p7b $CERTIF) | ||
+ | openssl pkcs7 -in $FILEBN.p7b -inform DER -print_certs -out $FILEBN.pem | ||
+ | echo " | ||
+ | echo "= Converted $FILEBN.p7b to $FILEBN.pem, | ||
+ | echo " | ||
+ | openssl x509 -in $FILEBN.pem -text -noout | ||
+ | done | ||
+ | |||
+ | for CERTFILE in $(find \( -name " | ||
+ | # make sure file exists and is a valid cert | ||
+ | test -f " | ||
+ | HASH=$(openssl x509 -noout -hash -in " | ||
+ | echo $HASH | ||
+ | test -n " | ||
+ | |||
+ | # use lowest available iterator for symlink | ||
+ | for ITER in 0 1 2 3 4 5 6 7 8 9; do | ||
+ | test -f " | ||
+ | ln -s " | ||
+ | test -L " | ||
+ | done | ||
+ | done | ||
+ | |||
+ | </ | ||
howtossl/howto_certificats_ssl.1536581439.txt.gz · Dernière modification : 2018/09/10 12:10 de ronan