Enhancement #3070

Missing ip -> hostname conversion on lighsquid reports

Added by Davide Marini over 6 years ago. Updated almost 6 years ago.

Status:CLOSEDStart date:
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:nethserver-lightsquid
Target version:~FUTURE
Resolution:WONTFIX NEEDINFO:No

Description

Lightsquid's report show only ip addresses, it should be useful to have a dns reverse resolution in order to show the hostname if possible.

History

#1 Updated by Davide Marini over 6 years ago

I suggest to do this way... already tested and working:

1) edit /etc/lightsquid/lightsquid.cfg

--- lightsquid.cfg 2015-03-03 15:54:40.818219463 0100
+
+ /etc/lightsquid/lightsquid.cfg 2015-02-26 15:22:27.635748414 +0100
@ -58,7 +58,8 @
#if you want skip some ip from log - return "SKIP THIS IP" ;-)
#detail see in ip2name folder,

-$ip2name="simple";
+$ip2name="neth";

2) add the plugin /usr/share/lightsquid/ip2name/ip2name.neth with this code:


#contributor: nethesis
#specialy for squid with turned on user authentication
#fallback to dns

use Socket;

sub StartIp2Name() {
}

sub Ip2Name($$$) {
  # $Lhost,$user,$Ltimestamp
  my $Lhost=shift;
  my $user =shift;
  $user    =URLDecode($user); #decode user name
  return $user if ($user ne "-");

  my $ip = $Lhost;
  if (!defined $hIP{$ip}) {

    my $iaddr = inet_aton($ip);
    my $user = scalar gethostbyaddr($iaddr, AF_INET);

    # if gethostbyaddr failed to get host, use ip
    $user=$ip unless (defined $user);

    $hIP{$ip}=$user;
  }
  return $hIP{$ip};
}

sub StopIp2Name() {
}

#warning !!!
1;

#2 Updated by Giacomo Sanchietti over 6 years ago

  • Category set to nethserver-lightsquid
  • Status changed from NEW to TRIAGED
  • % Done changed from 0 to 20

#3 Updated by Filippo Carletti about 6 years ago

  • Target version changed from v6.6 to ~FUTURE

#4 Updated by Giacomo Sanchietti almost 6 years ago

  • Status changed from TRIAGED to CLOSED
  • % Done changed from 20 to 100
  • Resolution set to WONTFIX

Also available in: Atom PDF