From: Michael Tremer Date: Tue, 9 Apr 2024 16:36:56 +0000 (+0200) Subject: ovpnmain.cgi: Remove manual start/stop actions X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5d5e149adc6af0d3175e11d5b5812d6c07f0ea04;p=people%2Fms%2Fipfire-2.x.git ovpnmain.cgi: Remove manual start/stop actions Signed-off-by: Michael Tremer --- diff --git a/html/cgi-bin/ovpnmain.cgi b/html/cgi-bin/ovpnmain.cgi index 88a58edb1..1e496c62c 100755 --- a/html/cgi-bin/ovpnmain.cgi +++ b/html/cgi-bin/ovpnmain.cgi @@ -927,17 +927,6 @@ sub writecollectdconf { &General::system("/usr/local/bin/collectdctrl", "restart"); } -### -### OpenVPN Server Control -### - -if ($cgiparams{'ACTION'} eq $Lang::tr{'start ovpn server'}) { - &General::system("/usr/local/bin/openvpnctrl", "rw", "start"); - -} elsif ($cgiparams{'ACTION'} eq $Lang::tr{'stop ovpn server'}) { - &General::system("/usr/local/bin/openvpnctrl", "rw", "stop"); -} - ### ### Save Advanced options ### @@ -1387,9 +1376,19 @@ if ($cgiparams{'ACTION'} eq $Lang::tr{'save'} && $cgiparams{'TYPE'} eq '' && $cg $vpnsettings{'VPN_IP'} = $cgiparams{'VPN_IP'}; $vpnsettings{'DOVPN_SUBNET'} = $cgiparams{'DOVPN_SUBNET'}; -#new settings for daemon + # Store our configuration &General::writehash("${General::swroot}/ovpn/settings", \%vpnsettings); - &writeserverconf();#hier ok + + # Write the OpenVPN server configuration + &writeserverconf(); + + # Start/Stop the server + if ($vpnsettings{'ENABLED'} eq "on") { + &General::system("/usr/local/bin/openvpnctrl", "rw", "restart"); + } else { + &General::system("/usr/local/bin/openvpnctrl", "rw", "stop"); + } + SETTINGS_ERROR: ### ### Reset all step 2 @@ -5271,7 +5270,6 @@ END -