]> 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>
Mon, 2 Jun 2025 19:46:24 +0000 (19:46 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/ovpnmain.cgi

index 16bb3c01cd87c4d84bee34f93ab0436f7d547e5f..7b550437914995bc04fa03cb0c6a05a9b0d173fc 100644 (file)
@@ -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
@@ -5272,7 +5271,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>