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.

55 lines
1.7 KiB

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