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.

50 lines
1.7 KiB

4 years ago
4 years ago
4 years ago
4 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. 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. txtvalue=$2
  32. _info "Using burp"
  33. json=$(cat $BURP_COLLABORATOR_CONFIG)
  34. json=$(echo "$json" | jq "del(.customDnsRecords[] | select(.label == \"_acme-challenge\"))")
  35. echo "$json" >$BURP_COLLABORATOR_CONFIG
  36. eval $BURP_COLLABORATOR_RESTART
  37. }
  38. #################### Private functions below ##################################