require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
+my $colour_multicast = "#A0A0A0";
+
&Header::showhttpheaders();
my @network=();
}
}
+# Add Orange Firewall Interface
+push(@network, $netsettings{'ORANGE_ADDRESS'});
+push(@masklen, "255.255.255.255" );
+push(@colour, ${Header::colourfw} );
+
# Add Orange Network
if ($netsettings{'ORANGE_DEV'}) {
push(@network, $netsettings{'ORANGE_NETADDRESS'});
}
}
+# Highlight multicast connections.
+push(@network, "224.0.0.0");
+push(@masklen, "239.0.0.0");
+push(@colour, $colour_multicast);
+
# Add OpenVPN net and RED/BLUE/ORANGE entry (when appropriate)
if (-e "${General::swroot}/ovpn/settings") {
my %ovpnsettings = ();
}
}
-open(IPSEC, "/var/ipfire/vpn/config");
+open(IPSEC, "${General::swroot}/vpn/config");
my @ipsec = <IPSEC>;
close(IPSEC);
push(@colour, ${Header::colourvpn});
}
+if (-e "${General::swroot}/ovpn/n2nconf") {
+ open(OVPNN2N, "${General::swroot}/ovpn/ovpnconfig");
+ my @ovpnn2n = <OVPNN2N>;
+ close(OVPNN2N);
+
+ foreach my $line (@ovpnn2n) {
+ my @ovpn = split(',', $line);
+ next if ($ovpn[4] ne 'net');
+
+ my ($network, $mask) = split("/", $ovpn[12]);
+ if (!&General::validip($mask)) {
+ $mask = ipv4_cidr2msk($mask);
+ }
+
+ push(@network, $network);
+ push(@masklen, $mask);
+ push(@colour, ${Header::colourovpn});
+ }
+}
+
# Show the page.
&Header::openpage($Lang::tr{'connections'}, 1, '');
&Header::openbigbox('100%', 'left');
<td align='center' bgcolor='${Header::colourovpn}'>
<b><font color='#FFFFFF'>$Lang::tr{'OpenVPN'}</font></b>
</td>
+ <td align='center' bgcolor='$colour_multicast'>
+ <b><font color='#FFFFFF'>Multicast</font></b>
+ </td>
</tr>
</table>
<br>
# L4 protocol (tcp, udp, ...).
my $l4proto = $conn[2];
+ # Translate unknown protocols.
if ($l4proto eq 'unknown') {
- $l4proto = '';
+ my $l4protonum = $conn[3];
+ if ($l4protonum eq '2') {
+ $l4proto = 'IGMP';
+ } elsif ($l4protonum eq '4') {
+ $l4proto = 'IPv4 Encap';
+ } elsif ($l4protonum eq '33') {
+ $l4proto = 'DCCP';
+ } elsif ($l4protonum eq '41') {
+ $l4proto = 'IPv6 Encap';
+ } elsif ($l4protonum eq '50') {
+ $l4proto = 'ESP';
+ } elsif ($l4protonum eq '51') {
+ $l4proto = 'AH';
+ } elsif ($l4protonum eq '132') {
+ $l4proto = 'SCTP';
+ } else {
+ $l4proto = $l4protonum;
+ }
+ } else {
+ $l4proto = uc($l4proto);
}
# Source and destination.
my $sip;
+ my $sip_ret;
my $dip;
+ my $dip_ret;
my $sport;
+ my $sport_ret;
my $dport;
+ my $dport_ret;
my @packets;
my @bytes;
my $ttl = $conn[4];
my $state;
- if ($l4proto eq 'tcp') {
+ if ($l4proto eq 'TCP') {
$state = $conn[5];
}
switch ($key) {
case "src" {
- $sip = $val;
+ if ($sip == "") {
+ $sip = $val;
+ } else {
+ $dip_ret = $val;
+ }
}
case "dst" {
- $dip = $val;
+ if ($dip == "") {
+ $dip = $val;
+ } else {
+ $sip_ret = $val;
+ }
}
case "sport" {
- $sport = $val;
+ if ($sport == "") {
+ $sport = $val;
+ } else {
+ $dport_ret = $val;
+ }
}
case "dport" {
- $dport = $val;
+ if ($dport == "") {
+ $dport = $val;
+ } else {
+ $sport_ret = $val;
+ }
}
case "packets" {
push(@packets, $val);
my $sip_colour = ipcolour($sip);
my $dip_colour = ipcolour($dip);
- my $sserv = '';
- if ($sport < 1024) {
+ my $sserv = '';
+ if ($sport < 1024) {
$sserv = uc(getservbyport($sport, lc($l4proto)));
- if ($sserv ne '') {
- $sserv = " ($sserv)";
- }
- }
+ }
- my $dserv = '';
- if ($dport < 1024) {
+ my $dserv = '';
+ if ($dport < 1024) {
$dserv = uc(getservbyport($dport, lc($l4proto)));
- if ($dserv ne '') {
- $dserv = " ($dserv)";
- }
- }
+ }
my $bytes_in = format_bytes($bytes[0]);
my $bytes_out = format_bytes($bytes[1]);
# Format TTL
$ttl = format_time($ttl);
+ my $sip_extra;
+ if ($sip ne $sip_ret) {
+ $sip_extra = "<font color='#FFFFFF'>></font> ";
+ $sip_extra .= "<a href='/cgi-bin/ipinfo.cgi?ip=$sip_ret'>";
+ $sip_extra .= " <font color='#FFFFFF'>$sip_ret</font>";
+ $sip_extra .= "</a>";
+ }
+
+ my $dip_extra;
+ if ($dip ne $dip_ret) {
+ $dip_extra = "<font color='#FFFFFF'>></font> ";
+ $dip_extra .= "<a href='/cgi-bin/ipinfo.cgi?ip=$dip_ret'>";
+ $dip_extra .= " <font color='#FFFFFF'>$dip_ret</font>";
+ $dip_extra .= "</a>";
+ }
+
+
+ my $sport_extra;
+ if ($sport ne $sport_ret) {
+ my $sserv_ret = '';
+ if ($sport_ret < 1024) {
+ $sserv_ret = uc(getservbyport($sport_ret, lc($l4proto)));
+ }
+
+ $sport_extra = "<font color='#FFFFFF'>></font> ";
+ $sport_extra .= "<a href='http://isc.sans.org/port_details.php?port=$sport_ret' target='top' title='$sserv_ret'>";
+ $sport_extra .= " <font color='#FFFFFF'>$sport_ret</font>";
+ $sport_extra .= "</a>";
+ }
+
+ my $dport_extra;
+ if ($dport ne $dport_ret) {
+ my $dserv_ret = '';
+ if ($dport_ret < 1024) {
+ $dserv_ret = uc(getservbyport($dport_ret, lc($l4proto)));
+ }
+
+ $dport_extra = "<font color='#FFFFFF'>></font> ";
+ $dport_extra .= "<a href='http://isc.sans.org/port_details.php?port=$dport_ret' target='top' title='$dserv_ret'>";
+ $dport_extra .= " <font color='#FFFFFF'>$dport_ret</font>";
+ $dport_extra .= "</a>";
+ }
+
print <<END;
<tr>
<td align='center'>$l4proto</td>
<a href='/cgi-bin/ipinfo.cgi?ip=$sip'>
<font color='#FFFFFF'>$sip</font>
</a>
+ $sip_extra
</td>
<td align='center' bgcolor='$sip_colour'>
- <a href='http://isc.sans.org/port_details.php?port=$sport' target='top'>
- <font color='#FFFFFF'>$sport$sserv</font>
+ <a href='http://isc.sans.org/port_details.php?port=$sport' target='top' title='$sserv'>
+ <font color='#FFFFFF'>$sport</font>
</a>
+ $sport_extra
</td>
<td align='center' bgcolor='$dip_colour'>
<a href='/cgi-bin/ipinfo.cgi?ip=$dip'>
<font color='#FFFFFF'>$dip</font>
</a>
+ $dip_extra
</td>
<td align='center' bgcolor='$dip_colour'>
- <a href='http://isc.sans.org/port_details.php?port=$dport' target='top'>
- <font color='#FFFFFF'>$dport$dserv</font>
+ <a href='http://isc.sans.org/port_details.php?port=$dport' target='top' title='$dserv'>
+ <font color='#FFFFFF'>$dport</font>
</a>
+ $dport_extra
</td>
<td align='center'>
$bytes_in / $bytes_out