You are here

dehydrated-hooks.sh in Aegir HTTPS 7.3

#!/usr/bin/env bash

# Copied from dehydrated/docs/examples/hook.sh

function deploy_challenge {
    local DOMAIN="${1}" TOKEN_FILENAME="${2}" TOKEN_VALUE="${3}"

    # This hook is called once for every domain that needs to be
    # validated, including any alternative names you may have listed.
    #
    # Parameters:
    # - DOMAIN
    #   The domain name (CN or subject alternative name) being
    #   validated.
    # - TOKEN_FILENAME
    #   The name of the file containing the token to be served for HTTP
    #   validation. Should be served by your web server as
    #   /.well-known/acme-challenge/${TOKEN_FILENAME}.
    # - TOKEN_VALUE
    #   The token value that needs to be served for validation. For DNS
    #   validation, this is what you want to put in the _acme-challenge
    #   TXT record. For HTTP validation it is the value that is expected
    #   be found in the $TOKEN_FILENAME file.

    # Since dehydrated does not always call us with the main domain name,
    # use a drush alias passed in from the original invocation via the
    # environment variable AEGIR_DRUSH_ALIAS to ensure we find
    # the correct context.
    local MAIN_DOMAIN="${AEGIR_DRUSH_ALIAS:-@$DOMAIN}"

    drush php-eval "d('$MAIN_DOMAIN')->service('http')->sync(d('@server_master')->aegir_root . '/config/letsencrypt.d/well-known/acme-challenge');"
}

HANDLER="$1"; shift
if [[ "${HANDLER}" =~ ^(deploy_challenge)$ ]]; then
  "$HANDLER" "$@"
fi

File

submodules/letsencrypt/drush/bin/dehydrated-hooks.sh
View source
  1. #!/usr/bin/env bash
  2. # Copied from dehydrated/docs/examples/hook.sh
  3. function deploy_challenge {
  4. local DOMAIN="${1}" TOKEN_FILENAME="${2}" TOKEN_VALUE="${3}"
  5. # This hook is called once for every domain that needs to be
  6. # validated, including any alternative names you may have listed.
  7. #
  8. # Parameters:
  9. # - DOMAIN
  10. # The domain name (CN or subject alternative name) being
  11. # validated.
  12. # - TOKEN_FILENAME
  13. # The name of the file containing the token to be served for HTTP
  14. # validation. Should be served by your web server as
  15. # /.well-known/acme-challenge/${TOKEN_FILENAME}.
  16. # - TOKEN_VALUE
  17. # The token value that needs to be served for validation. For DNS
  18. # validation, this is what you want to put in the _acme-challenge
  19. # TXT record. For HTTP validation it is the value that is expected
  20. # be found in the $TOKEN_FILENAME file.
  21. # Since dehydrated does not always call us with the main domain name,
  22. # use a drush alias passed in from the original invocation via the
  23. # environment variable AEGIR_DRUSH_ALIAS to ensure we find
  24. # the correct context.
  25. local MAIN_DOMAIN="${AEGIR_DRUSH_ALIAS:-@$DOMAIN}"
  26. drush php-eval "d('$MAIN_DOMAIN')->service('http')->sync(d('@server_master')->aegir_root . '/config/letsencrypt.d/well-known/acme-challenge');"
  27. }
  28. HANDLER="$1"; shift
  29. if [[ "${HANDLER}" =~ ^(deploy_challenge)$ ]]; then
  30. "$HANDLER" "$@"
  31. fi