From patchwork Thu Nov 16 08:49:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Peter_M=C3=BCller?= X-Patchwork-Id: 1538 Return-Path: Received: from mail01.ipfire.org (unknown [172.28.1.200]) by web02.ipfire.org (Postfix) with ESMTP id E8B566129C for ; Wed, 15 Nov 2017 22:49:11 +0100 (CET) Received: from mail01.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id 0369B310; Wed, 15 Nov 2017 22:49:10 +0100 (CET) Received: from mx.link38.eu (mx.link38.eu [188.68.43.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx.link38.eu", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id CE4652F0 for ; Wed, 15 Nov 2017 22:49:07 +0100 (CET) X-Virus-Scanned: ClamAV at mx.link38.eu Received: from mx-fra.brokers.link38.eu (mx-fra.brokers.link38.eu [10.141.75.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx.link38.eu (Postfix) with ESMTPS id CE6FF4016A for ; Wed, 15 Nov 2017 22:49:00 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx-fra.brokers.link38.eu (Postfix) with ESMTPSA id 4D7189F4A5 for ; Wed, 15 Nov 2017 22:49:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=link38.eu; s=201711; t=1510782540; bh=bfTE9otNeH14zkkxm0qMb9w4/me60CIV3JmnzetVaEE=; h=Date:From:To:Subject:From; b=Xjgo+0kW/JFfh6mVb8hUyB2VDG39a0DGBAemi8DzC6M7jYGmxnTM2J01XnSjFqtAQ KJfh7os+Op9Dne+6JngWammGffxIzaivDVWAnKDtY2DhXbr6B16KncISkRKzCbgv6Z JQnMOQfExhX32cBiSSzNbO21UlfD6B9CgVQm6Tg/8UzYVGU3Y4EVDEwN9yZ54LQe6D dzoBDTRUF3VM0yOPDTM9rCoSbrbdDtreFnHLY8sRjV60acqshFF6CEAA9gkl2PLpvS Z/nnsfF8XjWAW5IBTXAZQfme0tN/9HeRJc037RA3xLqa8Lk94oxP/p4bfDkyWX4gX1 V52mZM8ky5iWw== Date: Wed, 15 Nov 2017 22:49:00 +0100 From: Peter =?utf-8?q?M=C3=BCller?= To: "development@lists.ipfire.org" Subject: [PATCH v2] add GeoIP and rDNS information to used nameservers Message-ID: <20171115224900.2422e927.peter.mueller@link38.eu> Organization: Link38 MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Add GeoIP and rDNS information to DNS nameserver list at netexternal.cgi Use newly implemented GeoIP function in /var/ipfire/geoip-functions.pl Signed-off-by: Peter Müller --- html/cgi-bin/netexternal.cgi | 27 ++++++++++++++++++++++++++- langs/de/cgi-bin/de.pl | 1 + langs/en/cgi-bin/en.pl | 1 + 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/html/cgi-bin/netexternal.cgi b/html/cgi-bin/netexternal.cgi index 299612d4c..4393393e0 100644 --- a/html/cgi-bin/netexternal.cgi +++ b/html/cgi-bin/netexternal.cgi @@ -25,9 +25,12 @@ use strict; #use warnings; #use CGI::Carp 'fatalsToBrowser'; +use IO::Socket; + require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; +require "${General::swroot}/geoip-functions.pl"; require "${General::swroot}/graphs.pl"; my %color = (); @@ -99,6 +102,12 @@ if ( $querry[0] ne~ ""){ $Lang::tr{'nameserver'} + $Lang::tr{'country'} + + + $Lang::tr{'rdns'} + + $Lang::tr{'status'} @@ -139,9 +148,25 @@ END my $table_colour = ($id++ % 2) ? $color{'color22'} : $color{'color20'}; + # collect more information about name server (rDNS, GeoIP country code) + my $ccode = &GeoIP::lookup($nameserver); + my $flag_icon = &GeoIP::get_flag_icon($ccode); + + my $iaddr = inet_aton($nameserver); + my $rdns = gethostbyaddr($iaddr, AF_INET); + if (!$rdns) { $rdns = $Lang::tr{'lookup failed'}; } + print < - $nameserver + + $nameserver + + + $ccode + + + $rdns + $message diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index 6dff5d781..ae87464d2 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -1962,6 +1962,7 @@ 'read bytes' => 'Gelesene Bytes', 'read list' => 'Liste der Leseberechtigten', 'real address' => 'Reale Addresse', +'rdns' => 'rDNS', 'reboot' => 'Neustart', 'reboot ask' => 'Neustart?', 'reboot question' => 'Extra Abfrage bei neustart und herunterfahren einschalten', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index 4efff6e65..3af17d5dc 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -1997,6 +1997,7 @@ 'quick playlist' => 'Quick Playlist', 'ram' => 'RAM', 'random number generator daemon' => 'Random Number Generator Daemon', +'rdns' => 'rDNS', 'read bytes' => 'Read Bytes', 'read list' => 'list with readonly hosts', 'real address' => 'Real Address',