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>
&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'} = '';