Docker container for retrieving certificates from Let's Encrypt using a DNS challenge provided by MyDnsHost
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/usr/bin/env bash
  2. #
  3. # Hook for adding DNS entries using MyDNSHost
  4. set -e
  5. set -u
  6. set -o pipefail
  7. function deploy_challenge {
  8. local DOMAIN="${1}" TOKEN_FILENAME="${2}" TOKEN_VALUE="${3}"
  9. echo "deploy_challenge called: ${DOMAIN}, ${TOKEN_FILENAME}, ${TOKEN_VALUE}"
  10. mydnshost records add -- "_acme-challenge.${DOMAIN}" TXT "${TOKEN_VALUE}"
  11. sleep 10
  12. # This hook is called once for every domain that needs to be
  13. # validated, including any alternative names you may have listed.
  14. #
  15. # Parameters:
  16. # - DOMAIN
  17. # The domain name (CN or subject alternative name) being
  18. # validated.
  19. # - TOKEN_FILENAME
  20. # The name of the file containing the token to be served for HTTP
  21. # validation. Should be served by your web server as
  22. # /.well-known/acme-challenge/${TOKEN_FILENAME}.
  23. # - TOKEN_VALUE
  24. # The token value that needs to be served for validation. For DNS
  25. # validation, this is what you want to put in the _acme-challenge
  26. # TXT record. For HTTP validation it is the value that is expected
  27. # be found in the $TOKEN_FILENAME file.
  28. }
  29. function clean_challenge {
  30. local DOMAIN="${1}" TOKEN_FILENAME="${2}" TOKEN_VALUE="${3}"
  31. echo "clean_challenge called: ${DOMAIN}, ${TOKEN_FILENAME}, ${TOKEN_VALUE}"
  32. mydnshost records rm -- "_acme-challenge.${DOMAIN}" TXT "${TOKEN_VALUE}"
  33. # This hook is called after attempting to validate each domain,
  34. # whether or not validation was successful. Here you can delete
  35. # files or DNS records that are no longer needed.
  36. #
  37. # The parameters are the same as for deploy_challenge.
  38. }
  39. HANDLER="$1"; shift
  40. if [[ "${HANDLER}" =~ ^(deploy_challenge|clean_challenge)$ ]]; then
  41. "$HANDLER" "$@"
  42. fi