|
@ -24,7 +24,7 @@ dns_nm_add() { |
|
|
if [ -z "$NM_user" ] || [ -z "$NM_md5" ]; then |
|
|
if [ -z "$NM_user" ] || [ -z "$NM_md5" ]; then |
|
|
NM_user="" |
|
|
NM_user="" |
|
|
NM_md5="" |
|
|
NM_md5="" |
|
|
_err "No auth details provided. Please set user credentials using the \$NM_user and \$NM_md5 environment variables." |
|
|
|
|
|
|
|
|
_err "No auth details provided. Please set user credentials using the \$NM_user and \$NM_md5 environment variables." |
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
#save the api user and md5 password to the account conf file. |
|
|
#save the api user and md5 password to the account conf file. |
|
@ -32,15 +32,14 @@ dns_nm_add() { |
|
|
_saveaccountconf_mutable NM_user "$NM_user" |
|
|
_saveaccountconf_mutable NM_user "$NM_user" |
|
|
_saveaccountconf_mutable NM_md5 "$NM_md5" |
|
|
_saveaccountconf_mutable NM_md5 "$NM_md5" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
zone="$(echo $fulldomain | _egrep_o "[^.]+.[^.]+$")" |
|
|
zone="$(echo $fulldomain | _egrep_o "[^.]+.[^.]+$")" |
|
|
get="https://namemaster.de/api/api.php?User=$NM_user&Password=$NM_md5&Antwort=csv&Int=0&Typ=ACME&Zone=$zone&hostname=$fulldomain&TXT=$txt_value&Action=Auto&Lifetime=3600" |
|
|
get="https://namemaster.de/api/api.php?User=$NM_user&Password=$NM_md5&Antwort=csv&Int=0&Typ=ACME&Zone=$zone&hostname=$fulldomain&TXT=$txt_value&Action=Auto&Lifetime=3600" |
|
|
erg="$(_get "$get")" |
|
|
erg="$(_get "$get")" |
|
|
|
|
|
|
|
|
if [ "$?" != "0" ]; then |
|
|
if [ "$?" != "0" ]; then |
|
|
_err "error $action $zone TXT: $txt" |
|
|
|
|
|
|
|
|
_err "error Auto $zone TXT: $txt" |
|
|
_err "Error $?" |
|
|
_err "Error $?" |
|
|
return 1 |
|
|
|
|
|
|
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
if _contains "$erg" "Success"; then |
|
|
if _contains "$erg" "Success"; then |
|
@ -56,15 +55,15 @@ dns_nm_add() { |
|
|
|
|
|
|
|
|
dns_nm_rm() { |
|
|
dns_nm_rm() { |
|
|
|
|
|
|
|
|
fulldomain=$1 |
|
|
|
|
|
txt_value=$2 |
|
|
|
|
|
|
|
|
fulldomain=$1 |
|
|
|
|
|
txt_value=$2 |
|
|
|
|
|
|
|
|
NM_user="${NM_user:-$(_readaccountconf_mutable NM_user)}" |
|
|
NM_user="${NM_user:-$(_readaccountconf_mutable NM_user)}" |
|
|
NM_md5="${NM_md5:-$(_readaccountconf_mutable NM_md5)}" |
|
|
NM_md5="${NM_md5:-$(_readaccountconf_mutable NM_md5)}" |
|
|
if [ -z "$NM_user" ] || [ -z "$NM_md5" ]; then |
|
|
if [ -z "$NM_user" ] || [ -z "$NM_md5" ]; then |
|
|
NM_user="" |
|
|
NM_user="" |
|
|
NM_md5="" |
|
|
NM_md5="" |
|
|
_err "No auth details provided. Please set user credentials using the \$NM_user and \$NM_md5 environment variables." |
|
|
|
|
|
|
|
|
_err "No auth details provided. Please set user credentials using the \$NM_user and \$NM_md5 environment variables." |
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
@ -73,20 +72,19 @@ txt_value=$2 |
|
|
erg="$(_get "$get")" |
|
|
erg="$(_get "$get")" |
|
|
if [ "$?" != "0" ]; then |
|
|
if [ "$?" != "0" ]; then |
|
|
_err "error $action $zone TXT: $txt" |
|
|
_err "error $action $zone TXT: $txt" |
|
|
_err "Error $?" |
|
|
|
|
|
|
|
|
_err "Error $?" |
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
if _contains "$erg" "Success"; then |
|
|
|
|
|
_info "Success, TXT removed, OK" |
|
|
|
|
|
|
|
|
|
|
|
else |
|
|
|
|
|
_err "error Auto $zone TXT: $txt erg: $erg" |
|
|
|
|
|
return 1 |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
if _contains "$erg" "Success"; then |
|
|
|
|
|
_info "Success, TXT removed, OK" |
|
|
|
|
|
else |
|
|
|
|
|
_err "error Auto $zone TXT: $txt erg: $erg" |
|
|
|
|
|
return 1 |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
_debug "ok Auto $zone TXT: $txt erg: $erg" |
|
|
|
|
|
return 0 |
|
|
|
|
|
|
|
|
_debug "ok Auto $zone TXT: $txt erg: $erg" |
|
|
|
|
|
return 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |