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.

68 lines
1.6 KiB

  1. #!/usr/bin/env sh
  2. # shellcheck disable=SC2034
  3. dns_tele3_info='tele3.cz
  4. Site: tele3.cz
  5. Docs: github.com/acmesh-official/acme.sh/wiki/dnsapi2#tele3
  6. Options:
  7. TELE3_Key API Key
  8. TELE3_Secret API Secret
  9. Author: Roman Blizik <https://github.com/par-pa>
  10. '
  11. TELE3_API="https://www.tele3.cz/acme/"
  12. ######## Public functions #####################
  13. dns_tele3_add() {
  14. _info "Using TELE3 DNS"
  15. data="\"ope\":\"add\", \"domain\":\"$1\", \"value\":\"$2\""
  16. if ! _tele3_call; then
  17. _err "Publish zone failed"
  18. return 1
  19. fi
  20. _info "Zone published"
  21. }
  22. dns_tele3_rm() {
  23. _info "Using TELE3 DNS"
  24. data="\"ope\":\"rm\", \"domain\":\"$1\", \"value\":\"$2\""
  25. if ! _tele3_call; then
  26. _err "delete TXT record failed"
  27. return 1
  28. fi
  29. _info "TXT record successfully deleted"
  30. }
  31. #################### Private functions below ##################################
  32. _tele3_init() {
  33. TELE3_Key="${TELE3_Key:-$(_readaccountconf_mutable TELE3_Key)}"
  34. TELE3_Secret="${TELE3_Secret:-$(_readaccountconf_mutable TELE3_Secret)}"
  35. if [ -z "$TELE3_Key" ] || [ -z "$TELE3_Secret" ]; then
  36. TELE3_Key=""
  37. TELE3_Secret=""
  38. _err "You must export variables: TELE3_Key and TELE3_Secret"
  39. return 1
  40. fi
  41. #save the config variables to the account conf file.
  42. _saveaccountconf_mutable TELE3_Key "$TELE3_Key"
  43. _saveaccountconf_mutable TELE3_Secret "$TELE3_Secret"
  44. }
  45. _tele3_call() {
  46. _tele3_init
  47. data="{\"key\":\"$TELE3_Key\", \"secret\":\"$TELE3_Secret\", $data}"
  48. _debug data "$data"
  49. response="$(_post "$data" "$TELE3_API" "" "POST")"
  50. _debug response "$response"
  51. if [ "$response" != "success" ]; then
  52. _err "$response"
  53. return 1
  54. fi
  55. }