keychain.sh 876 B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env sh
  2. #Here is a sample custom api script.
  3. #This file name is "myapi.sh"
  4. #So, here must be a method myapi_deploy()
  5. #Which will be called by acme.sh to deploy the cert
  6. #returns 0 means success, otherwise error.
  7. ######## Public functions #####################
  8. #domain keyfile certfile cafile fullchain
  9. keychain_deploy() {
  10. _cdomain="$1"
  11. _ckey="$2"
  12. _ccert="$3"
  13. _cca="$4"
  14. _cfullchain="$5"
  15. _debug _cdomain "$_cdomain"
  16. _debug _ckey "$_ckey"
  17. _debug _ccert "$_ccert"
  18. _debug _cca "$_cca"
  19. _debug _cfullchain "$_cfullchain"
  20. /usr/bin/security import "$_ckey" -k "/Library/Keychains/System.keychain"
  21. /usr/bin/security import "$_ccert" -k "/Library/Keychains/System.keychain"
  22. /usr/bin/security import "$_cca" -k "/Library/Keychains/System.keychain"
  23. /usr/bin/security import "$_cfullchain" -k "/Library/Keychains/System.keychain"
  24. return 0
  25. }