generate-crl 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. #!/bin/bash
  2. export LEAK_DETECTIVE_DISABLE=1
  3. ROOT="/var/www"
  4. ##
  5. # strongSwan Root CA
  6. cd /etc/ca
  7. # copy default web page
  8. cp index.html ${ROOT}
  9. # copy strongsSwan CA certificate
  10. cp strongswanCert.pem ${ROOT}
  11. cp strongswanCert.der ${ROOT}
  12. # generate CRL for strongSwan Root CA
  13. pki --signcrl --cakey strongswanKey.pem --cacert strongswanCert.pem \
  14. --lastcrl strongswan.crl > ${ROOT}/strongswan.crl
  15. # revoke moon's current certificate
  16. pki --signcrl --cakey strongswanKey.pem --cacert strongswanCert.pem \
  17. --reason key-compromise --serial 03 \
  18. --lastcrl ${ROOT}/strongswan.crl > ${ROOT}/strongswan_moon_revoked.crl
  19. # generate a base CRL
  20. pki --signcrl --cakey strongswanKey.pem --cacert strongswanCert.pem \
  21. --crluri http://crl.strongswan.org/strongswan_delta.crl \
  22. --lastcrl strongswan.crl --lifetime 30 > ${ROOT}/strongswan_base.crl
  23. # generate a delta CRL revoking moon's current cert
  24. pki --signcrl --cakey strongswanKey.pem --cacert strongswanCert.pem \
  25. --basecrl ${ROOT}/strongswan_base.crl --reason key-compromise \
  26. --serial 03 --lifetime 15 > ${ROOT}/strongswan_delta.crl
  27. # generate Hash-and-URL certificates
  28. CERTS_DIR="${ROOT}/certs"
  29. for cert in `ls certs`
  30. do
  31. openssl x509 -in certs/${cert} -outform der -out ${CERTS_DIR}/cert.der
  32. mv ${CERTS_DIR}/cert.der ${CERTS_DIR}/`sha1sum ${CERTS_DIR}/cert.der | head -c 40`
  33. done
  34. ##
  35. # Research CA
  36. cd /etc/ca/research
  37. # copy Research CA certificate
  38. cp researchCert.pem ${ROOT}
  39. cp researchCert.der ${ROOT}
  40. # generate CRL for Research CA
  41. pki --signcrl --cakey researchKey.pem --cacert researchCert.pem \
  42. > ${ROOT}/research.crl
  43. # generate Hash-and-URL certificates
  44. CERTS_DIR="${ROOT}/certs/research"
  45. for cert in `ls certs`
  46. do
  47. openssl x509 -in certs/${cert} -outform der -out ${CERTS_DIR}/cert.der
  48. mv ${CERTS_DIR}/cert.der ${CERTS_DIR}/`sha1sum ${CERTS_DIR}/cert.der | head -c 40`
  49. done
  50. ##
  51. # Sales CA
  52. cd /etc/ca/sales
  53. # copy Sales CA certificate
  54. cp salesCert.pem ${ROOT}
  55. cp salesCert.der ${ROOT}
  56. # generate CRL for Sales CA
  57. pki --signcrl --cakey salesKey.pem --cacert salesCert.pem \
  58. > ${ROOT}/sales.crl
  59. # generate Hash-and-URL certificates
  60. CERTS_DIR="${ROOT}/certs/sales"
  61. for cert in `ls certs`
  62. do
  63. openssl x509 -in certs/${cert} -outform der -out ${CERTS_DIR}/cert.der
  64. mv ${CERTS_DIR}/cert.der ${CERTS_DIR}/`sha1sum ${CERTS_DIR}/cert.der | head -c 40`
  65. done
  66. ##
  67. # strongSwan EC Root CA
  68. cd /etc/ca/ecdsa
  69. # copy ECDSA CA certificate
  70. cp strongswanCert.pem ${ROOT}/strongswan_ecdsaCert.pem
  71. openssl ec -in strongswanKey.pem -outform der -out ${ROOT}/strongswan_ecdsaCert.der
  72. chmod a+r ${ROOT}/strongswan_ecdsaCert.der
  73. # generate CRL for strongSwan EC Root CA
  74. pki --signcrl --cakey strongswanKey.pem --cacert strongswanCert.pem \
  75. > ${ROOT}/strongswan_ecdsa.crl
  76. ##
  77. # strongSwan RFC3779 Root CA
  78. cd /etc/ca/rfc3779
  79. # generate CRL for strongSwan RFC3779 Root CA
  80. pki --signcrl --cakey strongswanKey.pem --cacert strongswanCert.pem \
  81. > ${ROOT}/strongswan_rfc3779.crl
  82. ##
  83. # strongSwan SHA3-RSA Root CA
  84. cd /etc/ca/sha3-rsa
  85. # generate CRL for strongSwan SHA3-RSA Root CA
  86. pki --signcrl --cakey strongswanKey.pem --cacert strongswanCert.pem \
  87. --digest sha3_256 > ${ROOT}/strongswan_sha3_rsa.crl
  88. ##
  89. # strongSwan Ed25519 Root CA
  90. cd /etc/ca/ed25519
  91. # generate CRL for strongSwan Ed25519 Root CA
  92. pki --signcrl --cakey strongswanKey.pem --cacert strongswanCert.pem \
  93. > ${ROOT}/strongswan_ed25519.crl
  94. ##
  95. # strongSwan Monster Root CA
  96. cd /etc/ca/monster
  97. # generate CRL for strongSwan Monster Root CA
  98. pki --signcrl --cakey strongswanKey.pem --cacert strongswanCert.pem \
  99. > ${ROOT}/strongswan_monster.crl
  100. ##
  101. # strongSwan BlISS Root CA
  102. cd /etc/ca/bliss
  103. # generate CRL for strongSwan BLISS Root CA
  104. pki --signcrl --cakey strongswan_blissKey.der --cacert strongswan_blissCert.der \
  105. --lifetime 30 --digest sha3_512 > ${ROOT}/strongswan_bliss.crl