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.

61 lines
1.8 KiB

4 months ago
  1. #!/usr/bin/env sh
  2. # shellcheck disable=SC2034
  3. dns_doapi_info='Domain-Offensive do.de
  4. Official LetsEncrypt API for do.de / Domain-Offensive.
  5. This API is also available to private customers/individuals.
  6. Site: do.de
  7. Docs: github.com/acmesh-official/acme.sh/wiki/dnsapi#dns_doapi
  8. Options:
  9. DO_LETOKEN LetsEncrypt Token
  10. Issues: github.com/acmesh-official/acme.sh/issues/2057
  11. '
  12. DO_API="https://my.do.de/api/letsencrypt"
  13. ######## Public functions #####################
  14. #Usage: add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
  15. dns_doapi_add() {
  16. fulldomain=$1
  17. txtvalue=$2
  18. DO_LETOKEN="${DO_LETOKEN:-$(_readaccountconf_mutable DO_LETOKEN)}"
  19. if [ -z "$DO_LETOKEN" ]; then
  20. DO_LETOKEN=""
  21. _err "You didn't configure a do.de API token yet."
  22. _err "Please set DO_LETOKEN and try again."
  23. return 1
  24. fi
  25. _saveaccountconf_mutable DO_LETOKEN "$DO_LETOKEN"
  26. _info "Adding TXT record to ${fulldomain}"
  27. response="$(_get "$DO_API?token=$DO_LETOKEN&domain=${fulldomain}&value=${txtvalue}")"
  28. if _contains "${response}" 'success'; then
  29. return 0
  30. fi
  31. _err "Could not create resource record, check logs"
  32. _err "${response}"
  33. return 1
  34. }
  35. dns_doapi_rm() {
  36. fulldomain=$1
  37. DO_LETOKEN="${DO_LETOKEN:-$(_readaccountconf_mutable DO_LETOKEN)}"
  38. if [ -z "$DO_LETOKEN" ]; then
  39. DO_LETOKEN=""
  40. _err "You didn't configure a do.de API token yet."
  41. _err "Please set DO_LETOKEN and try again."
  42. return 1
  43. fi
  44. _saveaccountconf_mutable DO_LETOKEN "$DO_LETOKEN"
  45. _info "Deleting resource record $fulldomain"
  46. response="$(_get "$DO_API?token=$DO_LETOKEN&domain=${fulldomain}&action=delete")"
  47. if _contains "${response}" 'success'; then
  48. return 0
  49. fi
  50. _err "Could not delete resource record, check logs"
  51. _err "${response}"
  52. return 1
  53. }