Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Captive portal ip2name component for lightsquid

    Scheduled Pinned Locked Moved pfSense Packages
    29 Posts 15 Posters 19.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      daniele_dll
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • D
        dvserg
        last edited by

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

        SquidGuardDoc EN  RU Tutorial
        Localization ru_PFSense

        1 Reply Last reply Reply Quote 0
        • M
          mhab12
          last edited by

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

          1 Reply Last reply Reply Quote 0
          • D
            daniele_dll
            last edited by

            just … do tests :)

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

            1 Reply Last reply Reply Quote 0
            • T
              thirnanox
              last edited by

              Hello,

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

              Thank you.

              Dan.

              1 Reply Last reply Reply Quote 0
              • D
                daniele_dll
                last edited by

                Hi,

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

                1 Reply Last reply Reply Quote 0
                • P
                  PetitOursonDeLu
                  last edited by

                  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?

                  1 Reply Last reply Reply Quote 0
                  • D
                    daniele_dll
                    last edited by

                    you should install p5-DateTime package trought pkg_add

                    1 Reply Last reply Reply Quote 0
                    • P
                      PetitOursonDeLu
                      last edited by

                      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

                      1 Reply Last reply Reply Quote 0
                      • D
                        daniele_dll
                        last edited by

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

                        1 Reply Last reply Reply Quote 0
                        • M
                          Meulator
                          last edited by

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

                          1 Reply Last reply Reply Quote 0
                          • D
                            despotadmin
                            last edited by

                            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.
                            1 Reply Last reply Reply Quote 0
                            • P
                              PetitOursonDeLu
                              last edited by

                              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

                              1 Reply Last reply Reply Quote 0
                              • P
                                PetitOursonDeLu
                                last edited by

                                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

                                1 Reply Last reply Reply Quote 0
                                • P
                                  PetitOursonDeLu
                                  last edited by

                                  UP  ???

                                  1 Reply Last reply Reply Quote 0
                                  • P
                                    paulmr2
                                    last edited by

                                    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

                                    1 Reply Last reply Reply Quote 0
                                    • P
                                      PetitOursonDeLu
                                      last edited by

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

                                      I love Pfsense :)

                                      1 Reply Last reply Reply Quote 0
                                      • F
                                        Freak
                                        last edited by

                                        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.

                                        1 Reply Last reply Reply Quote 0
                                        • O
                                          Offliner
                                          last edited by

                                          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.

                                          En güzel nota FA

                                          1 Reply Last reply Reply Quote 0
                                          • D
                                            daniele_dll
                                            last edited by

                                            Hi,

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

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.