From patchwork Sun Jun 28 10:41:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Feddersen X-Patchwork-Id: 3225 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 49vnHp3RzRz3x5V for ; Sun, 28 Jun 2020 10:42:14 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 49vnHj3j8xz2D7; Sun, 28 Jun 2020 10:42:09 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 49vnHh69Xhz2ycZ; Sun, 28 Jun 2020 10:42:08 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 49vnHg1Slnz2y3N for ; Sun, 28 Jun 2020 10:42:07 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 49vnHf68syz1KR; Sun, 28 Jun 2020 10:42:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1593340927; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=N+KWmQFa8M9N3g1JSX0YH4pa9W/QgQCmvdVkKDauM94=; b=Ea5Hm8JjAVd6C6EfjQCIxBq/gIYKF9ySHjoRjC7SEAcfvyEOlvwqS/AaQLSiXNHPI1SFDe hJ4DiiQhPZ8fZU0SvtOAPbsb81yIbq8tHCNORyUy1/m1pemXP6e9pQZ3rQrvTUJxmucxpu sxU7er2+3b33Ip5exfWpqQgEcATtXKciTG6Gr3tpZAhqa3J68NFd4RJ+F2AqU9wKVgo5wd Vr6eNFNrFDRv09zjlvQGPKai8SPqb4K6jgmoqpit/wlhNIoUmd8QGHwVbxwolEsdLmNFGk wAlThJFHIzWIly+iLS1QTTWrI6uvbBgxZCR6K6CydqiHRLIKapckUGIQLsLtnQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1593340927; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=N+KWmQFa8M9N3g1JSX0YH4pa9W/QgQCmvdVkKDauM94=; b=HtRqk1/19MkuO6zI4JLr7uZaJNp9gdTJT+97OhA8tO6QG5Rp5ppWWcpR0UgutTZSmdFDQx G7wo5pxmoGBF92Cw== From: Stephan Feddersen To: development@lists.ipfire.org Subject: [PATCH] WIO - shutdown function removed, adjustments to IPsec status display Date: Sun, 28 Jun 2020 12:41:55 +0200 Message-Id: <20200628104155.28529-1-sfeddersen@ipfire.org> Authentication-Results: mail01.ipfire.org; auth=pass smtp.mailfrom=sfeddersen@ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stephan Feddersen Errors-To: development-bounces@lists.ipfire.org Sender: "Development" --- src/wio/wio.cgi | 316 ++++++++++++++++++++++++------------------------ 1 file changed, 160 insertions(+), 156 deletions(-) diff --git a/src/wio/wio.cgi b/src/wio/wio.cgi index 3094ec30c..a92a44473 100644 --- a/src/wio/wio.cgi +++ b/src/wio/wio.cgi @@ -21,14 +21,14 @@ # # ############################################################################### # -# Version: 2020/26/04 19:35:23 +# Version: 2020/06/01 13:29:23 # -# This wio.cgi is based on the Code from the IPCop WIO Addon +# This wio.cgi is based on the code from the IPCop WIO Addon # and is extremly adapted to work with IPFire. # # Autor: Stephan Feddersen # Co-Autor: Alexander Marx -# Co-Autor: Frank Mainz (for some Code for the IPCop WIO Addon) +# Co-Autor: Frank Mainz (for some code for the IPCop WIO Addon) # use strict; @@ -55,7 +55,7 @@ require '/usr/lib/wio/wio-graphs.pl'; my $logdir = "/var/log/wio"; -my ( %mainsettings, %mailsettings, %wiosettings, %cgiparams, %netsettings, %ipshash, +my ( %mainsettings, %mailsettings, %wiosettings, %cgiparams, %netsettings, %ipshash, %vpnsettings, %vpnconfighash, %ovpnconfighash, %ovpnccdconfhash, %ovpnsettings, %checked, %selected, %color ) = (); &General::readhash('/var/ipfire/main/settings', \%mainsettings); @@ -67,6 +67,7 @@ my ( %mainsettings, %mailsettings, %wiosettings, %cgiparams, %netsettings, %ipsh &General::readhash('/var/ipfire/ovpn/settings', \%ovpnsettings); &General::readhasharray('/var/ipfire/ovpn/ccd.conf', \%ovpnccdconfhash); &General::readhasharray('/var/ipfire/vpn/config', \%vpnconfighash); +&General::readhash('/var/ipfire/vpn/settings', \%vpnsettings); my $ipadrfile = "$logdir/wioips"; my $onoffip = "$logdir/wioscip"; @@ -112,7 +113,7 @@ my $networksearchbuttontext = "$Lang::tr{'wio_show_table_on'}"; my ( $message, $infomessage, $errormessage, $importmessage ) = ''; my ( $buttontext, $host, $timestamp, $ipadr, $on, $remark, $dyndns, $dyndnsip, $sendemailon, $net, $dev, $iprange, $output, $write, $webinterface, - $sendemailoff, $pingmethode, $online, $color, $bgcolor, $exitcode, $id, $line, $interface, $counter, $vpnn2nip, $vpnn2nmask, $ddns, $edc, + $sendemailoff, $pingmethode, $online, $color, $bgcolor, $exitcode, $id, $line, $interface, $counter, $vpnn2nip, $vpnn2nmask, $edc, $edd, $wmon, $wmoff, $ipfqdn, $http, $wioscan, $statustxt, $status, $key, $ic, $text, $image ) = (); my ( @temp, @dates, @ipaddresses, @names, @remark, @sendemailon, @sendemailoff, @current, @ddns, @match, @webinterface, @arpcache, @arpadd, @line, @@ -127,6 +128,10 @@ my @devs_alt = ('green','blue','orange','red'); my %ifacecolor = ( GREEN => 'wio_run_green', BLUE => 'wio_run_blue', ORANGE => 'wio_run_orange'); +#if ( $netsettings{'RED_TYPE'} eq 'STATIC' || $netsettings{'RED_TYPE'} eq 'DHCP' ) { +# %ifacecolor = ( %ifacecolor, RED => 'wio_run_red' ); +#} + &loadips(); ## some wio settings @@ -156,7 +161,6 @@ $wiosettings{'LOGGING'} = 'off'; $wiosettings{'MAILREMARK'} = 'off'; $wiosettings{'MAILSTYLE'} = 'email'; $wiosettings{'OVPNRWMAIL'} = 'off'; -$wiosettings{'SHUTDOWN'} = 'off'; $wiosettings{'WIOGUISHOWARPTABLE'} = ''; $wiosettings{'WIOGUISHOWCLIENTIMPORTTABLE'} = ''; $wiosettings{'WIOGUISHOWNETWORKSEARCHTABLE'} = ''; @@ -194,7 +198,6 @@ if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_save'}.'1' ) { $cgiparams{'MAILREMARK'} = $wiosettings{'MAILREMARK'}; $cgiparams{'MAILSTYLE'} = $wiosettings{'MAILSTYLE'}; $cgiparams{'OVPNRWMAIL'} = $wiosettings{'OVPNRWMAIL'}; - $cgiparams{'SHUTDOWN'} = $wiosettings{'SHUTDOWN'}; &General::writehash($wiosettings, \%cgiparams); &General::readhash($wiosettings, \%wiosettings); @@ -535,6 +538,7 @@ if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_back'} ) { if ( $wiosettings{'ACTION'} eq 'wio_run_green' || $wiosettings{'ACTION'} eq 'wio_run_blue' || + $wiosettings{'ACTION'} eq 'wio_run_red' || $wiosettings{'ACTION'} eq 'wio_run_orange') { $wioscan = 'on'; } if ( $wiosettings{'ACTION'} eq $Lang::tr{'wio_import'}.'1' || @@ -599,13 +603,14 @@ elsif ( $wioscan eq 'on' ) { if ( $_ eq 'GREEN' ) { $color = "$Header::colourgreen"; $net = $Lang::tr{'wio_msg_green'}; } elsif ( $_ eq 'BLUE' ) { $color = "$Header::colourblue"; $net = $Lang::tr{'wio_msg_blue'}; } + elsif ( $_ eq 'RED' ) { $color = "$Header::colourred"; $net = $Lang::tr{'wio_msg_red'}; } else { $color = "$Header::colourorange"; $net = $Lang::tr{'wio_msg_orange'}; } } } &Header::openbox('100%', 'left', $Lang::tr{'wio_info'}); print" - +
$Lang::tr{'wio_msg_left'} $net $Lang::tr{'wio_msg_center'} $dev $Lang::tr{'wio_msg_right'} $Lang::tr{'wio_msg_hint'}
$Lang::tr{'wio_msg_left'} $net $Lang::tr{'wio_msg_center'} $Lang::tr{'wio_msg_right'} $Lang::tr{'wio_msg_hint'}
 
