You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.1 KiB

  1. #!/usr/bin/env sh
  2. #
  3. # Here is a script to deploy cert to minio server. This script can be called
  4. # directly to test its configuration and see if its dependencies are installed.
  5. # It requires the environment variable MINIO_CERTS_PATH to be set to the path
  6. # where minio stores its certificates (--certs-dir). These must be supported by
  7. # go. The documentation has recommendations under #supported-tls-cipher-suites,
  8. # see: https://min.io/docs/minio/linux/operations/network-encryption.html
  9. #
  10. #
  11. # MINIO_CERTS_PATH defaults to:
  12. # * FreeBSD: /usr/local/etc/minio/certs/
  13. # * Linux: ${HOME}/.minio/certs
  14. #
  15. ## public functions ####################
  16. minio_test() {
  17. test "$MINIO_CERTS_PATH" ||
  18. (echo 'environment variable MINIO_CERTS_PATH is required.' && kill $$)
  19. test -x "$(which openssl)" ||
  20. (echo 'no openssl installed, but required.' && kill $$)
  21. echo "All tests ok."
  22. }
  23. # $1=domain $2=keyfile $3=certfile $4=cafile $5=fullchain
  24. minio_deploy() {
  25. openssl x509 \
  26. -in "$3" \
  27. -outform PEM \
  28. -out "$MINIO_CERTS_PATH/public.crt" ||
  29. return 1
  30. openssl ec \
  31. -in "$2" \
  32. -out "$MINIO_CERTS_PATH/private.key" ||
  33. return 1
  34. return 0
  35. }
  36. minio_test