From 053e588162a8c559e1c1731cb8bf8d109576ca25 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Wed, 20 Dec 2023 14:20:13 +0100 Subject: [PATCH] openvpn: Added option to not start the native OpenVPN configurations on boot OpenVPN configurations that have a uci entry, the enable/enabled option can be used to control whether the OpenVPN connection should be started at system startup or not. OpenVPN configurations that are located under '/etc/openvpn/' are always started at system boot. To ensure that these connections can also be started later, they must 'not' be started automatically during system boot. This can be prevented with the following entry in the OpenVPN configuration. config globals 'globals' option autostart '0' These OpenVPN configurations can then be started later with the command. '/etc/init.d/openvpn start ' Signed-off-by: Florian Eckert --- net/openvpn/files/openvpn.init | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/openvpn/files/openvpn.init b/net/openvpn/files/openvpn.init index 806afe275..6f4dc4206 100644 --- a/net/openvpn/files/openvpn.init +++ b/net/openvpn/files/openvpn.init @@ -271,7 +271,12 @@ start_service() { else config_foreach start_uci_instance 'openvpn' - start_path_instances + auto="$(uci_get openvpn globals autostart 1)" + if [ "$auto" = "1" ]; then + start_path_instances + else + logger -t openvpn "Autostart for configs in '$PATH_INSTANCE_DIR/*.conf' disabled" + fi fi }