X-Git-Url: http://git.ipfire.org/?p=ipfire-2.x.git;a=blobdiff_plain;f=html%2Fcgi-bin%2Fconnections.cgi;h=e9e9e335cfe4356b8509b5a79b1f482562e51e6c;hp=d566cf7ebb29b98bcfdb8bdfe38ea7847eae678a;hb=5709768b0bab2b860911fcad66da8e0aec5c4eaa;hpb=9b37e91ef6dfd93a257bf1ee802b1919e30d0f74 diff --git a/html/cgi-bin/connections.cgi b/html/cgi-bin/connections.cgi index d566cf7ebb..e9e9e335cf 100644 --- a/html/cgi-bin/connections.cgi +++ b/html/cgi-bin/connections.cgi @@ -31,6 +31,7 @@ use Switch; require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; +require "${General::swroot}/geoip-functions.pl"; my $colour_multicast = "#A0A0A0"; @@ -238,21 +239,42 @@ if (-e "${General::swroot}/ovpn/settings") { } } +# Add OpenVPN net for custom OVPNs +if (-e "${General::swroot}/ovpn/ccd.conf") { + open(OVPNSUB, "${General::swroot}/ovpn/ccd.conf"); + my @ovpnsub = ; + close(OVPNSUB); + + foreach (@ovpnsub) { + my ($network, $mask) = split '/', (split ',', $_)[2]; + + $mask = ipv4_cidr2msk($mask) unless &General::validip($mask); + + push(@network, $network); + push(@masklen, $mask); + push(@colour, ${Header::colourovpn}); + } +} + open(IPSEC, "${General::swroot}/vpn/config"); my @ipsec = ; close(IPSEC); foreach my $line (@ipsec) { my @vpn = split(',', $line); - my ($network, $mask) = split("/", $vpn[12]); - if (!&General::validip($mask)) { - $mask = ipv4_cidr2msk($mask); - } + my @subnets = split(/\|/, $vpn[12]); + for my $subnet (@subnets) { + my ($network, $mask) = split("/", $subnet); + + if (!&General::validip($mask)) { + $mask = ipv4_cidr2msk($mask); + } - push(@network, $network); - push(@masklen, $mask); - push(@colour, ${Header::colourvpn}); + push(@network, $network); + push(@masklen, $mask); + push(@colour, ${Header::colourvpn}); + } } if (-e "${General::swroot}/ovpn/n2nconf") { @@ -282,34 +304,34 @@ if (-e "${General::swroot}/ovpn/n2nconf") { # Print legend. print < + - - - - - - - - -
- $Lang::tr{'legend'} : + + $Lang::tr{'legend'} : - $Lang::tr{'lan'} + + $Lang::tr{'lan'} - $Lang::tr{'internet'} + + $Lang::tr{'internet'} - $Lang::tr{'dmz'} + + $Lang::tr{'dmz'} - $Lang::tr{'wireless'} + + $Lang::tr{'wireless'} - IPFire + + IPFire - $Lang::tr{'vpn'} + + $Lang::tr{'vpn'} - $Lang::tr{'OpenVPN'} + + $Lang::tr{'OpenVPN'} - Multicast + + Multicast
@@ -345,60 +367,68 @@ END # Print table header. print < - - - - + + + - - + - + - - - - + - - + - + - - @@ -503,7 +533,8 @@ foreach my $line (@conntrack) { } my $sip_colour = ipcolour($sip); - my $dip_colour = ipcolour($dip); + # use colour of destination network for DNAT + my $dip_colour = $dip ne $dip_ret ? ipcolour($dip_ret) : ipcolour($dip); my $sserv = ''; if ($sport < 1024) { @@ -518,22 +549,28 @@ foreach my $line (@conntrack) { my $bytes_in = format_bytes($bytes[0]); my $bytes_out = format_bytes($bytes[1]); + # enumerate GeoIP information + my $srcccode = &GeoIP::lookup($sip_ret); + my $src_flag_icon = &GeoIP::get_flag_icon($srcccode); + my $dstccode = &GeoIP::lookup($dip_ret); + my $dst_flag_icon = &GeoIP::get_flag_icon($dstccode); + # Format TTL $ttl = format_time($ttl); my $sip_extra; - if ($sip ne $sip_ret) { - $sip_extra = "> "; + if ($sip_ret && $sip ne $sip_ret) { + $sip_extra = "> "; $sip_extra .= ""; - $sip_extra .= " $sip_ret"; + $sip_extra .= " $sip_ret"; $sip_extra .= ""; } my $dip_extra; - if ($dip ne $dip_ret) { - $dip_extra = "> "; + if ($dip_ret && $dip ne $dip_ret) { + $dip_extra = "> "; $dip_extra .= ""; - $dip_extra .= " $dip_ret"; + $dip_extra .= " $dip_ret"; $dip_extra .= ""; } @@ -545,9 +582,9 @@ foreach my $line (@conntrack) { $sserv_ret = uc(getservbyport($sport_ret, lc($l4proto))); } - $sport_extra = "> "; + $sport_extra = "> "; $sport_extra .= ""; - $sport_extra .= " $sport_ret"; + $sport_extra .= " $sport_ret"; $sport_extra .= ""; } @@ -558,44 +595,50 @@ foreach my $line (@conntrack) { $dserv_ret = uc(getservbyport($dport_ret, lc($l4proto))); } - $dport_extra = "> "; + $dport_extra = "> "; $dport_extra .= ""; - $dport_extra .= " $dport_ret"; + $dport_extra .= " $dport_ret"; $dport_extra .= ""; } print < - - + - - + - - + - - + + END } @@ -643,15 +686,17 @@ sub ipcolour($) { my ($ip) = $_[0]; my $found = 0; - foreach my $line (@network) { - if ($network[$id] eq '') { - $id++; - } else { - if (!$found && ipv4_in_network($network[$id], $masklen[$id], $ip) ) { - $found = 1; - $colour = $colour[$id]; + if ($ip) { + foreach my $line (@network) { + if ($network[$id] eq '') { + $id++; + } else { + if (!$found && ipv4_in_network($network[$id], $masklen[$id], $ip) ) { + $found = 1; + $colour = $colour[$id]; + } + $id++; } - $id++; } }
+ + - - + + +          - - + + - - +   + +        - - + + - - +   + +      - - + + - - + + + - - + + +
+
$Lang::tr{'protocol'} + $Lang::tr{'source ip and port'} + + $Lang::tr{'country'} + $Lang::tr{'dest ip and port'} + + $Lang::tr{'country'} + $Lang::tr{'download'} /
$Lang::tr{'upload'}
+ $Lang::tr{'connection'}
$Lang::tr{'status'}
+ $Lang::tr{'expires'}
($Lang::tr{'seconds'})
$l4proto + $l4proto - $sip + $sip $sip_extra + - $sport + $sport $sport_extra + + $srcccode + - $dip + $dip $dip_extra + - $dport + $dport $dport_extra + + $dstccode + $bytes_in / $bytes_out $state$ttl$state$ttl