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

    Grabbing user IPs to apply rules

    Scheduled Pinned Locked Moved Captive Portal
    7 Posts 3 Posters 1.4k 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.
    • G
      gbreadman
      last edited by

      Is it possible to grab a user's IP add when they login PLUS identify if they used user creds or a voucher code,
      then based on this, be able to add their IPs on a firewall rule?

      I'm aiming to give different surfing privileges for users. Thanks!

      1 Reply Last reply Reply Quote 0
      • GertjanG
        Gertjan
        last edited by

        Grabbing the user IP, of course. Even the MAC is available.

        But ….. not without some PHP scripting, starting with /usr/local/captiveportal/index.php and /etc/inc/captiveportal.inc

        No "help me" PM's please. Use the forum, the community will thank you.
        Edit : and where are the logs ??

        1 Reply Last reply Reply Quote 0
        • G
          gbreadman
          last edited by

          Sorry if I wasn't clear enough. I know grabbing those is possible.
          My question is if I can automatically put those IPs under an updated alias, so the firewall rule always knows which IPs to block even after users log out or new ones log in. thanks

          1 Reply Last reply Reply Quote 0
          • GertjanG
            Gertjan
            last edited by

            @gbreadman:

            ….
            My question is if I can automatically put those IPs under an updated alias, so the firewall rule always knows which IPs to block even after users log out or new ones log in. thanks

            This is the answer :
            @Gertjan:

            ….
            But ..... not without some PHP scripting, starting with /usr/local/captiveportal/index.php and /etc/inc/captiveportal.inc

            No "help me" PM's please. Use the forum, the community will thank you.
            Edit : and where are the logs ??

            1 Reply Last reply Reply Quote 0
            • G
              gbreadman
              last edited by

              Haha thanks man, but by "is it possible?", I actually meant "what codes do I need?".
              Fault's on me. Sorry…

              So yeah, your reply answers my literal question.. thanks.
              To add to it, I just wanna ask if editing the captiveportal.inc needs reconfiguration whenever pfSense is updated.. It reverts it back, right?

              1 Reply Last reply Reply Quote 0
              • H
                heper
                last edited by

                if you want to seperate voucher & user/pass users, its probably easier to setup a different network altogether (& running a seperate CP for each).

                i haven't come across of anyone who hacked something together todo what you wish, but its probably no all too difficult for someone who knows the codebase. ( try a bounty if you can't do it yourself )
                the problem is not to get it working. the problem is to get it working, so it can be useful for multiple people in different scenarios.
                for example:

                • it should work for local users( integration in the pfsense user/group manager)
                  -it should work for seperate voucher-rolls
                • it should work for radius/active-directory users/groups/ou's
                • …. whatever else i've forgot
                
                 just wanna ask if editing the captiveportal.inc needs reconfiguration whenever pfSense is updated.. It reverts it back, right?
                

                it gets overwritten, unless you manage to get the feature added to https://github.com/pfsense for the next major release (2.4)

                1 Reply Last reply Reply Quote 0
                • G
                  gbreadman
                  last edited by

                  Yeah, I agree to pretty much everything you said.. :) Thanks

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