mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2025-04-29 17:42:44 +00:00
Initial commit
This commit is contained in:
parent
1d87d9b370
commit
c6a9825c0a
125
dnsapi/dns_efficientip.sh
Executable file
125
dnsapi/dns_efficientip.sh
Executable file
@ -0,0 +1,125 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
export dns_efficientip_info='efficientip.com
|
||||||
|
Site: https://efficientip.com/
|
||||||
|
Docs: github.com/acmesh-official/acme.sh/wiki/dnsapi2#dns_efficientip
|
||||||
|
Options:
|
||||||
|
EfficientIP_Creds HTTP Basic Authentication credentials. E.g. "username:password"
|
||||||
|
EfficientIP_Token_Key Alternative API token key identifier, prefered over basic authentication.
|
||||||
|
EfficientIP_Token_Secret Alternative API token secret, required when using a token key.
|
||||||
|
EfficientIP_Server EfficientIP SOLIDserver Management IP or FQDN.
|
||||||
|
EfficientIP_DNS_Name Name of the DNS smart or server.
|
||||||
|
EfficientIP_View Name of the DNS view (optional).
|
||||||
|
Issues: github.com/acmesh-official/acme.sh/issues/<fixme>
|
||||||
|
Author: EfficientIP-Labs <contact@efficientip.com>
|
||||||
|
'
|
||||||
|
|
||||||
|
dns_efficientip_add() {
|
||||||
|
|
||||||
|
fulldomain=$1
|
||||||
|
txtvalue=$2
|
||||||
|
|
||||||
|
_info "Using EfficientIP API"
|
||||||
|
_debug fulldomain "$fulldomain"
|
||||||
|
_debug txtvalue "$txtvalue"
|
||||||
|
|
||||||
|
if ([ -z "$EfficientIP_Creds" ] && ([ -z "$EfficientIP_Token_Key" ] || [ -z "$EfficientIP_Token_Secret" ])) || [ -z "$EfficientIP_Server" ]; then
|
||||||
|
EfficientIP_Creds=""
|
||||||
|
EfficientIP_Token_Key=""
|
||||||
|
EfficientIP_Token_Secret=""
|
||||||
|
EfficientIP_Server=""
|
||||||
|
_err "You didn't specify any EfficientIP credentials or token or server (EfficientIP_Creds; EfficientIP_Token_Key; EfficientIP_Token_Secret; EfficientIP_Server)."
|
||||||
|
_err "Please set them via EXPORT EfficientIP_Creds=username:password or EXPORT EfficientIP_server=ip/hostname"
|
||||||
|
_err "or if you want to use Token instead set via EXPORT EfficientIP_Token_Key=yourkey"
|
||||||
|
_err "and EXPORT EfficientIP_Token_Secret=yoursecret"
|
||||||
|
_err "and try again."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
_saveaccountconf EfficientIP_Creds "${EfficientIP_Creds}"
|
||||||
|
_saveaccountconf EfficientIP_Token_Key "${EfficientIP_Token_Key}"
|
||||||
|
_saveaccountconf EfficientIP_Token_Secret "${EfficientIP_Token_Secret}"
|
||||||
|
_saveaccountconf EfficientIP_Server "${EfficientIP_Server}"
|
||||||
|
_saveaccountconf EfficientIP_DNS_Name "${EfficientIP_DNS_Name}"
|
||||||
|
_saveaccountconf EfficientIP_View "${EfficientIP_View}"
|
||||||
|
|
||||||
|
EfficientIP_ViewEncoded=$(printf "%b" "${EfficientIP_View}" | _url_encode)
|
||||||
|
EfficientIP_DNSNameEncoded=$(printf "%b" "${EfficientIP_DNS_Name}" | _url_encode)
|
||||||
|
|
||||||
|
export _H1="Accept-Language:en-US"
|
||||||
|
baseurlnObject="https://${EfficientIP_Server}/rest/dns_rr_add?rr_type=TXT&rr_name=$fulldomain&rr_value1=$txtvalue"
|
||||||
|
|
||||||
|
if [ "${EfficientIP_DNSNameEncoded}" != "" ]; then
|
||||||
|
baseurlnObject="${baseurlnObject}&dns_name=${EfficientIP_DNSNameEncoded}"
|
||||||
|
fi
|
||||||
|
if [ "${EfficientIP_ViewEncoded}" != "" ]; then
|
||||||
|
baseurlnObject="${baseurlnObject}&dnsview_name=${EfficientIP_ViewEncoded}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${EfficientIP_Token_Secret}" ] || [ -z "${EfficientIP_Token_Key}" ]; then
|
||||||
|
EfficientIP_CredsEncoded=$(printf "%b" "${EfficientIP_Creds}" | _base64)
|
||||||
|
export _H2="Authorization: Basic ${EfficientIP_CredsEncoded}"
|
||||||
|
else
|
||||||
|
TS=$(date +%s)
|
||||||
|
Sig=$(printf "%b\n$TS\nPOST\n$baseurlnObject" "${EfficientIP_Token_Secret}" | openssl dgst -sha3-256 | cut -d '=' -f 2 | tr -d ' ')
|
||||||
|
EfficientIP_CredsEncoded=$(printf "%b:%b" "${EfficientIP_Token_Key}" "$Sig")
|
||||||
|
export _H2="Authorization: SDS ${EfficientIP_CredsEncoded}"
|
||||||
|
export _H3="X-SDS-TS: ${TS}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
result="$(_post "" "${baseurlnObject}" "" "POST")"
|
||||||
|
|
||||||
|
if [ "$(echo "${result}" | _egrep_o "ret_oid")" ]; then
|
||||||
|
_info "Successfully created the txt record"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
_err "Error encountered during record addition"
|
||||||
|
_err "${result}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
dns_efficientip_rm() {
|
||||||
|
|
||||||
|
fulldomain=$1
|
||||||
|
txtvalue=$2
|
||||||
|
|
||||||
|
_info "Using EfficientIP API"
|
||||||
|
_debug fulldomain "${fulldomain}"
|
||||||
|
_debug txtvalue "${txtvalue}"
|
||||||
|
|
||||||
|
EfficientIP_ViewEncoded=$(printf "%b" "${EfficientIP_View}" | _url_encode)
|
||||||
|
EfficientIP_DNSNameEncoded=$(printf "%b" "${EfficientIP_DNS_Name}" | _url_encode)
|
||||||
|
EfficientIP_CredsEncoded=$(printf "%b" "${EfficientIP_Creds}" | _base64)
|
||||||
|
|
||||||
|
export _H1="Accept-Language:en-US"
|
||||||
|
|
||||||
|
baseurlnObject="https://${EfficientIP_Server}/rest/dns_rr_delete?rr_type=TXT&rr_name=$fulldomain&rr_value1=$txtvalue"
|
||||||
|
if [ "${EfficientIP_DNSNameEncoded}" != "" ]; then
|
||||||
|
baseurlnObject="${baseurlnObject}&dns_name=${EfficientIP_DNSNameEncoded}"
|
||||||
|
fi
|
||||||
|
if [ "${EfficientIP_ViewEncoded}" != "" ]; then
|
||||||
|
baseurlnObject="${baseurlnObject}&dnsview_name=${EfficientIP_ViewEncoded}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$EfficientIP_Token_Secret" ] || [ -z "$EfficientIP_Token_Key" ]; then
|
||||||
|
EfficientIP_CredsEncoded=$(printf "%b" "${EfficientIP_Creds}" | _base64)
|
||||||
|
export _H2="Authorization: Basic $EfficientIP_CredsEncoded"
|
||||||
|
else
|
||||||
|
TS=$(date +%s)
|
||||||
|
Sig=$(printf "%b\n$TS\nDELETE\n${baseurlnObject}" "${EfficientIP_Token_Secret}" | openssl dgst -sha3-256 | cut -d '=' -f 2 | tr -d ' ')
|
||||||
|
EfficientIP_CredsEncoded=$(printf "%b:%b" "${EfficientIP_Token_Key}" "$Sig" | _base64)
|
||||||
|
export _H2="Authorization: SDS ${EfficientIP_CredsEncoded}"
|
||||||
|
export _H3="X-SDS-TS: $TS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
result="$(_post "" "${baseurlnObject}" "" "DELETE")"
|
||||||
|
|
||||||
|
if [ "$(echo "${result}" | _egrep_o "ret_oid")" ]; then
|
||||||
|
_info "Successfully deleted the txt record"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
_err "Error encountered during record delete"
|
||||||
|
_err "${result}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user