mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-07-16 02:50:32 +02:00
fix openvpn options
This commit is contained in:
@@ -349,13 +349,15 @@ _openvpn_up() {
|
|||||||
# Start OpenVPN in the background
|
# Start OpenVPN in the background
|
||||||
_cmd "/usr/sbin/openvpn \
|
_cmd "/usr/sbin/openvpn \
|
||||||
--config "${config["ConfigFile"]}" \
|
--config "${config["ConfigFile"]}" \
|
||||||
--script-security 2 --daemon --log /dev/null \
|
--client \
|
||||||
|
--daemon \
|
||||||
|
--log /dev/null \
|
||||||
|
--script-security 2 \
|
||||||
--auth-user-pass "${OPENVPN_STATE_DIR}/credentials.conf" \
|
--auth-user-pass "${OPENVPN_STATE_DIR}/credentials.conf" \
|
||||||
--auth-retry none \
|
--auth-retry none \
|
||||||
--up ${config["PostUpScript"]} \
|
--up ${config["PostUpScript"]} \
|
||||||
--up_delay 5 \
|
|
||||||
--down ${config["PostDownScript"]} \
|
--down ${config["PostDownScript"]} \
|
||||||
--down-delay 5 \
|
--up-delay \
|
||||||
--up-restart \
|
--up-restart \
|
||||||
--route-nopull \
|
--route-nopull \
|
||||||
--route-noexec" || return 1
|
--route-noexec" || return 1
|
||||||
@@ -401,6 +403,7 @@ openvpn() {
|
|||||||
# register up and down scripts
|
# register up and down scripts
|
||||||
bashio::log.info "Starting OpenVPN on interface ${config["Interface"]}..."
|
bashio::log.info "Starting OpenVPN on interface ${config["Interface"]}..."
|
||||||
if _openvpn_up; then
|
if _openvpn_up; then
|
||||||
|
bashio::log.info "OpenVPN interface ${config["Interface"]} is up."
|
||||||
bashio::exit.ok 'OpenVPN started.'
|
bashio::exit.ok 'OpenVPN started.'
|
||||||
fi
|
fi
|
||||||
bashio::log.error 'OpenVPN failed to establish connection.'
|
bashio::log.error 'OpenVPN failed to establish connection.'
|
||||||
@@ -408,16 +411,20 @@ openvpn() {
|
|||||||
elif [ "${mode}" = "down" ]; then
|
elif [ "${mode}" = "down" ]; then
|
||||||
bashio::log.info "Stopping OpenVPN on interface ${config["Interface"]}..."
|
bashio::log.info "Stopping OpenVPN on interface ${config["Interface"]}..."
|
||||||
_openvpn_down
|
_openvpn_down
|
||||||
|
bashio::log.info "OpenVPN on interface ${config["Interface"]} is down."
|
||||||
bashio::exit.ok 'OpenVPN stopped.'
|
bashio::exit.ok 'OpenVPN stopped.'
|
||||||
elif [ "${mode}" = "postup" ]; then
|
elif [ "${mode}" = "postup" ]; then
|
||||||
_routing_add
|
_routing_add
|
||||||
|
bashio::exit.ok 'OpenVPN routes added.'
|
||||||
elif [ "${mode}" = "postdown" ]; then
|
elif [ "${mode}" = "postdown" ]; then
|
||||||
_routing_del
|
_routing_del
|
||||||
|
bashio::exit.ok 'OpenVPN routes deleted.'
|
||||||
else
|
else
|
||||||
bashio::log.error "Invalid OpenVPN mode specified. Use 'up', 'down', 'postup', or 'postdown'."
|
bashio::log.error "Invalid OpenVPN mode specified. Use 'up', 'down', 'postup', or 'postdown'."
|
||||||
bashio::exit.nok 'OpenVPN start failed.'
|
bashio::exit.nok 'OpenVPN start failed.'
|
||||||
fi
|
fi
|
||||||
bashio::log.info "Starting OpenVPN with configuration file: ${config_file}"
|
|
||||||
|
bashio::exit.nok 'OpenVPN start failed.'
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- Entry Point ---
|
# --- Entry Point ---
|
||||||
|
|||||||
Reference in New Issue
Block a user