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.

56 lines
1.8 KiB

  1. #!/usr/bin/env sh
  2. #
  3. # Author: Marvin Edeler
  4. # Report Bugs here: https://github.com/Marvo2011/acme.sh/issues/1
  5. # Last Edit: 09.01.2022
  6. dns_selfhost_add() {
  7. domain=$1
  8. txt=$2
  9. _info "Calling acme-dns on selfhost"
  10. _debug fulldomain "$domain"
  11. _debug txtvalue "$txt"
  12. SELFHOSTDNS_UPDATE_URL="https://selfhost.de/cgi-bin/api.pl"
  13. SELFHOSTDNS_USERNAME="${SELFHOSTDNS_USERNAME:-$(_readaccountconf_mutable SELFHOSTDNS_USERNAME)}"
  14. SELFHOSTDNS_PASSWORD="${SELFHOSTDNS_PASSWORD:-$(_readaccountconf_mutable SELFHOSTDNS_PASSWORD)}"
  15. SELFHOSTDNS_RID="${SELFHOSTDNS_RID:-$(_readaccountconf_mutable SELFHOSTDNS_RID)}"
  16. SELFHOSTDNS_RID2="${SELFHOSTDNS_RID2:-$(_readaccountconf_mutable SELFHOSTDNS_RID2)}"
  17. SELFHOSTDNS_LAST_SLOT="$(_readaccountconf_mutable SELFHOSTDNS_LAST_SLOT)"
  18. if test -z "$SELFHOSTDNS_LAST_SLOT"; then
  19. SELFHOSTDNS_LAST_SLOT=1
  20. fi
  21. _saveaccountconf_mutable SELFHOSTDNS_USERNAME "$SELFHOSTDNS_USERNAME"
  22. _saveaccountconf_mutable SELFHOSTDNS_PASSWORD "$SELFHOSTDNS_PASSWORD"
  23. _saveaccountconf_mutable SELFHOSTDNS_RID "$SELFHOSTDNS_RID"
  24. _saveaccountconf_mutable SELFHOSTDNS_RID2 "$SELFHOSTDNS_RID2"
  25. if [ $SELFHOSTDNS_LAST_SLOT = "2" ]; then
  26. rid=$SELFHOSTDNS_RID
  27. SELFHOSTDNS_LAST_SLOT=1
  28. else
  29. rid=$SELFHOSTDNS_RID2
  30. SELFHOSTDNS_LAST_SLOT=2
  31. fi
  32. _saveaccountconf_mutable SELFHOSTDNS_LAST_SLOT "$SELFHOSTDNS_LAST_SLOT"
  33. _info "Trying to add $txt on selfhost for rid: $rid"
  34. data="?username=$SELFHOSTDNS_USERNAME&password=$SELFHOSTDNS_PASSWORD&rid=$rid&content=$txt"
  35. response="$(_get "$SELFHOSTDNS_UPDATE_URL$data")"
  36. if ! echo "$response" | grep "200 OK" >/dev/null; then
  37. _err "Invalid response of acme-dns for selfhost"
  38. return 1
  39. fi
  40. }
  41. dns_acmedns_rm() {
  42. domain=$1
  43. txt=$2
  44. _debug fulldomain "$domain"
  45. _debug txtvalue "$txt"
  46. }