kb:crypto:creer_ca
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| kb:crypto:creer_ca [2018/08/22 23:16] – beu | kb:crypto:creer_ca [2021/03/30 14:01] (Version actuelle) – beu | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| ======Créer sa CA et signer ses certificats====== | ======Créer sa CA et signer ses certificats====== | ||
| + | |||
| + | ==== Création de la CA ==== | ||
| Pour cela, on va se rendre dans un dossier isolé : | Pour cela, on va se rendre dans un dossier isolé : | ||
| Ligne 11: | Ligne 13: | ||
| <code bash> | <code bash> | ||
| # mkdir certs crl newcerts private csr | # mkdir certs crl newcerts private csr | ||
| + | </ | ||
| # chmod 700 private | # chmod 700 private | ||
| </ | </ | ||
| Ligne 18: | Ligne 21: | ||
| <code bash> | <code bash> | ||
| # touch index.txt | # touch index.txt | ||
| + | </ | ||
| # echo 1000 > serial | # echo 1000 > serial | ||
| + | </ | ||
| + | # echo 0000 > crlnumber | ||
| </ | </ | ||
| + | |||
| puis on créer le fichier : | puis on créer le fichier : | ||
| - | <code openssl | + | <code openssl |
| [ ca ] | [ ca ] | ||
| # `man ca` | # `man ca` | ||
| Ligne 30: | Ligne 37: | ||
| [ CA_default ] | [ CA_default ] | ||
| # Directory and file locations. | # Directory and file locations. | ||
| - | dir | + | dir |
| certs = $dir/certs | certs = $dir/certs | ||
| crl_dir | crl_dir | ||
| Ligne 39: | Ligne 46: | ||
| # The root key and root certificate. | # The root key and root certificate. | ||
| - | private_key | + | private_key |
| - | certificate | + | certificate |
| # For certificate revocation lists. | # For certificate revocation lists. | ||
| crlnumber | crlnumber | ||
| - | crl = $dir/ | + | crl = $dir/ |
| crl_extensions | crl_extensions | ||
| default_crl_days | default_crl_days | ||
| Ligne 81: | Ligne 88: | ||
| countryName_default | countryName_default | ||
| - | stateOrProvinceName_default | + | stateOrProvinceName_default |
| - | localityName_default | + | localityName_default |
| 0.organizationName_default | 0.organizationName_default | ||
| # | # | ||
| - | emailAddress_default | + | emailAddress_default |
| [ v3_ca ] | [ v3_ca ] | ||
| Ligne 125: | Ligne 132: | ||
| keyUsage = critical, nonRepudiation, | keyUsage = critical, nonRepudiation, | ||
| extendedKeyUsage = clientAuth, emailProtection | extendedKeyUsage = clientAuth, emailProtection | ||
| + | |||
| + | [ crl_ext ] | ||
| + | authorityKeyIdentifier = keyid: | ||
| + | issuerAltName = issuer:copy | ||
| + | |||
| </ | </ | ||
| Ligne 130: | Ligne 142: | ||
| <code bash> | <code bash> | ||
| - | # openssl genrsa -out private/ | + | # openssl genrsa -out private/ |
| </ | </ | ||
| Ligne 137: | Ligne 149: | ||
| <code bash> | <code bash> | ||
| # openssl req -config openssl.cnf \ | # openssl req -config openssl.cnf \ | ||
| - | -key private/ | + | -key private/ |
| -new -x509 -days 7300 -extensions v3_ca \ | -new -x509 -days 7300 -extensions v3_ca \ | ||
| - | -out certs/ca.cert.pem | + | -out certs/ |
| </ | </ | ||
| - | On créer | + | |
| + | ==== Création d'un certificat ==== | ||
| + | |||
| + | If faut d’abord | ||
| <code bash> | <code bash> | ||
| - | # openssl genrsa -out private/ | + | # openssl genrsa -out private/ |
| </ | </ | ||
| Ligne 151: | Ligne 166: | ||
| <code bash> | <code bash> | ||
| - | # openssl req -key private/ | + | # openssl req -config openssl.cnf |
| </ | </ | ||
| Ligne 157: | Ligne 172: | ||
| <code bash> | <code bash> | ||
| - | # openssl ca -config openssl.cnf -extensions server_cert -days 375 -notext -in csr/ | + | # openssl ca -config openssl.cnf -extensions server_cert -days 375 -notext -in csr/ |
| </ | </ | ||
| + | |||
| + | ==== Révoquer un certificat ==== | ||
| + | |||
| + | On va donc révoquer le certificat : | ||
| + | |||
| + | <code bash> | ||
| + | # openssl ca -config openssl.cnf -revoke certs/ | ||
| + | </ | ||
| + | |||
| + | puis pour garder un peu de clarté, on va le déplacer dans le dossier crl : | ||
| + | |||
| + | <code bash> | ||
| + | # mv certs/ | ||
| + | </ | ||
| + | |||
| + | Et puis on génère le fichier CRL: | ||
| + | |||
| + | <code bash> | ||
| + | # openssl ca -config openssl.cnf -gencrl -out crl/ | ||
| + | </ | ||
| + | |||
kb/crypto/creer_ca.1534979810.txt.gz · Dernière modification : de beu
