mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-12-27 07:21:53 +00:00
Added support for custom domains
This commit is contained in:
parent
844c5027ea
commit
395fdc9d61
@ -13,14 +13,18 @@ dns_dynv6_add() {
|
|||||||
_debug txtvalue "$txtvalue"
|
_debug txtvalue "$txtvalue"
|
||||||
_get_keyfile
|
_get_keyfile
|
||||||
_info "using keyfile $dynv6_keyfile"
|
_info "using keyfile $dynv6_keyfile"
|
||||||
_get_domain "$fulldomain"
|
|
||||||
_your_hosts="$(ssh -i "$dynv6_keyfile" api@dynv6.com hosts)"
|
_your_hosts="$(ssh -i "$dynv6_keyfile" api@dynv6.com hosts)"
|
||||||
if ! _contains "$_your_hosts" "$_host"; then
|
|
||||||
_debug "The host is $_host and the record $_record"
|
if ! _get_domain "$fulldomain" "$_your_hosts"; then
|
||||||
_debug "Dynv6 returned $_your_hosts"
|
_err "Host not found on your account"
|
||||||
_err "The host $_host does not exist on your dynv6 account"
|
return 1
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
|
# if ! _contains "$_your_hosts" "$_host"; then
|
||||||
|
# _debug "The host is $_host and the record $_record"
|
||||||
|
# _debug "Dynv6 returned $_your_hosts"
|
||||||
|
# _err "The host $_host does not exists on your dynv6 account"
|
||||||
|
# return 1
|
||||||
|
# fi
|
||||||
_debug "found host on your account"
|
_debug "found host on your account"
|
||||||
returnval="$(ssh -i "$dynv6_keyfile" api@dynv6.com hosts \""$_host"\" records set \""$_record"\" txt data \""$txtvalue"\")"
|
returnval="$(ssh -i "$dynv6_keyfile" api@dynv6.com hosts \""$_host"\" records set \""$_record"\" txt data \""$txtvalue"\")"
|
||||||
_debug "Dynv6 returend this after record was added: $returnval"
|
_debug "Dynv6 returend this after record was added: $returnval"
|
||||||
@ -44,14 +48,17 @@ dns_dynv6_rm() {
|
|||||||
_debug txtvalue "$txtvalue"
|
_debug txtvalue "$txtvalue"
|
||||||
_get_keyfile
|
_get_keyfile
|
||||||
_info "using keyfile $dynv6_keyfile"
|
_info "using keyfile $dynv6_keyfile"
|
||||||
_get_domain "$fulldomain"
|
|
||||||
_your_hosts="$(ssh -i "$dynv6_keyfile" api@dynv6.com hosts)"
|
_your_hosts="$(ssh -i "$dynv6_keyfile" api@dynv6.com hosts)"
|
||||||
if ! _contains "$_your_hosts" "$_host"; then
|
if ! _get_domain "$fulldomain" "$_your_hosts"; then
|
||||||
_debug "The host is $_host and the record $_record"
|
_err "Host not found on your account"
|
||||||
_debug "Dynv6 returned $_your_hosts"
|
return 1
|
||||||
_err "The host $_host does not exist on your dynv6 account"
|
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
|
# if ! _contains "$_your_hosts" "$_host"; then
|
||||||
|
# _debug "The host is $_host and the record $_record"
|
||||||
|
# _debug "Dynv6 returned $_your_hosts"
|
||||||
|
# _err "The host $_host does not exists on your dynv6 account"
|
||||||
|
# return 1
|
||||||
|
# fi
|
||||||
_debug "found host on your account"
|
_debug "found host on your account"
|
||||||
_info "$(ssh -i "$dynv6_keyfile" api@dynv6.com hosts "\"$_host\"" records del "\"$_record\"" txt)"
|
_info "$(ssh -i "$dynv6_keyfile" api@dynv6.com hosts "\"$_host\"" records del "\"$_record\"" txt)"
|
||||||
return 0
|
return 0
|
||||||
@ -72,29 +79,30 @@ _generate_new_key() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
#Usage: _acme-challenge.www.example.dynv6.net
|
|
||||||
|
#Usage: _acme-challenge.www.example.dynv6.net "$_your_hosts"
|
||||||
|
#where _your_hosts is the output of ssh -i ~/.ssh/dynv6.pub api@dynv6.com hosts
|
||||||
#returns
|
#returns
|
||||||
#_host= example.dynv6.net
|
#_host= example.dynv6.net
|
||||||
#_record=_acme-challenge.www
|
#_record=_acme-challenge.www
|
||||||
#aborts if not a valid domain
|
#aborts if not a valid domain
|
||||||
_get_domain() {
|
_get_domain() {
|
||||||
|
#_your_hosts="$(ssh -i ~/.ssh/dynv6.pub api@dynv6.com hosts)"
|
||||||
_full_domain="$1"
|
_full_domain="$1"
|
||||||
_debug "getting domain for $_full_domain"
|
_your_hosts="$2"
|
||||||
if ! _contains "$_full_domain" 'dynv6.net' && ! _contains "$_full_domain" 'dns.army' && ! _contains "$_full_domain" 'dns.navy' && ! _contains "$_full_domain" 'v6.rocks'; then
|
|
||||||
_err "The hosts does not seem to be a dynv6 host"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
_record="${_full_domain%.*}"
|
|
||||||
_record="${_record%.*}"
|
|
||||||
_record="${_record%.*}"
|
|
||||||
_debug "The record we are ging to use is $_record"
|
|
||||||
_host="$_full_domain"
|
|
||||||
while [ "$(echo "$_host" | grep -o '\.' | wc -l)" != "2" ]; do
|
|
||||||
_host="${_host#*.}"
|
|
||||||
done
|
|
||||||
_debug "And the host is $_host"
|
|
||||||
return 0
|
|
||||||
|
|
||||||
|
_your_hosts="$(echo "$_your_hosts" | awk '/\./ {print $1}')"
|
||||||
|
for l in $_your_hosts; do
|
||||||
|
#echo "host: $l"
|
||||||
|
if test "${_full_domain#*$l}" != "$_full_domain"; then
|
||||||
|
_record="${_full_domain%.$l}"
|
||||||
|
_host=$l
|
||||||
|
_debug "The host is $_host and the record $_record"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
_err "Either their is no such host on your dnyv6 account or it cannot be accessed with this key"
|
||||||
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Usage: No input required
|
# Usage: No input required
|
||||||
@ -103,7 +111,7 @@ _get_domain() {
|
|||||||
_get_keyfile() {
|
_get_keyfile() {
|
||||||
_debug "get keyfile method called"
|
_debug "get keyfile method called"
|
||||||
dynv6_keyfile="${dynv6_keyfile:-$(_readaccountconf_mutable dynv6_keyfile)}"
|
dynv6_keyfile="${dynv6_keyfile:-$(_readaccountconf_mutable dynv6_keyfile)}"
|
||||||
_debug Your key is "$dynv6_keyfile"
|
_debug "Your key is $dynv6_keyfile"
|
||||||
if [ -z "$dynv6_keyfile" ]; then
|
if [ -z "$dynv6_keyfile" ]; then
|
||||||
if [ -z "$KEY" ]; then
|
if [ -z "$KEY" ]; then
|
||||||
_err "You did not specify a key to use with dynv6"
|
_err "You did not specify a key to use with dynv6"
|
||||||
|
Loading…
Reference in New Issue
Block a user