From: Peter Müller Date: Mon, 7 May 2018 15:23:52 +0000 (+0200) Subject: display country data for remote IPs on ovpnmain.cgi X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d8ef6a9537537ed43d7766ced22d3500b965ed1a;p=people%2Fmfischer%2Fipfire-2.x.git display country data for remote IPs on ovpnmain.cgi This makes debugging easier, especially when it comes to GeoIP related firewall rules and database related issues such as #11482. Signed-off-by: Peter Müller Signed-off-by: Michael Tremer --- diff --git a/config/rootfiles/core/121/filelists/files b/config/rootfiles/core/121/filelists/files index 7b7aa4fd92..fc07ad7e9f 100644 --- a/config/rootfiles/core/121/filelists/files +++ b/config/rootfiles/core/121/filelists/files @@ -1,5 +1,6 @@ etc/system-release etc/issue etc/ssl/certs/ca-bundle.crt +srv/web/ipfire/cgi-bin/ovpnmain.cgi srv/web/ipfire/cgi-bin/remote.cgi var/ipfire/langs diff --git a/html/cgi-bin/ovpnmain.cgi b/html/cgi-bin/ovpnmain.cgi index 94e723ba2c..eac962e6c7 100644 --- a/html/cgi-bin/ovpnmain.cgi +++ b/html/cgi-bin/ovpnmain.cgi @@ -35,6 +35,7 @@ require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; require "${General::swroot}/countries.pl"; +require "${General::swroot}/geoip-functions.pl"; # enable only the following on debugging purpose #use warnings; @@ -2991,6 +2992,7 @@ END $Lang::tr{'common name'} $Lang::tr{'real address'} + $Lang::tr{'country'} $Lang::tr{'virtual address'} $Lang::tr{'loged in at'} $Lang::tr{'bytes sent'} @@ -3030,6 +3032,11 @@ END $users[$uid]{'BytesSent'} = &sizeformat($match[4]); $users[$uid]{'Since'} = $match[5]; $users[$uid]{'Proto'} = $proto; + + # get country code for "RealAddress"... + my $ccode = &GeoIP::lookup((split ':', $users[$uid]{'RealAddress'})[0]); + my $flag_icon = &GeoIP::get_flag_icon($ccode); + $users[$uid]{'Country'} = "$ccode"; $uid++; } } @@ -3056,7 +3063,8 @@ END } print "$users[$idx-1]{'CommonName'}"; print "$users[$idx-1]{'RealAddress'}"; - print "$users[$idx-1]{'VirtualAddress'}"; + print "$users[$idx-1]{'Country'}"; + print "$users[$idx-1]{'VirtualAddress'}"; print "$users[$idx-1]{'Since'}"; print "$users[$idx-1]{'BytesSent'}"; print "$users[$idx-1]{'BytesReceived'}";