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

    SSH command to whitelist ("Allowed IP") a captive portal IP?

    Scheduled Pinned Locked Moved Captive Portal
    8 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.
    • D
      dylanh724
      last edited by

      Hi,

      I'm trying to write a SSH script to whitelist an IP ("Allowed IP" in captive portal) –

      How would I best go about this? Thanks! As always, researching this as I post this .. if I find anything useful before an answer, I'll be sure to post it :) getting pretty good at this stuff

      1 Reply Last reply Reply Quote 0
      • D
        doktornotor Banned
        last edited by

        None. Do it via GUI.

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

          @doktornotor:

          None. Do it via GUI.

          You really don't think outside the box do you. You want to know how many times people said none in this forum and I found a way to code it in? Smite for you, troll.

          Anyone know where whitelisted IPs are saved for the captive portal?

          1 Reply Last reply Reply Quote 0
          • DerelictD
            Derelict LAYER 8 Netgate
            last edited by

            Until there's an API for this, the above post by doktornotor is spot on.  Sorry, but you have the captive portal you have, not the firewall you want.

            Anyone who can code this can get on github and figure out where they're stored for himself.  Look at etc/inc/captiveportal.inc for the functions you might be able to call to accomplish this. And usr/local/www/services_captiveportal_ip_edit.php for other examples.

            A programmer shouldn't need to be told this.

            Good luck.

            Chattanooga, Tennessee, USA
            A comprehensive network diagram is worth 10,000 words and 15 conference calls.
            DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
            Do Not Chat For Help! NO_WAN_EGRESS(TM)

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

              @Derelict:

              Until there's an API for this, the above post by doktornotor is spot on.  Sorry, but you have the captive portal you have, not the firewall you want.

              Anyone who can code this can get on github and figure out where they're stored for himself.  Look at etc/inc/captiveportal.inc for the functions you might be able to call to accomplish this. And usr/local/www/services_captiveportal_ip_edit.php for other examples.

              A programmer shouldn't need to be told this.

              Good luck.

              A programmer shouldn't be told where certain files are located? Right, because if I told a pro traveler to go to certain coordinates, he wouldn't have to look at a map/GPS, right? Idiot.

              I've solved many puzzles like this and posted my code – feel free to use my findings to add to github -- it's there. Someone can feel free to spend 5 mins add it, if you'd like. I've done my part. That would make more use of your time than trolling. No need for an API if it's open source?

              Other than your trolls, thanks for the locations.

              That's also why I asked where to look, so that I CAN edit this. I'll post my findings later. Not for you, but for others.

              EDIT: This would be easy if can just edit the XML and reupload:

              (The highlighted section, specifically)

              Anyone know a decent way to obtain the XML and restore it remotely? Hmm.. Or where is this info in the XML physically stored – could just edit the file itself with sudo

              1 Reply Last reply Reply Quote 0
              • DerelictD
                Derelict LAYER 8 Netgate
                last edited by

                I point you in the right direction and for that I get a smite.  What a douche.

                Call the php functions that are called when someone adds an IP using the GUI and you'll have your "solution."

                I say again: what a douche.

                Chattanooga, Tennessee, USA
                A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                Do Not Chat For Help! NO_WAN_EGRESS(TM)

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

                  @Derelict:

                  I point you in the right direction and for that I get a smite.  What a douche.

                  Call the php functions that are called when someone adds an IP using the GUI and you'll have your "solution."

                  I say again: what a douche.

                  …

                  A programmer shouldn't need to be told this.

                  But a +1/thanks for the actual contribution.. even though your answer was wrapped in a box of douche (smite was for the blatent insult).. for that, you received both thanks and smite.

                  Anyway, 2 thanks beats 1 smite – thanks for the the tip about php call ..

                  1 Reply Last reply Reply Quote 0
                  • D
                    doktornotor Banned
                    last edited by

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