Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

inherit-inter 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. # Build a new PKI which is rooted on an intermediate certificate generated
  3. # by ./build-inter or ./pkitool --inter from a parent PKI. The new PKI should
  4. # have independent vars settings, and must use a different KEY_DIR directory
  5. # from the parent. This tool can be used to generate arbitrary depth
  6. # certificate chains.
  7. #
  8. # To build an intermediate CA, follow the same steps for a regular PKI but
  9. # replace ./build-key or ./pkitool --initca with this script.
  10. # The EXPORT_CA file will contain the CA certificate chain and should be
  11. # referenced by the OpenVPN "ca" directive in config files. The ca.crt file
  12. # will only contain the local intermediate CA -- it's needed by the easy-rsa
  13. # scripts but not by OpenVPN directly.
  14. EXPORT_CA="export-ca.crt"
  15. if [ $# -ne 2 ]; then
  16. echo "usage: $0 <parent-key-dir> <common-name>"
  17. echo "parent-key-dir: the KEY_DIR directory of the parent PKI"
  18. echo "common-name: the common name of the intermediate certificate in the parent PKI"
  19. exit 1;
  20. fi
  21. if [ "$KEY_DIR" ]; then
  22. cp "$1/$2.crt" "$KEY_DIR/ca.crt"
  23. cp "$1/$2.key" "$KEY_DIR/ca.key"
  24. if [ -e "$1/$EXPORT_CA" ]; then
  25. PARENT_CA="$1/$EXPORT_CA"
  26. else
  27. PARENT_CA="$1/ca.crt"
  28. fi
  29. cp "$PARENT_CA" "$KEY_DIR/$EXPORT_CA"
  30. cat "$KEY_DIR/ca.crt" >> "$KEY_DIR/$EXPORT_CA"
  31. else
  32. echo 'Please source the vars script first (i.e. "source ./vars")'
  33. echo 'Make sure you have edited it to reflect your configuration.'
  34. fi