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.

48 lines
1.7 KiB

3 years ago
3 years ago
  1. #!/usr/bin/env sh
  2. #Author: Florian Pfitzer
  3. #Report Bugs here: https://github.com/acmesh-official/acme.sh
  4. #export BURP_COLLABORATOR_CONFIG=/etc/burp/collaborator.json
  5. #export BURP_COLLABORATOR_RESTART='/usr/bin/systemctl restart burp-collaborator'
  6. #
  7. ######## Public functions #####################
  8. dns_burp_add() {
  9. txtvalue=$2
  10. _info "Using burp"
  11. BURP_COLLABORATOR_CONFIG="${BURP_COLLABORATOR_CONFIG:-$(_readaccountconf_mutable BURP_COLLABORATOR_CONFIG)}"
  12. BURP_COLLABORATOR_RESTART="${BURP_COLLABORATOR_RESTART:-$(_readaccountconf_mutable BURP_COLLABORATOR_RESTART)}"
  13. if [ -z "$BURP_COLLABORATOR_CONFIG" ] || [ -z "$BURP_COLLABORATOR_RESTART" ]; then
  14. BURP_COLLABORATOR_CONFIG=""
  15. BURP_COLLABORATOR_RESTART=""
  16. _err "You did not specify BURP_COLLABORATOR_CONFIG and BURP_COLLABORATOR_RESTART"
  17. return 1
  18. fi
  19. _saveaccountconf_mutable BURP_COLLABORATOR_CONFIG "$BURP_COLLABORATOR_CONFIG"
  20. _saveaccountconf_mutable BURP_COLLABORATOR_RESTART "$BURP_COLLABORATOR_RESTART"
  21. json=$(cat "$BURP_COLLABORATOR_CONFIG")
  22. json=$(echo "$json" | jq ".customDnsRecords += [{\"label\": \"_acme-challenge\", \"record\": \"$txtvalue\", \"type\": \"TXT\", \"ttl\": 60}]")
  23. echo "$json" >"$BURP_COLLABORATOR_CONFIG"
  24. eval "$BURP_COLLABORATOR_RESTART"
  25. return 0
  26. }
  27. #Usage: fulldomain txtvalue
  28. #Remove the txt record after validation.
  29. dns_burp_rm() {
  30. txtvalue=$2
  31. _info "Using burp"
  32. json=$(cat "$BURP_COLLABORATOR_CONFIG")
  33. json=$(echo "$json" | jq "del(.customDnsRecords[] | select(.label == \"_acme-challenge\"))")
  34. echo "$json" >"$BURP_COLLABORATOR_CONFIG"
  35. eval "$BURP_COLLABORATOR_RESTART"
  36. }
  37. #################### Private functions below ##################################