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.

62 lines
1.9 KiB

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