|
@ -1,7 +1,8 @@ |
|
|
#!/usr/bin/env sh |
|
|
#!/usr/bin/env sh |
|
|
# |
|
|
# |
|
|
#Author: lebaned |
|
|
|
|
|
#Report Bugs here: https://github.com/lebaned/acme.sh |
|
|
|
|
|
|
|
|
# DNS API for Versio.nl |
|
|
|
|
|
# Author: lebaned <github@bakker.cloud> |
|
|
|
|
|
# Report Bugs here: https://github.com/lebaned/acme.sh |
|
|
# |
|
|
# |
|
|
######## Public functions ##################### |
|
|
######## Public functions ##################### |
|
|
|
|
|
|
|
@ -13,11 +14,10 @@ dns_versio_add() { |
|
|
_debug fulldomain "$fulldomain" |
|
|
_debug fulldomain "$fulldomain" |
|
|
_debug txtvalue "$txtvalue" |
|
|
_debug txtvalue "$txtvalue" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ! _get_credentials; then |
|
|
if ! _get_credentials; then |
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#save the credentials to the account conf file. |
|
|
#save the credentials to the account conf file. |
|
|
_saveaccountconf_mutable Versio_Username "$Versio_Username" |
|
|
_saveaccountconf_mutable Versio_Username "$Versio_Username" |
|
|
_saveaccountconf_mutable Versio_Password "$Versio_Password" |
|
|
_saveaccountconf_mutable Versio_Password "$Versio_Password" |
|
@ -31,7 +31,7 @@ dns_versio_add() { |
|
|
_info fulldomain "$fulldomain" |
|
|
_info fulldomain "$fulldomain" |
|
|
_info _domain "$_domain" |
|
|
_info _domain "$_domain" |
|
|
_info _sub_domain "$_sub_domain" |
|
|
_info _sub_domain "$_sub_domain" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ! _get_dns_records "$_domain"; then |
|
|
if ! _get_dns_records "$_domain"; then |
|
|
_err "invalid domain" |
|
|
_err "invalid domain" |
|
|
return 1 |
|
|
return 1 |
|
@ -71,9 +71,9 @@ dns_versio_rm() { |
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
_info fulldomain "$fulldomain" |
|
|
|
|
|
_info _domain "$_domain" |
|
|
|
|
|
_info _sub_domain "$_sub_domain" |
|
|
|
|
|
|
|
|
_debug fulldomain "$fulldomain" |
|
|
|
|
|
_debug _domain "$_domain" |
|
|
|
|
|
_debug _sub_domain "$_sub_domain" |
|
|
|
|
|
|
|
|
if ! _get_dns_records "$_domain"; then |
|
|
if ! _get_dns_records "$_domain"; then |
|
|
_err "invalid domain" |
|
|
_err "invalid domain" |
|
@ -96,8 +96,6 @@ dns_versio_rm() { |
|
|
|
|
|
|
|
|
#################### Private functions below ################################## |
|
|
#################### Private functions below ################################## |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#_acme-challenge.www.domain.com |
|
|
#_acme-challenge.www.domain.com |
|
|
#returns |
|
|
#returns |
|
|
# _sub_domain=_acme-challenge.www |
|
|
# _sub_domain=_acme-challenge.www |
|
@ -163,13 +161,12 @@ _versio_rest() { |
|
|
_debug ep "$ep" |
|
|
_debug ep "$ep" |
|
|
|
|
|
|
|
|
VERSIO_API_URL="https://www.versio.nl/api/v1" |
|
|
VERSIO_API_URL="https://www.versio.nl/api/v1" |
|
|
|
|
|
|
|
|
VERSIO_CREDENTIALS_BASE64=$(printf "%s:%s" "$Versio_Username" "$Versio_Password" | openssl enc -base64) |
|
|
VERSIO_CREDENTIALS_BASE64=$(printf "%s:%s" "$Versio_Username" "$Versio_Password" | openssl enc -base64) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export _H1="Accept: application/json" |
|
|
export _H1="Accept: application/json" |
|
|
export _H2="Content-Type: application/json" |
|
|
export _H2="Content-Type: application/json" |
|
|
export _H3="Authorization: Basic $VERSIO_CREDENTIALS_BASE64" |
|
|
export _H3="Authorization: Basic $VERSIO_CREDENTIALS_BASE64" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$mtd" != "GET" ]; then |
|
|
if [ "$mtd" != "GET" ]; then |
|
|
# both POST and DELETE. |
|
|
# both POST and DELETE. |
|
|
_debug data "$data" |
|
|
_debug data "$data" |
|
@ -177,7 +174,7 @@ _versio_rest() { |
|
|
else |
|
|
else |
|
|
response="$(_get "$VERSIO_API_URL/$ep")" |
|
|
response="$(_get "$VERSIO_API_URL/$ep")" |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case $? in |
|
|
case $? in |
|
|
0) |
|
|
0) |
|
|
_debug response "$response" |
|
|
_debug response "$response" |
|
@ -208,7 +205,6 @@ _get_credentials() { |
|
|
_err "Example:" |
|
|
_err "Example:" |
|
|
_err "export Versio_Username=[email address]" |
|
|
_err "export Versio_Username=[email address]" |
|
|
_err "export Versio_Password=[password]" |
|
|
_err "export Versio_Password=[password]" |
|
|
_err "Please create you key and try again." |
|
|
|
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
return 0 |
|
|
return 0 |
|
|