3 ########################################################################
4 # https://namemaster.de hook script for acme.sh
6 # Environment variables:
8 # - $NM_user (your namemaster.de API username)
9 # - $NM_md5 (your namemaster.de API password_as_md5hash)
11 # Author: Thilo Gass <thilo.gass@gmail.com>
12 # Git repo: https://github.com/ThiloGa/acme.sh
14 #-- dns_nm_add() - Add TXT record --------------------------------------
15 # Usage: dns_nm_add _acme-challenge.subdomain.domain.com "XyZ123..."
20 _info
"Using DNS-01 namemaster hook"
22 NM_user
="${NM_user:-$(_readaccountconf_mutable NM_user)}"
23 NM_md5
="${NM_md5:-$(_readaccountconf_mutable NM_md5)}"
24 if [ -z "$NM_user" ] ||
[ -z "$NM_md5" ]; then
27 _err
"No auth details provided. Please set user credentials using the \$NM_user and \$NM_md5 environment variables."
30 #save the api user and md5 password to the account conf file.
31 _debug
"Save user and hash"
32 _saveaccountconf_mutable NM_user
"$NM_user"
33 _saveaccountconf_mutable NM_md5
"$NM_md5"
35 zone
="$(echo $fulldomain | _egrep_o "[^.
]+.
[^.
]+$
")"
36 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"
38 if ! erg
="$(_get "$get")"; then
39 _err
"error Deleting $zone TXT: $txt_value"
40 _err
"Error $exit_code"
44 if _contains
"$erg" "Success"; then
45 _info
"Success, TXT Added, OK"
47 _err
"error Adding $zone TXT: $txt_value erg: $erg"
51 _debug
"ok Auto $zone TXT: $txt_value erg: $erg"
60 NM_user
="${NM_user:-$(_readaccountconf_mutable NM_user)}"
61 NM_md5
="${NM_md5:-$(_readaccountconf_mutable NM_md5)}"
62 if [ -z "$NM_user" ] ||
[ -z "$NM_md5" ]; then
65 _err
"No auth details provided. Please set user credentials using the \$NM_user and \$NM_md5 environment variables."
69 zone
="$(echo $fulldomain | _egrep_o "[^.
]+.
[^.
]+$
")"
70 get
="https://namemaster.de/api/api.php?User=$NM_user&Password=$NM_md5&Antwort=csv&Int=0&Typ=TXT&Zone=$zone&hostname=$fulldomain&TXT=$txt_value&Action=Delete_IN&TTL=0"
72 if ! erg
="$(_get "$get")"; then
73 _err
"error Deleting $zone TXT: $txt_value"
74 _err
"Error $exit_code"
78 if _contains
"$erg" "Success"; then
79 _info
"Success, TXT removed, OK"
81 _err
"error Auto $zone TXT: $txt_value erg: $erg"
85 _debug
"ok Auto $zone TXT: $txt_value erg: $erg"