2025-10-18 08:16:51 -04:00
#!/usr/bin/env sh
2025-04-22 09:56:49 -04:00
# shellcheck disable=SC2034
2025-04-18 12:06:12 -04:00
dns_efficientip_info = ' efficientip.com
2025-04-18 11:25:55 -04:00
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"
2025-04-22 05:32:23 -04:00
EfficientIP_Server EfficientIP SOLIDserver Management IP address or FQDN.
EfficientIP_DNS_Name Name of the DNS smart or server hosting the zone. Optional.
EfficientIP_View Name of the DNS view hosting the zone. Optional.
OptionsAlt:
EfficientIP_Token_Key Alternative API token key, prefered over basic authentication.
2025-04-18 11:25:55 -04:00
EfficientIP_Token_Secret Alternative API token secret, required when using a token key.
2025-04-22 05:32:23 -04:00
EfficientIP_Server EfficientIP SOLIDserver Management IP address or FQDN.
EfficientIP_DNS_Name Name of the DNS smart or server hosting the zone. Optional.
EfficientIP_View Name of the DNS view hosting the zone. Optional.
2025-04-22 05:40:01 -04:00
Issues: github.com/acmesh-official/acme.sh/issues/6325
2025-04-18 11:25:55 -04:00
Author: EfficientIP-Labs <contact@efficientip.com>
'
dns_efficientip_add( ) {
fulldomain = $1
txtvalue = $2
_info "Using EfficientIP API"
_debug fulldomain " $fulldomain "
_debug txtvalue " $txtvalue "
2025-04-22 09:49:41 -04:00
if { [ -z " ${ EfficientIP_Creds } " ] && { [ -z " ${ EfficientIP_Token_Key } " ] || [ -z " ${ EfficientIP_Token_Secret } " ] ; } ; } || [ -z " ${ EfficientIP_Server } " ] ; then
2025-04-18 11:25:55 -04:00
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"
2025-04-22 09:31:17 -04:00
_err "or if you want to use Token instead EXPORT EfficientIP_Token_Key=yourkey"
2025-04-18 11:25:55 -04:00
_err "and EXPORT EfficientIP_Token_Secret=yoursecret"
2025-04-22 09:31:17 -04:00
_err "then try again."
2025-04-18 11:25:55 -04:00
return 1
fi
2025-04-22 05:17:14 -04:00
if [ -z " ${ EfficientIP_DNS_Name } " ] ; then
EfficientIP_DNS_Name = ""
2025-04-22 09:41:22 -04:00
fi
2025-04-22 05:17:14 -04:00
EfficientIP_DNSNameEncoded = $( printf "%b" " ${ EfficientIP_DNS_Name } " | _url_encode)
if [ -z " ${ EfficientIP_View } " ] ; then
EfficientIP_View = ""
2025-04-22 09:41:22 -04:00
fi
2025-04-22 05:17:14 -04:00
EfficientIP_ViewEncoded = $( printf "%b" " ${ EfficientIP_View } " | _url_encode)
2025-04-18 11:25:55 -04:00
_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 } "
export _H1 = "Accept-Language:en-US"
2025-04-24 07:33:28 -04:00
baseurlnObject = " https:// ${ EfficientIP_Server } /rest/dns_rr_add?rr_type=TXT&rr_ttl=300&rr_name= ${ fulldomain } &rr_value1= ${ txtvalue } "
2025-04-18 11:25:55 -04:00
if [ " ${ EfficientIP_DNSNameEncoded } " != "" ] ; then
baseurlnObject = " ${ baseurlnObject } &dns_name= ${ EfficientIP_DNSNameEncoded } "
fi
2025-04-22 05:17:14 -04:00
2025-04-18 11:25:55 -04:00
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)
2025-05-25 12:36:57 -04:00
Sig = $( printf " %b\n $TS \nPOST\n $baseurlnObject " " ${ EfficientIP_Token_Secret } " | _digest sha3-256 hex)
2025-04-18 11:25:55 -04:00
EfficientIP_CredsEncoded = $( printf "%b:%b" " ${ EfficientIP_Token_Key } " " $Sig " )
export _H2 = " Authorization: SDS ${ EfficientIP_CredsEncoded } "
export _H3 = " X-SDS-TS: ${ TS } "
fi
2025-04-22 12:01:29 -04:00
result = " $( _post "" " ${ baseurlnObject } " "" "POST" ) "
2025-04-18 11:25:55 -04:00
if [ " $( echo " ${ result } " | _egrep_o "ret_oid" ) " ] ; then
2025-04-24 10:05:20 -04:00
_info "DNS record successfully created"
2025-04-18 11:25:55 -04:00
return 0
else
2025-04-24 10:05:20 -04:00
_err "Error creating DNS record"
2025-04-18 11:25:55 -04:00
_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
2025-04-22 09:41:22 -04:00
2025-04-18 11:25:55 -04:00
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)
2025-06-23 02:59:33 -04:00
Sig = $( printf " %b\n $TS \nDELETE\n ${ baseurlnObject } " " ${ EfficientIP_Token_Secret } " | _digest sha3-256 hex)
2025-11-25 08:47:26 -05:00
EfficientIP_CredsEncoded = $( printf "%b:%b" " ${ EfficientIP_Token_Key } " " $Sig " )
2025-04-18 11:25:55 -04:00
export _H2 = " Authorization: SDS ${ EfficientIP_CredsEncoded } "
export _H3 = " X-SDS-TS: $TS "
fi
2025-04-22 12:01:29 -04:00
result = " $( _post "" " ${ baseurlnObject } " "" "DELETE" ) "
2025-04-18 11:25:55 -04:00
if [ " $( echo " ${ result } " | _egrep_o "ret_oid" ) " ] ; then
2025-04-24 10:05:20 -04:00
_info "DNS Record successfully deleted"
2025-04-18 11:25:55 -04:00
return 0
else
2025-04-24 10:05:20 -04:00
_err "Error deleting DNS record"
2025-04-18 11:25:55 -04:00
_err " ${ result } "
return 1
fi
2025-04-22 11:06:33 -04:00
}