#!/usr/bin/env sh ## DNSAPI for Acme.sh to work with Ukraine.com.ua (Adm.Tools) API. ## Author: Ivor 'lopar' Barhansky ## ## API Authorization works using Bearer token. ## Required variable: ## AT_TOKEN="t8zpe56g8kj8qy8etx6vgo6hokycdrwgw34hufounf97uv4mvo5d8vpy5zpqnw73" # https://github.com/acmesh-official/acme.sh/wiki/DNS-API-Dev-Guide # https://github.com/acmesh-official/acme.sh/blob/master/dnsapi/dns_bunny.sh # postman ######## Public functions ##################### ## Create the text record for validation. ## Usage: add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs" dns_ukrainecomua_add() { fulldomain=$1 txtvalue=$2 AT_TOKEN="${AT_TOKEN:-$(_readaccountconf_mutable AT_TOKEN)}" if [ -z "$AT_TOKEN" ]; then AT_TOKEN="" _err "You don't specify Adm.Tools API token yet." _err "How to get Api Token: https://www.ukraine.com.ua/wiki/account/api/" return 1 fi _info "Adm.Tools (Ukraine.com.ua) dns validation - add txt record" _debug fulldomain "$fulldomain" _debug txtvalue "$txtvalue" #save the credentials to the account conf file. _saveaccountconf_mutable AT_TOKEN "$AT_TOKEN" #Headers export _H1="Accept: application/json" export _H2="Authorization: Bearer $AT_TOKEN" export _H3="Content-Type: application/json" POSTURL="https://adm.tools/action/dns/record_add/" POSTBODY='{"domain_id":'$_domain_id',"type":"'TXT'","record":"'_acme-challenge'","data":"'$txtvalue'"}' _debug POSTURL "$POSTURL" _debug POSTBODY "$POSTBODY" response="$(_post "$POSTBODY" "$POSTURL")" # $post = [ # 'domain_id' => 1348160, # 'type' => 'TXT', # 'record' => 'qwester', # 'priority' => 0, # 'data' => 'honkeyt-ponkeyt', # } dns_ukrainecomua_rm() { fulldomain=$1 txtvalue=$2 AT_TOKEN="${AT_TOKEN:-$(_readaccountconf_mutable AT_TOKEN)}" if [ -z "$AT_TOKEN" ]; then AT_TOKEN="" _err "You don't specify Adm.Tools API token yet." _err "How to get Api Token: https://www.ukraine.com.ua/wiki/account/api/" return 1 fi _info "Adm.Tools (Ukraine.com.ua) dns validation - remove txt record" _debug fulldomain "$fulldomain" _debug txtvalue "$txtvalue" #Headers export _H1="Accept: application/json" export _H2="Authorization: Bearer $AT_TOKEN" export _H3="Content-Type: application/json" POSTURL="https://adm.tools/action/dns/record_delete/" POSTBODY='{"subdomain_id":'$_subdomain_id'}' _debug POSTURL "$POSTURL" _debug POSTBODY "$POSTBODY" } #################### Private functions below ##################################