Merge 23492c3035a46d1041aac6dd423fd5ad0efb4700 into 40b6db6a2715628aa977ed1853fe5256704010ae

This commit is contained in:
Florian Pfitzer 2025-04-03 04:05:35 +02:00 committed by GitHub
commit aad774c781
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

48
dnsapi/dns_burp.sh Normal file
View File

@ -0,0 +1,48 @@
#!/usr/bin/env sh
#Author: Florian Pfitzer
#Report Bugs here: https://github.com/acmesh-official/acme.sh
#export BURP_COLLABORATOR_CONFIG=/etc/burp/collaborator.json
#export BURP_COLLABORATOR_RESTART='/usr/bin/systemctl restart burp-collaborator'
#
######## Public functions #####################
dns_burp_add() {
txtvalue=$2
_info "Using burp"
BURP_COLLABORATOR_CONFIG="${BURP_COLLABORATOR_CONFIG:-$(_readaccountconf_mutable BURP_COLLABORATOR_CONFIG)}"
BURP_COLLABORATOR_RESTART="${BURP_COLLABORATOR_RESTART:-$(_readaccountconf_mutable BURP_COLLABORATOR_RESTART)}"
if [ -z "$BURP_COLLABORATOR_CONFIG" ] || [ -z "$BURP_COLLABORATOR_RESTART" ]; then
BURP_COLLABORATOR_CONFIG=""
BURP_COLLABORATOR_RESTART=""
_err "You did not specify BURP_COLLABORATOR_CONFIG and BURP_COLLABORATOR_RESTART"
return 1
fi
_saveaccountconf_mutable BURP_COLLABORATOR_CONFIG "$BURP_COLLABORATOR_CONFIG"
_saveaccountconf_mutable BURP_COLLABORATOR_RESTART "$BURP_COLLABORATOR_RESTART"
json=$(cat "$BURP_COLLABORATOR_CONFIG")
json=$(echo "$json" | jq ".customDnsRecords += [{\"label\": \"_acme-challenge\", \"record\": \"$txtvalue\", \"type\": \"TXT\", \"ttl\": 60}]")
echo "$json" >"$BURP_COLLABORATOR_CONFIG"
eval "$BURP_COLLABORATOR_RESTART"
return 0
}
#Usage: fulldomain txtvalue
#Remove the txt record after validation.
dns_burp_rm() {
txtvalue=$2
_info "Using burp"
json=$(cat "$BURP_COLLABORATOR_CONFIG")
json=$(echo "$json" | jq "del(.customDnsRecords[] | select(.label == \"_acme-challenge\"))")
echo "$json" >"$BURP_COLLABORATOR_CONFIG"
eval "$BURP_COLLABORATOR_RESTART"
}
#################### Private functions below ##################################