From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter =?utf-8?q?M=C3=BCller?= To: development@lists.ipfire.org Subject: [PATCH] display country data for remote IPs on ovpnmain.cgi Date: Mon, 07 May 2018 17:23:52 +0200 Message-ID: <032299de-afbb-e1df-c405-b87c37111c70@link38.eu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6257997774625430852==" List-Id: --===============6257997774625430852== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=C3=BCller --- config/rootfiles/core/121/filelists/files | 1 + html/cgi-bin/ovpnmain.cgi | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config/rootfiles/core/121/filelists/files b/config/rootfiles/cor= e/121/filelists/files index 4ce37f9ed..654460b72 100644 --- a/config/rootfiles/core/121/filelists/files +++ b/config/rootfiles/core/121/filelists/files @@ -1,3 +1,4 @@ etc/system-release etc/issue etc/ssl/certs/ca-bundle.crt +srv/web/ipfire/cgi-bin/ovpnmain.cgi diff --git a/html/cgi-bin/ovpnmain.cgi b/html/cgi-bin/ovpnmain.cgi index 94e723ba2..eac962e6c 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"; =20 # 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'} =3D &sizeformat($match[4]); $users[$uid]{'Since'} =3D $match[5]; $users[$uid]{'Proto'} =3D $proto; + + # get country code for "RealAddress"... + my $ccode =3D &GeoIP::lookup((split ':', $users[$uid]{'RealAddress'})[= 0]); + my $flag_icon =3D &GeoIP::get_flag_icon($ccode); + $users[$uid]{'Country'} =3D "3D'$ccode'"; $uid++; } =20 } @@ -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'}"; --=20 2.13.6 --===============6257997774625430852== Content-Type: application/pgp-signature Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="signature.asc" MIME-Version: 1.0 LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KVmVyc2lvbjogR251UEcgdjIKCmlRSWNCQUVC Q2dBR0JRSmE4Ryt0QUFvSkVObEk4Zzk5ZTU5b21GMFFBS1Jyd216enNwRTBXQ2loY01hZlVlWUUK SVdJSlhCb2gzZkdkS1BkUWVtcE1tcFdGeDhtUXI1cmxMSjlLcDcvNjJRQ3RJd2F6RlFURW1YUGg1 Y0NOZHdtVQo2Q3pTSXkwbUNqeUdEcjRPSkJMTkxsSmJNcVdwaVNjVE94NUVIeUpsSlQ2aW9MNWJF UU0ybUVZUE85azFaeWF5CmRVL1lhTkNkMUNidUk3cEdkei9wVXlibFRwR293ZHdEVUZ4elczZmpN MW5CdUtBMENXQkh1YjJvUFpiZDRMU1MKWjcyVDltajkrMllJanMydTB0dFNzcHdoZmZWaG1DWlYr MnBUaGJ6aCtNVDJvOG9DYm1tdDJvZncwR1hvY01rZAoza2VPWStEOG9NMGtlQ3JFMkxGd054U2V6 NkpITDRDOUhUZ00yeEFqQTdzRENrNkx5L1BYM1FPOXNQd3ROY1NyCjV0bmtQM251ZlA5dDd2SDRh aURDY1ZNcWQ4aUNnaUJsQWFzUTU5TTVranNOSnlvckNuUXNm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