"; @@ -884,9 +889,6 @@ $checked{'MAILREMARK'}{$wiosettings{'MAILREMARK'}} = "checked='checked'"; $checked{'OVPNRWMAIL'}{'off'} = $checked{'OVPNRWMAIL'}{'on'} = ''; $checked{'OVPNRWMAIL'}{$wiosettings{'OVPNRWMAIL'}} = "checked='checked'"; -$checked{'SHUTDOWN'}{'off'} = $checked{'SHUTDOWN'}{'on'} = ''; -$checked{'SHUTDOWN'}{$wiosettings{'SHUTDOWN'}} = "checked='checked'"; - $checked{'MAILSTYLE'}{'smail'} = $checked{'MAILSTYLE'}{'email'} = ''; $checked{'MAILSTYLE'}{$wiosettings{'MAILSTYLE'}} = "checked='checked'"; @@ -942,15 +944,14 @@ print"
- - - + + - - + + + - "; @@ -966,12 +967,6 @@ else { print" - - - - - - @@ -1133,16 +1128,16 @@ print" - + - + - + @@ -1155,22 +1150,25 @@ open(FILE, "< $dyndnsconfig"); @ddns = ; close (FILE); -$ddns = @ddns; -$bgcolor = "blue"; - foreach (@ddns) { chomp; - + @temp = split (/\,/, $_); - if ( $temp[7] eq "on" ) { $bgcolor = ( &General::DyndnsServiceSync (&General::GetDyndnsRedIP,$temp[1],$temp[2]) ? "$Header::colourgreen" : "$Header::colourred" ); } - + if ( $temp[7] eq "on" ) { + $bgcolor = ( &General::DyndnsServiceSync (&General::GetDyndnsRedIP,$temp[1],$temp[2]) ? "$Header::colourgreen" : "$Header::colourred" ); + } + else { + $bgcolor = "blue"; + } + print"$temp[1].$temp[2]"; - - if ( $iddyndns++ ne ($ddns-1) ) { print", "; } + if ( $iddyndns++ ne (@ddns-1) ) { print"
\n"; } } } -else { print" - "; } +else { + print"-"; +} print" @@ -1217,19 +1215,23 @@ print" foreach $key (sort SortByTunnelName (keys(%vpnconfighash))) { -my ( $vpncheck, $vpntime, $vpnclient ) = ''; - -if ( -e '/var/log/wio/.vpncache' ) { - $vpncheck = strftime("%d.%m.%Y - %H:%M:%S",localtime(((stat('/var/log/wio/.vpncache'))[9]))); -} +my ( $vpnclient, $vpnclientip, $vpnrwnet, $vpnn2nnet, $vpntime, $vpncheck ) = ''; $status = "bgcolor='${Header::colourred}'"; $statustxt = "$Lang::tr{'capsclosed'}"; $vpnclient = $vpnconfighash{$key}[1]; +my ($ip,$sub) = split(/\//,$vpnsettings{'RW_NET'}); +my @ip = split( /\./, $ip); +$vpnrwnet = join( '.', ( $ip[0], $ip[1], $ip[2], ) ); + if ($vpnconfighash{$key}[0] eq 'off') { $status = "bgcolor='${Header::colourblue}'"; $statustxt = "$Lang::tr{'capsclosed'}"; + $vpnn2nnet = '-'; + } + else { + $vpnn2nnet = $vpnconfighash{$key}[11]; } foreach (@vpnstatus) { @@ -1238,6 +1240,8 @@ $vpnclient = $vpnconfighash{$key}[1]; $statustxt = "$Lang::tr{'capsopen'}"; $vpntime = `/usr/local/bin/ipsecctrl I | grep $vpnclient.*ESTABLISHED | sed 's/^[ \t]*//' | cut -d " " -f 3-4`; $vpntime = &WIO::contime($vpntime, "ipsec"); + $vpnclientip = `/usr/local/bin/ipsecctrl I | grep $vpnclient.*$vpnrwnet | sed 's/^[ \t]*//' | cut -d " " -f 6 | cut -d "/" -f 1`; + $vpncheck = strftime("%d.%m.%Y - %H:%M:%S",localtime); last; } } @@ -1248,10 +1252,10 @@ $vpnclient = $vpnconfighash{$key}[1]; printf ("
", $vpnnr); - print" + print" - + - + "; -if ($vpnconfighash{$key}[25] && $wiosettings{'CLIENTREMARK'} eq 'on') { - print""; +if ($wiosettings{'CLIENTREMARK'} eq 'on') { + print""; } - print""; - $idvpn++ + +print""; +$idvpn++ } print"
 $Lang::tr{'wio_settings_msg'}  $Lang::tr{'wio_settings_msg_hint'} 
 
