3 # DNS API for Domain-Offensive / Resellerinterface / Domainrobot
5 # Report bugs at https://github.com/seidler2547/acme.sh/issues
7 # set these environment variables to match your customer ID and password:
11 DO_URL
="https://soap.resellerinterface.de/"
13 ######## Public functions #####################
15 #Usage: dns_myapi_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
19 if _dns_do_authenticate
; then
20 _info
"Adding TXT record to ${_domain} as ${fulldomain}"
21 _dns_do_soap createRR origin
"${_domain}" name "${fulldomain}" type TXT data "${txtvalue}" ttl
300
22 if _contains
"${response}" '>success<'; then
25 _err
"Could not create resource record, check logs"
33 if _dns_do_authenticate
; then
34 if _dns_do_list_rrs
; then
36 for _rrid
in ${_rr_list}; do
37 _info
"Deleting resource record $_rrid for $_domain"
38 _dns_do_soap deleteRR origin
"${_domain}" rrid
"${_rrid}"
39 if ! _contains
"${response}" '>success<'; then
41 _err
"Could not delete resource record for ${_domain}, id ${_rrid}"
44 return $_dns_do_had_error
50 #################### Private functions below ##################################
51 _dns_do_authenticate
() {
52 _info
"Authenticating as ${DO_PID}"
53 _dns_do_soap authPartner partner
"${DO_PID}" password
"${DO_PW}"
54 if _contains
"${response}" '>success<'; then
55 _get_root
"$fulldomain"
56 _debug
"_domain $_domain"
59 _err
"Authentication failed, are DO_PID and DO_PW set correctly?"
65 _dns_do_soap getRRList origin
"${_domain}"
66 if ! _contains
"${response}" 'SOAP-ENC:Array'; then
67 _err
"getRRList origin ${_domain} failed"
70 _rr_list
="$(echo "${response}" \
72 | sed -e 's/<item xsi:type="ns2
:Map
">/\n/g' \
73 | grep ">$
(_regexcape
"$fulldomain")</value
>" \
74 | sed -e 's/<\/item>/\n/g' \
75 | grep '>id</key><value' \
76 | _egrep_o '>[0-9]{1,16}<' \
84 # put the parameters to xml
85 body
="<tns:${func} xmlns:tns=\"${DO_URL}\">"
91 body
="$body<$_k>$_v</$_k>"
93 body
="$body</tns:${func}>"
94 _debug2
"SOAP request ${body}"
97 _xml
='<?xml version="1.0" encoding="UTF-8"?>
98 <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
99 <env:Body>'"$body"'</env:Body>
103 _H1
="SOAPAction: ${DO_URL}#${func}"
105 if ! response
="$(_post "${_xml}" "${DO_URL}")"; then
109 _debug2
"SOAP response $response"
111 # retrieve cookie header
112 _H2
="$(_egrep_o 'Cookie: [^;]+' <"$HTTP_HEADER" | _head_n 1)"
121 _dns_do_soap getDomainList
122 _all_domains
="$(echo "${response}" \
124 | _egrep_o 'domain</key><value[^>]+>[^<]+' \
125 | sed -e 's/^domain<\/key><value[^>]*>//g')"
128 h
=$
(printf "%s" "$domain" | cut
-d .
-f $i-100)
133 if _contains
"${_all_domains}" "^$(_regexcape "$h")\$"; then
140 _debug
"$domain not found"
146 echo "$1" |
sed -e 's/\([]\.$*^[]\)/\\\1/g'