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")"
40 _err
"error Deleting $zone TXT: $txt_value"
41 _err
"Error $exit_code"
45 if _contains
"$erg" "Success"; then
46 _info
"Success, TXT Added, OK"
48 _err
"error Adding $zone TXT: $txt_value erg: $erg"
52 _debug
"ok Auto $zone TXT: $txt_value erg: $erg"
61 NM_user
="${NM_user:-$(_readaccountconf_mutable NM_user)}"
62 NM_md5
="${NM_md5:-$(_readaccountconf_mutable NM_md5)}"
63 if [ -z "$NM_user" ] ||
[ -z "$NM_md5" ]; then
66 _err
"No auth details provided. Please set user credentials using the \$NM_user and \$NM_md5 environment variables."
70 zone
="$(echo $fulldomain | _egrep_o "[^.
]+.
[^.
]+$
")"
71 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"
73 if ! erg
="$(_get "$get")"
75 _err
"error Deleting $zone TXT: $txt_value"
76 _err
"Error $exit_code"
80 if _contains
"$erg" "Success"; then
81 _info
"Success, TXT removed, OK"
83 _err
"error Auto $zone TXT: $txt_value erg: $erg"
87 _debug
"ok Auto $zone TXT: $txt_value erg: $erg"