3 ########################################################################
4 # https://namemaster.de hook script for acme.sh
6 # Environment variables:
8 # - $NM_user (your namemaster.de API username)
9 # - $NM_sha256 (your namemaster.de API password_as_sha256hash)
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..."
17 namemaster_api
="https://namemaster.de/api/api.php"
22 _info
"Using DNS-01 namemaster hook"
24 NM_user
="${NM_user:-$(_readaccountconf_mutable NM_user)}"
25 NM_sha256
="${NM_sha256:-$(_readaccountconf_mutable NM_sha256)}"
26 if [ -z "$NM_user" ] ||
[ -z "$NM_sha256" ]; then
29 _err
"No auth details provided. Please set user credentials using the \$NM_user and \$NM_sha256 environment variables."
32 #save the api user and sha256 password to the account conf file.
33 _debug
"Save user and hash"
34 _saveaccountconf_mutable NM_user
"$NM_user"
35 _saveaccountconf_mutable NM_sha256
"$NM_sha256"
37 _debug
"First detect the root zone"
38 if ! _get_root
"$fulldomain"; then
39 _err
"invalid domain" "$fulldomain"
43 _info
"die Zone lautet:" "$zone"
45 get
="$namemaster_api?User=$NM_user&Password=$NM_sha256&Antwort=csv&Typ=ACME&zone=$zone&hostname=$fulldomain&TXT=$txt_value&Action=Auto&Lifetime=3600"
47 if ! erg
="$(_get "$get")"; then
48 _err
"error Adding $fulldomain TXT: $txt_value"
52 if _contains
"$erg" "Success"; then
53 _info
"Success, TXT Added, OK"
55 _err
"error Adding $fulldomain TXT: $txt_value erg: $erg"
59 _debug
"ok Auto $fulldomain TXT: $txt_value erg: $erg"
67 _info
"TXT enrty in $fulldomain is deleted automatically"
68 _debug fulldomain
"$fulldomain"
69 _debug txtvalue
"$txtvalue"
77 get
="$namemaster_api?User=$NM_user&Password=$NM_sha256&Typ=acme&hostname=$domain&Action=getzone&antwort=csv"
79 if ! zone
="$(_get "$get")"; then
80 _err
"error getting Zone"
83 if _contains
"$zone" "hostname not found"; then