]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commitdiff
ovpnmain.cgi: Only load status when the server is running openvpn-rebase
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 3 Jun 2025 15:04:50 +0000 (17:04 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 3 Jun 2025 15:04:50 +0000 (17:04 +0200)
Otherwise we would show the status if the service is no longer running
and show clients as connected which have only been connected when the
server was stopped.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/ovpnmain.cgi

index 2b3e16b458e7b4040a938937c6b6becc10143e78..b85bc0d63610f8982a4a6d8e9ba8dfe8ea11e081 100644 (file)
@@ -5020,9 +5020,14 @@ END
     &General::readhasharray("${General::swroot}/ovpn/caconfig", \%cahash);
     &General::readhasharray("${General::swroot}/ovpn/ovpnconfig", \%confighash);
 
-    open(FILE, "/usr/local/bin/openvpnctrl rw log |");
-    my @status = <FILE>;
-    close(FILE);
+    my @status = ();
+
+    # Only load status when the RW server is enabled
+    if ($vpnsettings{'ENABLED'} eq 'on') {
+       open(FILE, "/usr/local/bin/openvpnctrl rw log |");
+       @status = <FILE>;
+       close(FILE);
+    }
 
     $checked{'ENABLED'}{'off'} = '';
     $checked{'ENABLED'}{'on'} = '';