]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commitdiff
ovpnmain.cgi: Remove manual start/stop actions
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 9 Apr 2024 16:36:56 +0000 (18:36 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 6 Dec 2024 20:00:51 +0000 (20:00 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/ovpnmain.cgi

index 88a58edb1447d24377f0f0a792f540b9d01f3c73..1e496c62c93d26a71c7b2d62e63004df5bde25c5 100755 (executable)
@@ -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
                                                <input type='submit' name='ACTION' value='$Lang::tr{'save'}' />
                                                <input type='submit' name='ACTION' value='$Lang::tr{'ccd net'}' />
                                                <input type='submit' name='ACTION' value='$Lang::tr{'advanced server'}' />
-                                               <input type='submit' name='ACTION' value='$Lang::tr{'start ovpn server'}' />
                                        </td>
                                </tr>
                        </table>