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.

51 lines
1.7 KiB

  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. fulldomain=$1
  10. txtvalue=$2
  11. _info "Using burp"
  12. BURP_COLLABORATOR_CONFIG="${BURP_COLLABORATOR_CONFIG:-$(_readaccountconf_mutable BURP_COLLABORATOR_CONFIG)}"
  13. BURP_COLLABORATOR_RESTART="${BURP_COLLABORATOR_RESTART:-$(_readaccountconf_mutable BURP_COLLABORATOR_RESTART)}"
  14. if [ -z "$BURP_COLLABORATOR_CONFIG" ] || [ -z "$BURP_COLLABORATOR_RESTART" ]; then
  15. BURP_COLLABORATOR_CONFIG=""
  16. BURP_COLLABORATOR_RESTART=""
  17. _err "You did not specify BURP_COLLABORATOR_CONFIG and BURP_COLLABORATOR_RESTART"
  18. return 1
  19. fi
  20. _saveaccountconf_mutable BURP_COLLABORATOR_CONFIG "$BURP_COLLABORATOR_CONFIG"
  21. _saveaccountconf_mutable BURP_COLLABORATOR_RESTART "$BURP_COLLABORATOR_RESTART"
  22. json=$(cat $BURP_COLLABORATOR_CONFIG)
  23. json=$(echo $json|jq ".customDnsRecords += [{\"label\": \"_acme-challenge\", \"record\": \"$txtvalue\", \"type\": \"TXT\", \"ttl\": 60}]")
  24. echo "$json" > $BURP_COLLABORATOR_CONFIG
  25. eval $BURP_COLLABORATOR_RESTART
  26. return 0
  27. }
  28. #Usage: fulldomain txtvalue
  29. #Remove the txt record after validation.
  30. dns_burp_rm() {
  31. fulldomain=$1
  32. txtvalue=$2
  33. _info "Using burp"
  34. json=$(cat $BURP_COLLABORATOR_CONFIG)
  35. json=$(echo $json|jq "del(.customDnsRecords[] | select(.label == \"_acme-challenge\"))")
  36. echo "$json" > $BURP_COLLABORATOR_CONFIG
  37. eval $BURP_COLLABORATOR_RESTART
  38. }
  39. #################### Private functions below ##################################