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.

65 lines
1.8 KiB

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