[pve-devel] [Patch V2 acme 12/12] Add debug mode
Wolfgang Link
w.link at proxmox.com
Tue Mar 31 12:08:51 CEST 2020
This can be used at setup time to get feedback on the DNS plugin parameters.
Signed-off-by: Wolfgang Link <w.link at proxmox.com>
---
src/proxmox-acme | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/src/proxmox-acme b/src/proxmox-acme
index 1cfb8f6..89eee1c 100644
--- a/src/proxmox-acme
+++ b/src/proxmox-acme
@@ -9,6 +9,8 @@ USER_AGENT="$PROJECT_NAME/$VER"
DNS_PLUGIN_PATH="/usr/share/proxmox-ve/proxmox-acme/dnsapi"
HTTP_HEADER="$(mktemp)"
+DEBUG="0"
+
_base64() {
openssl base64 -e | tr -d '\r\n'
}
@@ -532,27 +534,31 @@ _cleardomainconf() {
}
_debug() {
- return
+ if [[ $DEBUG -eq 0 ]]; then
+ return
+ fi
+ printf -- "%s" "[$(date)] " >&1
+ echo "$1 $2"
}
_debug2() {
- return
+ _debug $1 $2
}
_debug3() {
- return
+ _debug $1 $2
}
_secure_debug() {
- return
+ _debug $1 $2
}
_secure_debug2() {
- return
+ _debug $1 $2
}
_secure_debug3() {
- return
+ _debug $1 $2
}
_saveaccountconf() {
@@ -595,6 +601,7 @@ _load_plugin_config() {
# $2 <String> Fully Qualified Domain Name
# $3 <String> value for TXT record
# $4 <String> DNS plugin auth and config parameter separated by ","
+# $5 <Integer> 0 is off, and the default all others are on.
setup() {
dns_plugin="dns_$1"
@@ -602,6 +609,7 @@ setup() {
fqdn="_acme-challenge.$2"
txtvalue=$3
plugin_conf_sting=$4
+ DEBUG=$5
_load_plugin_config
@@ -628,6 +636,7 @@ teardown() {
fqdn="_acme-challenge.$2"
txtvalue=$3
plugin_conf_sting=$4
+ DEBUG=$5
_load_plugin_config
--
2.20.1
More information about the pve-devel
mailing list