Skip to content

Add WEXBO DNS API #6350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions dnsapi/dns_wexbo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env sh
# shellcheck disable=SC2034
dns_wexbo_info='wexbo.com
Site: wexbo.com
Docs: github.com/acmesh-official/acme.sh/wiki/dnsapi2#dns_wexbo
Options:
WEXBO_TOKEN API Token
Issues: github.com/acmesh-official/acme.sh/issues/6349
Author: WEXBO s.r.o. <[email protected]>
'

WEXBO_URL="https://api.wexbo.com/v1/acme/";

######## Public functions #####################

#Usage: add _acme-challenge.www.domain.com "some_long_string_of_characters_go_here_from_lets_encrypt"
dns_wexbo_add(){

fulldomain=$1;
txtvalue=$2;

_wexbo_init

_info "Adding TXT record to ${fulldomain}";
export _H1="Authorization: ${WEXBO_TOKEN}";
response="$(_post "content=${txtvalue}" "${WEXBO_URL}${fulldomain}" "" "POST")";
if _contains "${response}" '"result":true'; then return 0; fi
_err "Error: ${response}"; return 1;

}

dns_wexbo_rm(){

fulldomain=$1;

_wexbo_init

_info "Deleting resource record ${fulldomain}"
export _H1="Authorization: ${WEXBO_TOKEN}";
response="$(_post "" "${WEXBO_URL}${fulldomain}" "" "DELETE")";
if _contains "${response}" '"result":true'; then return 0; fi
_err "Error: ${response}"; return 1;

}

_wexbo_init(){

WEXBO_TOKEN="${WEXBO_TOKEN:-$(_readaccountconf_mutable WEXBO_TOKEN)}";
if [ -z "$WEXBO_TOKEN" ]; then WEXBO_TOKEN=""; _err "Please set WEXBO_TOKEN and try again."; return 1; fi
_saveaccountconf_mutable WEXBO_TOKEN "$WEXBO_TOKEN";

}