Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

create_ca_and_ee.sh 1.1 KiB

123456789101112131415161718
  1. #!/usr/bin/env bash
  2. # This script will create a custom Certificate Authority (CA) and End Entity (EE) certificates.
  3. #
  4. # for local development this should be fine and you can ignore certificate trust errors related to
  5. # an untrusted root. For public facing access, you can submit the generated lesspass.csr to a trusted
  6. # ca so that they can provide you with a trusted certificate to replace this development certificate.
  7. CA_CRT_SUBJ="${CA_CRT_SUBJ:-/C=US/CN=Root-CA}"
  8. CA_KEY_TYPE="${CA_KEY_TYPE:-rsa:2048}"
  9. EE_CRT_SUBJ="${EE_CRT_SUBJ:-/C=FR/ST=Gironde/L=Bordeaux/O=LessPass/CN=lesspass.local}"
  10. EE_KEY_TYPE="${EE_KEY_TYPE:-${CA_KEY_TYPE}}"
  11. openssl req -x509 -nodes -new -sha256 -days 1024 -newkey "$CA_KEY_TYPE" -keyout RootCA.key -out RootCA.pem -subj "$CA_CRT_SUBJ"
  12. openssl x509 -outform pem -in RootCA.pem -out RootCA.crt
  13. openssl req -new -nodes -newkey "$EE_KEY_TYPE" -keyout lesspass.key -out lesspass.csr -subj "$EE_CRT_SUBJ"
  14. openssl x509 -req -sha256 -days 1024 -in lesspass.csr -CA RootCA.pem -CAkey RootCA.key -CAcreateserial -extfile domains.ext -out lesspass.crt
  15. openssl verify -verbose -CAfile RootCA.crt RootCA.crt lesspass.crt