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.7 KiB

5 years ago
5 years ago
  1. #!/usr/bin/env sh
  2. # shellcheck disable=SC2034
  3. dns_df_info='DynDnsFree.de
  4. Domains: dynup.de
  5. Site: DynDnsFree.de
  6. Docs: github.com/acmesh-official/acme.sh/wiki/dnsapi2#dns_df
  7. Options:
  8. DF_user Username
  9. DF_password Password
  10. Issues: github.com/acmesh-official/acme.sh/issues/2897
  11. Author: Thilo Gass <thilo.gass@gmail.com>
  12. '
  13. dyndnsfree_api="https://dynup.de/acme.php"
  14. dns_df_add() {
  15. fulldomain=$1
  16. txt_value=$2
  17. _info "Using DNS-01 dyndnsfree.de hook"
  18. DF_user="${DF_user:-$(_readaccountconf_mutable DF_user)}"
  19. DF_password="${DF_password:-$(_readaccountconf_mutable DF_password)}"
  20. if [ -z "$DF_user" ] || [ -z "$DF_password" ]; then
  21. DF_user=""
  22. DF_password=""
  23. _err "No auth details provided. Please set user credentials using the \$DF_user and \$DF_password environment variables."
  24. return 1
  25. fi
  26. #save the api user and password to the account conf file.
  27. _debug "Save user and password"
  28. _saveaccountconf_mutable DF_user "$DF_user"
  29. _saveaccountconf_mutable DF_password "$DF_password"
  30. domain="$(printf "%s" "$fulldomain" | cut -d"." -f2-)"
  31. get="$dyndnsfree_api?username=$DF_user&password=$DF_password&hostname=$domain&add_hostname=$fulldomain&txt=$txt_value"
  32. if ! erg="$(_get "$get")"; then
  33. _err "error Adding $fulldomain TXT: $txt_value"
  34. return 1
  35. fi
  36. if _contains "$erg" "success"; then
  37. _info "Success, TXT Added, OK"
  38. else
  39. _err "error Adding $fulldomain TXT: $txt_value erg: $erg"
  40. return 1
  41. fi
  42. _debug "ok Auto $fulldomain TXT: $txt_value erg: $erg"
  43. return 0
  44. }
  45. dns_df_rm() {
  46. fulldomain=$1
  47. txtvalue=$2
  48. _info "TXT enrty in $fulldomain is deleted automatically"
  49. _debug fulldomain "$fulldomain"
  50. _debug txtvalue "$txtvalue"
  51. }