浏览代码

working example

Henning Reich 10 月之前
父节点
当前提交
cb12c8dfd5
共有 3 个文件被更改,包括 69 次插入52 次删除
  1. 69 0
      dnsapi/dns_technitium.sh
  2. 0 49
      dnsapi/dns_technitum.sh
  3. 0 3
      test.technitum.sh

+ 69 - 0
dnsapi/dns_technitium.sh

@@ -0,0 +1,69 @@
+#!/usr/bin/env sh
+# shellcheck disable=SC2034
+dns_Technitium_info='Technitium DNS Server
+
+Site: https://technitium.com/dns/
+Docs: github.com/acmesh-official/acme.sh/wiki/dnsapi2#dns_technitium
+Options:
+ Technitium_Server Server Address
+ Technitium_Token API Token
+Issues: github.com/acmesh-official/acme.sh
+Author: Neil Pang <[email protected]>
+'
+
+#This file name is "dns_myapi.sh"
+#So, here must be a method   dns_myapi_add()
+#Which will be called by acme.sh to add the txt record to your api system.
+#returns 0 means success, otherwise error.
+
+########  Public functions #####################
+
+# Please Read this guide first: https://github.com/acmesh-official/acme.sh/wiki/DNS-API-Dev-Guide
+
+#Usage: dns_myapi_add   _acme-challenge.www.domain.com   "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
+dns_technitium_add() {
+  fulldomain=$1
+  txtvalue=$2
+  _Technitium_account
+  _info "Using Technitium"
+  _debug fulldomain "$fulldomain"
+  _debug txtvalue "$txtvalue"
+  response="$(_get "$Technitium_Server/api/zones/records/add?token=$Technitium_Token&domain=$fulldomain&type=TXT&text=${txtvalue}")"
+  if _contains "$response" '"status":"ok"'; then
+    return 0
+  fi
+  _err "Could not add txt record."
+  return 1
+}
+
+#Usage: fulldomain txtvalue
+#Remove the txt record after validation.
+dns_technitium_rm() {
+  fulldomain=$1
+  txtvalue=$2
+  _info "Using Technitium"
+  response="$(_get "$Technitium_Server/api/zones/records/delete?token=$Technitium_Token&domain=$fulldomain&type=TXT&text=${txtvalue}")"
+  if _contains "$response" '"status":"ok"'; then
+    return 0
+  fi
+  _err "Could not remove txt record"
+  return 1
+}
+
+####################  Private functions below ##################################
+
+_Technitium_account() {
+  Technitium_Server="${Technitium_Server:-$(_readaccountconf_mutable Technitium_Server)}"
+  Technitium_Token="${Technitium_Token:-$(_readaccountconf_mutable Technitium_Token)}"
+  if [ -z "$Technitium_Server" ] || [ -z "$Technitium_Token" ]; then
+    Technitium_Server=""
+    Technitium_Token=""
+    _err "You don't specify Technitium Server and Token yet."
+    _err "Please create your Token and add server address and try again."
+    return 1
+  fi
+
+  #save the credentials to the account conf file.
+  _saveaccountconf_mutable Technitium_Server "$Technitium_Server"
+  _saveaccountconf_mutable Technitium_Token "$Technitium_Token"
+}

+ 0 - 49
dnsapi/dns_technitum.sh

@@ -1,49 +0,0 @@
-#!/usr/bin/env sh
-# shellcheck disable=SC2034
-dns_technitum_info='Technitum DNS Server
-
-Domains: example.com
-Site: github.com/acmesh-official/acme.sh/wiki/DNS-API-Dev-Guide
-Docs: github.com/acmesh-official/acme.sh/wiki/dnsapi#dns_duckdns
-Options:
- MYAPI_Token API Token. Get API Token from https://example.com/api/. Optional.
-Issues: github.com/acmesh-official/acme.sh
-Author: Neil Pang <[email protected]>
-'
-
-#This file name is "dns_myapi.sh"
-#So, here must be a method   dns_myapi_add()
-#Which will be called by acme.sh to add the txt record to your api system.
-#returns 0 means success, otherwise error.
-
-########  Public functions #####################
-
-# Please Read this guide first: https://github.com/acmesh-official/acme.sh/wiki/DNS-API-Dev-Guide
-
-#Usage: dns_myapi_add   _acme-challenge.www.domain.com   "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
-dns_technitum_add() {
-  fulldomain=$1
-  txtvalue=$2
-  _info "Using technitum"
-  _debug fulldomain "$fulldomain"
-  _debug txtvalue "$txtvalue"
-  _err "Not implemented!"
-  return 1
-}
-
-#Usage: fulldomain txtvalue
-#Remove the txt record after validation.
-dns_technitum_rm() {
-  fulldomain=$1
-  txtvalue=$2
-  _info "Using technitum"
-  _debug fulldomain "$fulldomain"
-  _debug txtvalue "$txtvalue"
-  _err "Not implemented!"
-  return 1
-}
-
-####################  Private functions below ##################################
-
-
-dns_technitum_add "_acme-challenge.test.07q.de" "abcd"

+ 0 - 3
test.technitum.sh

@@ -1,3 +0,0 @@
-#!/bin/sh
-
-./acme.sh --issue --staging --debug 2 -d test.07q.de --dns  dns_technitum