Captive portal ip2name component for lightsquid



  • Hi to all,

    some days ago i've wrote a ip2name component for lightsquid to let the report to associate directly a user to a log line using ip and unix timestamp.

    I've attached the file to the thread, simply download and put it into /usr/local/libexec/lightsquid. You need to modify lightsquid.xml too: it resides into /usr/local/pkg.

    Open it and look for

    
                    <field><fielddescr>IP resolve method (future)</fielddescr>
                            <fieldname>lightsquid_ip2name</fieldname>
                            <description><table cellpadding=1 cellspacing=0 style="text-align: left;"> <tbody>
                            <tr><th colspan=2> Select IP to Name resolve method (take effect only on new data): </th><tr>
                            <tr><th> IP              </th><td> - return IP </td><tr>
                            <tr><th> Demo            </th><td> - return AUTHNAME, else DNSNAME, else IP </td><tr>
                            <tr><th> DNS             </th><td> - return DNSNAME </td><tr> 
                            <tr><th> Simple          </th><td> - return AUTHNAME else IP </td><tr>
                            <tr><th> SMB             </th><td> - return SMB name of pc </td><tr>
                            <tr><th> Squidauth       </th><td> - return AUTHNAME else IP, allow cyrilyc name </td><tr></description></field> 
    

    Once found, add after

    
                            <tr><th> Captive Portal  </th><td> - return Captive Portal username else IP </td><tr>
    
    

    Look for

    
                            <type>select</type>
                            <value>dns</value>
                            <options><option><name>IP</name><value>ip</value></option>                             
                                    <option><name>Demo</name><value>demo</value></option>                              
                                    <option><name>DNS</name><value>dns</value></option>                              
                                    <option><name>Simple</name><value>simple</value></option>                              
                                    <option><name>SMB</name><value>smb</value></option>                              
                                    <option><name>Squidauth</name><value>squidauth</value></option></options> 
    

    add after

    
                                    <option><name>Captive Portal</name><value>portalauth</value></option>
    
    

    I've tested for a few days and it seems to works. I'm not a perl programmer so the code isin't the best … but it just works

    Once downloaded you need to rename it dropping the .txt extension
    ip2name.portalauth.txt



  • Thanks. I will place this in to package with next update



  • This will be fantastic if it does what I understand it to.  Thanks for doing the leg work.



  • just … do tests :)

    i, really, not a perl programmer so the code isn't great



  • Hello,

    For me it doesn't work. Have you any idea how I can debug or see log.

    Thank you.

    Dan.



  • Hi,

    you should execute the report tool from command line to see the output



  • Sorry for my bad English, I'm french … :o

    Hello, thank you for this work, however I have a problem.
    When I run the command /usr/bin/perl /usr/local/www/lightsquid/lightparser.pl today. I get this result. Have you an idea of the problem?

    Can't locate Date/Parse.pm in @INC (@INC contains: /usr/local/lib/perl5/5.8.8/BSDPAN /usr/local/lib/perl5/site_perl/5.8.8/mach /usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.8.8/mach /usr/local/lib/perl5/5.8.8 . /usr/local/www/lightsquid/) at /usr/local/libexec/lightsquid/ip2name.portalauth line 2.
    BEGIN failed–compilation aborted at /usr/local/libexec/lightsquid/ip2name.portalauth line 2.
    Compilation failed in require at /usr/local/www/lightsquid/lightparser.pl line 39.

    Thank you in advance.
    Others have used this module?



  • you should install p5-DateTime package trought pkg_add



  • Hello, thank you for your reply.
    I tried to install the p5-DateTime package with the command pkg_add or pkg_add -r but it does not work.
    There seems to be a lot of dependencies for this package. Can you use a "magical" command to manage these dependencies?
    I have never configured freeBSD is quite complicated for me. Can you give me the procedure?

    Thank you a lot

    Sorry for my bad English :o



  • pass the full url to pkg_add fetching it from freebsd 7.0 repository or pfsense 1.2 repository



  • Can someone post a screenshot to see how it looks like?



  • I tried to work it but not success like "PetitOursonDeLu".

    I install p5-DateTime with this command

    pkg_add ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7-stable/p5-DateTime.tbz
    

    Suggestion  (```
    pkg_add -r p5-DateTime

    
    After that same error appears = Can't locate Date/Parse.pm .
    
    I search /usr/local/lib/perl5/site_perl folder listed 5.8.8 and 5.8.9\. in folder named 5.8.9 has "DateTime" folder. I moved this folder to 5.8.8\. But error continues.
    Then i add a "use DateTime;^M"  before "use Date::Parse;^M" in ip2name.portalauth.
    
    It looks fine but i get another error :
    

    /libexec/ld-elf.so.1: /usr/local/lib/perl5/site_perl/5.8.8/mach/auto/Params/Validate/Validate.so: Undefined symbol "Perl_newXS_flags"

    
    It look like p5-DateTime packages doesn't installing right place.


  • Hello
    I would like to found out if anyone has found the solution to install p5-Datetime. And if anyone has it, can they please tell me.

    Thanks, bye



  • Hello,
    I update PFsense 1.2.2 to 1.2.3 and I install with success p5-dateTime with this command line: pkg_add -r p5-DateTime.
    But, I have evermore this message: Can't locate Date/Parse.pm in @INC (@INC contains: /usr/local/lib/perl5/5.8.8/BSDPAN /usr/local/lib/perl5/site_perl/5.8.8/mach /usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.8.8/mach /usr/local/lib/perl5/5.8.8 . /usr/local/www/lightsquid/) at /usr/local/libexec/lightsquid/ip2name.portalauth line 2.
    BEGIN failed–compilation aborted at /usr/local/libexec/lightsquid/ip2name.portalauth line 2.
    Compilation failed in require at /usr/local/www/lightsquid/lightparser.pl line 39

    I slowly, but I still need your help.

    Thanks

    EDIT: the command line pkg_info return:
    bsdinstaller-2.0.2009.0108 BSD Installer mega-package
    db41-4.1.25_4      The Berkeley DB package, revision 4.1
    gd-2.0.35,1        A graphics library for fast creation of images
    grub-0.97_1        GRand Unified Bootloader
    jpeg-6b_4          IJG's jpeg compression utilities
    lightsquid-1.7.1_1  A light and fast web based squid proxy traffic analyser
    openldap-client-2.4.10 Open source LDAP client implementation
    openldap-client-2.4.11 Open source LDAP client implementation
    p5-Class-Factory-Util-1.7 Utility functions for (factory) classes
    p5-Class-Singleton-1.4 Perl module that describes a singular object class
    p5-DateTime-0.43.02 A date and time object
    p5-DateTime-Locale-0.40.01_2 Localization support for DateTime
    p5-DateTime-TimeZone-0.77.01 Time zone object base class and factory
    p5-GD-2.39          A perl5 interface to Gd Graphics Library version2
    p5-List-MoreUtils-0.22 Provide the stuff missing in List::Util
    p5-Params-Validate-0.89 Validate method/function parameters
    p5-Time-Local-1.18  Efficiently compute time from local and GMT time
    perl-5.8.8_1        Practical Extraction and Report Language
    squid-2.6.21        HTTP Caching Proxy
    squidGuard-1.3_1    A fast redirector for squid
    squid_radius_auth-1.10 RADIUS authenticator for squid proxy 2.5 and later



  • UP  ???



  • If it is any help I managed to get this to work after a few days of trying, here’s how I done it:

    1. Downloaded the TimeDate Perl module from http://search.cpan.org/~gbarr/TimeDate-1.16/

    2. Copied the Date and Time folders from the download into /usr/local/lib/perl5/5.8.8

    3. Followed the instructions on the thread

    4. Corrected a typo in the ip2name.portalauth on the line

    // Acquire the timestamp in unix format
    

    change to

    # Acquire the timestamp in unix format
    

    This worked for me. I did try it on 1.2.3 but the portalauth.log file uses USER LOGIN instead of LOGIN and that was causing some problems with the script

    HTH



  • Yes! yes! yes! Thank you very much paulmr2, it's OK!

    I love Pfsense :)



  • Hello,

    At first of all thank you for this work!

    I am new on pfSene!
    I want to install this component on my system but for the moment I only have setup the captive portal on pfSense.

    If I understand it right, before install the ip2name component I have to install and setup Squid in non-transparent mode (because transparent mode doesn't work with captive portal?) and than I have to install and setup the Lightsquid package?
    Is it right?

    Thank you! And sorry for my English I am french too.



  • i used pf 1.2.3 squid(transparent mode) squid guard Captive Portal and Lightsquid and i want take a repor from the lightsquid ip2name captive portal login username but i cant make a report

    how can i do it??

    ps im sorry for my eng.



  • Hi,

    really, i didn't remember the right dependency to let this code to work: it needs Date::Parse library to works.



  • Hi, sorry, I'm french but I have a solution for IP2name.
    It's avaible here (it's my website): www.adrienbourget.com/wp-content/uploads/2010/05/ip2name.zip

    By



  • Hello,

    i found your solution of the portalauth for lightsquid… Thank you first for that, because the idee is very good!!!

    But i have a problem, after rebooting pfsense all the traffic is related to the ip again... if i look in the report-folder of lightsquid the files with the usernames are already in...

    i dont understand why lightsquid only shows the ip after rebooting and relates the traffic of the the user to the ip automatically...

    Do you have a solution for that?



  • Hello,
    Sorry but I have no solution :(
    I'm no expert, just advanced user …
    Sorry, but if you find the solution, I would like to know.

    Thank you.
    Adrien



  • @PetitOursonDeLu:

    Hello,
    Sorry but I have no solution :(
    I'm no expert, just advanced user …
    Sorry, but if you find the solution, I would like to know.

    Thank you.
    Adrien

    Ok, i will try… but i hoped you have a tip for me why this happens....



  • Hi! Thanks for all in this topic! It's solved my problem :)

    I add a line to change text USER LOGIN or MACHINE LOGIN for LOGIN, to keep the format of the old log. I don't know much about perl and regular expressions, but it was enough to work for me

    The modified script is attached.
    Script tested on pfSense 1.2.3.

    Also I installed the package p5-TimeDate to resolve problem to use Date::Parse on script

    pkg_add -r p5-TimeDate
    

    ip2name.portalauth.txt



  • Hi,

    is there any possiblity to change the script to log the vouchers instead the users?



  • Found that thread from 2009, but names in lightsquid still doesn't work today. Is there any plans to get this working? There are floating some hints around, but none of them works.



  • Hi,

    for me it works with "IP" (resolves IP-addresses) and with "DNS" which resolves the FQDN like Host1.domain.
    Do not know, if this works with vouchers but I don't think so.

    I hope this is what your question is pointing to ?



  • from dvserg this:```
    Thanks. I will place this in to package with next update


Log in to reply