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.

38 lines
1.3 KiB

  1. #!/usr/bin/env sh
  2. # shellcheck disable=SC2034
  3. dns_he_ddns_info='Hurricane Electric HE.net DDNS
  4. Site: dns.he.net
  5. Docs: github.com/acmesh-official/acme.sh/wiki/dnsapi2#dns_he_ddns
  6. Options:
  7. HE_DDNS_KEY The DDNS key for updating the TXT record
  8. Author: Markku Leiniö
  9. '
  10. HE_DDNS_URL="https://dyn.dns.he.net/nic/update"
  11. ######## Public functions #####################
  12. #Usage: dns_he_ddns_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
  13. dns_he_ddns_add() {
  14. fulldomain=$1
  15. txtvalue=$2
  16. HE_DDNS_KEY="${HE_DDNS_KEY:-$(_readaccountconf_mutable HE_DDNS_KEY)}"
  17. if [ -z "$HE_DDNS_KEY" ]; then
  18. HE_DDNS_KEY=""
  19. _err "You didn't specify a DDNS key for accessing the TXT record in HE API."
  20. return 1
  21. fi
  22. #Save the DDNS key to the account conf file.
  23. _saveaccountconf_mutable HE_DDNS_KEY "$HE_DDNS_KEY"
  24. _info "Using Hurricane Electric DDNS API"
  25. _debug fulldomain "$fulldomain"
  26. _debug txtvalue "$txtvalue"
  27. response="$(_post "hostname=$fulldomain&password=$HE_DDNS_KEY&txt=$txtvalue" "$HE_DDNS_URL")"
  28. _info "Response: $response"
  29. _contains "$response" "good" && return 0 || return 1
  30. }
  31. # dns_he_ddns_rm() is not implemented because the API call always updates the
  32. # contents of the existing record (that the API key gives access to).