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

    Capturing info and getting it outside pfSense

    Scheduled Pinned Locked Moved Captive Portal
    2 Posts 2 Posters 1.5k 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.
    • S
      Sgrud
      last edited by

      We're currently using pfSense for our "Public" LAN.  pfSense was installed by someone else and is on FreeBSD.

      I'd like to put some code in the Captive Portal page that gets various info (name via user input, hostname, MAC address, etc).

      Once I've captured this info to variables any thoughts on sending it to or making accessible from another LAN?

      I've tried dumping to a .txt file, but don't seem to have rights to a web served directory.

      I also tried emailing the info via 'php email'.  My code worked in a test environment, but not on pfSense/FreeBSD.

      I'd appreciate any input.  Thanks!  - Sgrud

      
      $remoteIp = $_SERVER['REMOTE_ADDR'];
      $myArp = `arp $remoteIp`;
      $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
      $message = "Hostname:\t$hostname\nAddress Info:\t$myArp";
      
      # to file attempt (file isn't web accessible)
      $myFile = "CPMaster.txt";
      $fh = fopen($myFile, 'a') or die("can't open file");
      fwrite($fh, $message);
      fclose($fh);
      
      #email attempt
      $from = "sysadmin@domain.com";
      $headers = "From: $from";
      $to = "sysadmin@domain.com";
      $subject = "Captive Portal";
      ini_set('SMTP',"exchange.domain.com");
      mail($to,$subject,$message,$headers);
      
      1 Reply Last reply Reply Quote 0
      • O
        OldNick
        last edited by

        How about using curl to squirt the data over to another box and storing it in a db?

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