Add funtion to set DNSAPI variable
authorWolfgang Link <w.link@proxmox.com>
Mon, 6 Apr 2020 04:48:38 +0000 (06:48 +0200)
committerWolfgang Link <w.link@proxmox.com>
Wed, 15 Apr 2020 12:56:39 +0000 (14:56 +0200)
acme.sh DNS plugins expect a configuration in which the login information
is stored.
We pass the credentials with the command.
This function supports the expected behavior of the plugins.

Signed-off-by: Wolfgang Link <w.link@proxmox.com>
src/proxmox-acme

index 662c39a0535d18276b3bcb5b8fd9b4a03213085c..b4e01d8299eb85e0e93240594eed93ccf1cd28e8 100644 (file)
@@ -568,3 +568,22 @@ _source_plugin_config() {
   return
 }
 
+# Proxmox implementation to inject the DNSAPI variables
+_load_plugin_config() {
+    tmp_str="${plugin_conf_string//[^,]}"
+    index="$(_math ${#tmp_str} + 1)"
+    while [ "$index" -gt "0" ]
+    do
+       field=$(_getfield $plugin_conf_string "$index" ",")
+       ADDR=(${field/=/ })
+       key="${ADDR[0]}"
+       value="${ADDR[1]}"
+
+       # decode base64 encoded values
+       value=$(echo $value | /usr/bin/openssl base64 -d -A)
+
+       # acme.sh uses eval insted of export
+       export "$key"="$value"
+       index="$(_math "$index" - 1)"
+    done
+}