Enhance OpenVPN logging and verbosity settings

https://github.com/alexbelgium/hassio-addons/issues/2611
@litinoveweedle
This commit is contained in:
Alexandre
2026-03-28 09:21:05 +01:00
committed by GitHub
parent bf1dc24554
commit 0f23d4f612

View File

@@ -499,15 +499,23 @@ _openvpn_up() {
chmod 755 ${config["PostDownScript"]}
# Define logging
log_path="/dev/null"
[[ "$log_level" == "debug" ]] && log_path="/proc/1/fd/1"
declare -A verbosity=(
["fatal"]=1
["error"]=1
["warning"]=2
["notice"]=3
["info"]=4
["debug"]=5
["trace"]=6
)
# Start OpenVPN in the background
_cmd "/usr/sbin/openvpn \
--config "${config["ConfigFile"]}" \
--client \
--daemon \
--log "$log_path" \
--verb ${verbosity[${$log_level}]} \
--log "/proc/1/fd/1" \
--script-security 2 \
--auth-user-pass "${OPENVPN_STATE_DIR}/credentials.conf" \
--auth-retry none \