$Lang::tr{'wio_settings_msg_hint'}   
 
$Lang::tr{'wio enabled'}
 
$Lang::tr{'wio_shutdown'} 
 
$Lang::tr{'wio cron'}  
$Lang::tr{'wio_id'} $Lang::tr{'wio ipadress'}$Lang::tr{'wio network'}$Lang::tr{'wio network'} $Lang::tr{'wio_lanname'} $Lang::tr{'wio_wanname'}$Lang::tr{'wio_dyndns_hosts'}$Lang::tr{'wio_dyndns_hosts'} $Lang::tr{'wio image'} $Lang::tr{'wio_connected'}
01$redip$redip $Lang::tr{ ".$mainsettings{'HOSTNAME'}.".".$mainsettings{'DOMAINNAME'}." ".( $redip ne '-' ? (gethostbyaddr(pack("C4", split (/\./, $redip)), 2))[0] : '-' )."%02d$vpncheck".($vpncheck ne '' ? "$vpncheck" : "-")." $vpnclient $Lang::tr{".($vpnconfighash{$key}[2] eq '%auth-dn' ? "$vpnconfighash{$key}[9]" : ($vpnconfighash{$key}[4] eq 'cert' ? "$vpnconfighash{$key}[2]" : ($vpnconfighash{$key}[8] ne '' ? "$vpnconfighash{$key}[10]" : " ")))."".($vpnconfighash{$key}[3] eq 'host' ? (defined($vpnclientip) ? "$vpnclientip" : "-") : $vpnconfighash{$key}[3] eq 'net' ? "$vpnn2nnet" : "-")." @@ -1259,15 +1263,16 @@ $vpnclient = $vpnconfighash{$key}[1];
".(defined($vpntime)? "$vpntime" : "-")."".($vpntime ne '' ? "$vpntime" : "-")."
 $vpnconfighash{$key}[25]
 ".($vpnconfighash{$key}[25] ne '' ? "$vpnconfighash{$key}[25]" : "-")."
"; @@ -1292,117 +1297,117 @@ print" $Lang::tr{'wio_id'} $Lang::tr{'wio checked'} - $Lang::tr{'wio ipadress'} + $Lang::tr{'name'} $Lang::tr{'type'} - $Lang::tr{'common name'} + $Lang::tr{'wio_common_name'} $Lang::tr{'wio image'} $Lang::tr{'wio_connected'} "; - foreach $key (keys %ovpnconfighash) { +foreach $key (keys %ovpnconfighash) { - my ( $ovpnclt, $ovpntime, $ovpnrwip, $ovpncheck ) = ''; + my ( $ovpncheck, $ovpntime, $ovpnclt, $ovpnrwip ) = ''; - if ( -e '/var/log/wio/.ovpncache' ) { - $ovpncheck = strftime("%d.%m.%Y - %H:%M:%S",localtime(((stat('/var/log/wio/.ovpncache'))[9]))); - } + print""; - print""; + my $ovpnnr = $idovpn+1; - my $ovpnnr = $idovpn+1; + printf (" %02d", $ovpnnr); - printf (" %02d", $ovpnnr); + if ($ovpnconfighash{$key}[3] eq 'net') { + $image = "$imgstatic/ovpnn2n.png"; + $text = "$Lang::tr{'wio_n2n'}"; + } + else { + $image = "$imgstatic/ovpnrw.png"; + $text = "$Lang::tr{'wio_rw'}"; + } + if ( $ovpnconfighash{$key}[0] eq 'off' ) { + $status = "${Header::colourblue}"; + $statustxt = "$Lang::tr{'capsclosed'}"; + $ovpncheck = "-"; + } + else { if ($ovpnconfighash{$key}[3] eq 'net') { - $image = "$imgstatic/ovpnn2n.png"; - $text = "$Lang::tr{'wio_n2n'}"; - } - else { - $image = "$imgstatic/ovpnrw.png"; - $text = "$Lang::tr{'wio_rw'}"; - } - - if ( $ovpnconfighash{$key}[0] eq 'off' ) { - $status = "${Header::colourblue}"; - $statustxt = "$Lang::tr{'capsclosed'}"; - } - else { - if ($ovpnconfighash{$key}[3] eq 'net') { - if (-e "/var/run/$ovpnconfighash{$key}[1]n2n.pid") { - my @output = ""; - my @tustate = ""; - my $tport = $ovpnconfighash{$key}[22]; - my $tnet = new Net::Telnet ( Timeout=>5, Errmode=>'return', Port=>$tport); - if ($tport ne '') { - $tnet->open('127.0.0.1'); - @output = $tnet->cmd(String => 'state', Prompt => '/(END.*\n|ERROR:.*\n)/'); - @tustate = split(/\,/, $output[1]); - $ovpntime = &WIO::contime(scalar localtime($tustate[0]), "ovpn"); - - if (($tustate[1] eq 'CONNECTED')) { - $status = "${Header::colourgreen}"; - $statustxt = "$Lang::tr{'capsopen'}"; - }else { - $status = "${Header::colourred}"; - $statustxt = "$tustate[1]"; - } + if (-e "/var/run/$ovpnconfighash{$key}[1]n2n.pid") { + my ( @output, @tustate ) = ''; + my $tport = $ovpnconfighash{$key}[22]; + my $tnet = new Net::Telnet ( Timeout=>5, Errmode=>'return', Port=>$tport); + if ($tport ne '') { + $tnet->open('127.0.0.1'); + @output = $tnet->cmd(String => 'state', Prompt => '/(END.*\n|ERROR:.*\n)/'); + @tustate = split(/\,/, $output[1]); + $ovpntime = &WIO::contime(scalar localtime($tustate[0]), "ovpn"); + $ovpncheck = strftime("%d.%m.%Y - %H:%M:%S", localtime); + + if (($tustate[1] eq 'CONNECTED')) { + $status = "${Header::colourgreen}"; + $statustxt = "$Lang::tr{'capsopen'}"; + $ovpnrwip = $ovpnconfighash{$key}[11]; + } + else { + $status = "${Header::colourred}"; + $statustxt = "$tustate[1]"; } } } - else { - foreach (@ovpnstatus) { - if ( $_ =~ /^(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(\d+),(\d+),(.+)/ ) { - @match = split (m/^(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(\d+),(\d+),(.+)/, $_); - $match[1] =~ s/[_]/ /g; - } + } + else { + foreach (@ovpnstatus) { + if ( $_ =~ /^(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(\d+),(\d+),(.+)/ ) { + @match = split (m/^(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(\d+),(\d+),(.+)/, $_); + $match[1] =~ s/[_]/ /g; + } - if ( $match[1] ne "Common Name" && ($match[1] eq $ovpnconfighash{$key}[2]) ) { - $ovpnclt = $match[1]; - $ovpntime = &WIO::contime($match[5], "ovpn"); - } + if ( $match[1] ne "Common Name" && ($match[1] eq $ovpnconfighash{$key}[2]) ) { + $ovpnclt = $match[1]; + $ovpntime = &WIO::contime($match[5], "ovpn"); + } - if ( $_ =~ /^(\d+\.\d+\.\d+\.\d+),(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(.+)/ ) { - @match = split(m/^(\d+\.\d+\.\d+\.\d+),(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(.+)/, $_); - } + if ( $_ =~ /^(\d+\.\d+\.\d+\.\d+),(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(.+)/ ) { + @match = split(m/^(\d+\.\d+\.\d+\.\d+),(.+),(\d+\.\d+\.\d+\.\d+\:\d+),(.+)/, $_); + } - if ( $match[1] ne "Virtual Address" && $match[2] eq $ovpnclt ) { - $ovpnrwip = $match[1]; - $ovpncheck = &WIO::statustime($match[4]); - } + if ( $match[1] ne "Virtual Address" && $match[2] eq $ovpnclt ) { + $ovpnrwip = $match[1]; + $ovpncheck = &WIO::statustime($match[4]); + } - if ( $ovpnclt eq $ovpnconfighash{$key}[2] ) { - $status = "${Header::colourgreen}"; - $statustxt = "$Lang::tr{'capsopen'}"; - } - else { - $status = "${Header::colourred}"; - $statustxt = "$Lang::tr{'capsclosed'}"; - } + if ( $ovpnclt eq $ovpnconfighash{$key}[2] ) { + $status = "${Header::colourgreen}"; + $statustxt = "$Lang::tr{'capsopen'}"; + } + else { + $status = "${Header::colourred}"; + $statustxt = "$Lang::tr{'capsclosed'}"; } } -} + } + } - print" - ".(defined($ovpncheck)? "$ovpncheck" : "-")." - ".(defined($ovpnrwip)? "$ovpnrwip" : "-")." +print" + ".(defined($ovpncheck) ? "$ovpncheck" : "-")." + ".($ovpnconfighash{$key}[2] eq '%auth-dn' ? "$ovpnconfighash{$key}[9]" : ($ovpnconfighash{$key}[4] eq 'cert' ? "$ovpnconfighash{$key}[1]": "-"))." $text - ".($ovpnconfighash{$key}[2] eq '%auth-dn' ? "$ovpnconfighash{$key}[9]" : ($ovpnconfighash{$key}[4] eq 'cert' ? "$ovpnconfighash{$key}[2]": " "))." + ".($ovpnrwip ne '' ? "$ovpnrwip" : "-")."
$statustxt
- ".(defined($ovpntime)? "$ovpntime" : "-")." + ".(defined($ovpntime) ? "$ovpntime" : "-")." "; - if ($ovpnconfighash{$key}[25] && $wiosettings{'CLIENTREMARK'} eq 'on') { - print" $ovpnconfighash{$key}[25]"; - } - print""; - $idovpn++ - } - print""; - &hrline(); +if ($wiosettings{'CLIENTREMARK'} eq 'on') { + print" ".($ovpnconfighash{$key}[25] ne '' ? "$ovpnconfighash{$key}[25]" : "-").""; +} + +print""; +$idovpn++ +} + +print""; +&hrline(); } -#} ## client status @@ -1424,9 +1429,9 @@ print" $Lang::tr{'wio_webinterface'} $Lang::tr{'wio ipadress'} $Lang::tr{'wio network'} - $Lang::tr{'wio name'} - $Lang::tr{'wio image'} - + $Lang::tr{'wio name'} + $Lang::tr{'wio image'} +
$Lang::tr{'wio_dyndns'} $Lang::tr{'action'}
@@ -1525,8 +1530,14 @@ my $dotip = length($ipaddresses[$a]) - rindex($ipaddresses[$a],'.'); next if ( $netsettings{"$ic"."_DEV"} eq 'red0' && $netsettings{"RED_TYPE"} eq 'PPPOE'); if ( $netsettings{"$ic"."_DEV"} eq $interface ) { if ( &General::IpInSubnet($ipaddresses[$a], $netsettings{"$ic"."_NETADDRESS"}, $netsettings{"$ic"."_NETMASK"}) ) { - print"$Lang::tr{$devs_alt[$in]}"; - last SWITCH; + if ( $netsettings{"$ic"."_DEV"} eq 'red0' ) { + print"$Lang::tr{"; + } + else { + print"$Lang::tr{$devs_alt[$in]}"; + + } + last SWITCH; } } $in++; @@ -1545,7 +1556,7 @@ my $dotip = length($ipaddresses[$a]) - rindex($ipaddresses[$a],'.'); $vpnn2nmask = length($net[1]) - rindex($net[1],'.'); if (substr($ipaddresses[$a],0,length($ipaddresses[$a])-$dotip) eq substr($vpnn2nip,0,length($vpnn2nip)-$vpnn2nmask)) { - print"IPSec"; + print"IPsec"; last SWITCH; } } @@ -1584,7 +1595,7 @@ my $dotip = length($ipaddresses[$a]) - rindex($ipaddresses[$a],'.'); my $red_netaddress = Network::get_netaddress("$rednet[0]/$red_netmask"); if ( &General::IpInSubnet($ipaddresses[$a], $red_netaddress, $red_netmask) ) { - print"$Lang::tr{"; + print"$Lang::tr{"; last SWITCH; } } @@ -1671,8 +1682,8 @@ print" "; -if ($remark[$a] && $wiosettings{'CLIENTREMARK'} eq 'on') { - print" $remark[$a]"; +if ($wiosettings{'CLIENTREMARK'} eq 'on') { + print" ".($remark[$a] ne '' ? "$remark[$a]" : "-").""; } print""; } @@ -1898,7 +1909,7 @@ SWITCH: { my $red_netaddress = Network::get_netaddress("$rednet[0]/$red_netmask"); if ( &General::IpInSubnet($line[1], $red_netaddress, $red_netmask) ) { - print"$Lang::tr{"; + print"$Lang::tr{"; last SWITCH; } else { @@ -1949,32 +1960,32 @@ print"  
- $Lang::tr{'wio_import_csv'}  + $Lang::tr{'wio_import_csv'}  - +
 
- $Lang::tr{'wio_import_hosts'}  + $Lang::tr{'wio_import_hosts'}    - +
 
- $Lang::tr{'wio_import_fixleases'}  + $Lang::tr{'wio_import_fixleases'}    - +
"; } -&hrline; +&hrline(); print" @@ -1997,6 +2008,7 @@ print" foreach (keys(%ifacecolor)) { if ( $_ eq 'GREEN' ) { $color = "$Header::colourgreen"; $net = $Lang::tr{'wio_net_scan_green'}; } elsif ( $_ eq 'BLUE' ) { $color = "$Header::colourblue"; $net = $Lang::tr{'wio_net_scan_blue'}; } + elsif ( $_ eq 'RED' ) { $color = "$Header::colourred"; $net = $Lang::tr{'wio_net_scan_red'}; } else { $color = "$Header::colourorange"; $net = $Lang::tr{'wio_net_scan_orange'}; } if ( $netsettings{"${_}_DEV"} eq 'disabled' || $netsettings{"${_}_DEV"} eq '' || $netsettings{"${_}_ADDRESS"} eq '' ) { next; } @@ -2004,9 +2016,9 @@ foreach (keys(%ifacecolor)) { print < - + - + @@ -2149,14 +2161,6 @@ print"
$Lang::tr{'wio_net_scan_vl'} $net $Lang::tr{'wio_net_scan_l'} $netsettings{"${_}_DEV"} $Lang::tr{'wio_net_scan_r'}
$Lang::tr{'wio_net_scan_l'} $net $Lang::tr{'wio_net_scan_r'} -
 

############################################################################################################################ -sub back { - -print"
$Lang::tr{ 
"; - -} - -############################################################################################################################ - sub loadips { &General::readhasharray($ipadrfile, \%ipshash);