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

Captive Portal - Enable / Disable by Schedule or Cron

Scheduled Pinned Locked Moved Captive Portal
9 Posts 4 Posters 963 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.
  • J
    Joao Paulo
    last edited by Jul 11, 2019, 6:04 PM

    Hi!

    Can I Disable or Enable my captive portal by schedules or cron ?

    I need all time by captive portal, authenticated by vounchers, except 12:00 13:00 captive portal disabled.

    My captive portal is working, but i need disable/enable midday.

    Any ideas?

    Thanks

    1 Reply Last reply Reply Quote 0
    • G
      Gertjan
      last edited by Gertjan Jul 11, 2019, 7:04 PM Jul 11, 2019, 7:03 PM

      When you disable the portal, all traffic passes through.
      You want to implement some happy hours ?
      And what to do with the existing connections ?

      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
      • K
        kiokoman LAYER 8
        last edited by Jul 11, 2019, 7:09 PM

        you can create a script with

        ipfw add 10 allow ip from any to any keep-state
        

        and anotheer script with

        ipfw delete 10
        

        and use cron to launch it at specified time

        ̿' ̿'\̵͇̿̿\з=(◕_◕)=ε/̵͇̿̿/'̿'̿ ̿
        Please do not use chat/PM to ask for help
        we must focus on silencing this @guest character. we must make up lies and alter the copyrights !
        Don't forget to Upvote with the 👍 button for any post you find to be helpful.

        1 Reply Last reply Reply Quote 0
        • J
          Joao Paulo
          last edited by Jul 11, 2019, 7:56 PM

          Yess!!! It Works!!

          Here my scripts ;

          81732294-b384-4ee8-b055-12e760915253-image.png

          File: disable_captive.sh

          #!/bin/sh

          ipfw add 10 allow ip from any to any keep-state

          File: enable_captive.sh
          #!/bin/sh

          ipfw delete 10

          Now at Cron ;

          11:45 AM Captive Portal Ignored. All traffic passes through.
          13:00 PM Captive Portal Enabled, rule 10 deleted.

          981cd0f7-c66c-44a3-bf64-cf0993605764-image.png

          Tomorow I'll see if really works fine!

          Thanks @kiokoman and @Gertjan

          1 Reply Last reply Reply Quote 0
          • J
            Joao Paulo
            last edited by Jul 26, 2019, 7:26 PM

            sad :(

            it's not working anymore.

            Is there any other way to disable captive portal and enable it in a schedule ?

            G 1 Reply Last reply Jul 26, 2019, 8:09 PM Reply Quote 0
            • G
              Gertjan @Joao Paulo
              last edited by Jul 26, 2019, 8:09 PM

              @Joao-Paulo said in Captive Portal - Enable / Disable by Schedule or Cron:

              sad :(

              it's not working anymore.

              More details ?
              A script that works for 2 weeks, and then stops working ....
              something has changed.

              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
              • J
                Joao Paulo
                last edited by Jul 26, 2019, 8:17 PM

                it didn't actually work correctly.

                I thought it was working, really, I Don't know.

                I'm turning to the forum for help.

                uncheck enable captive portal

                6b10e25c-02ba-493a-b95f-d4210df565eb-image.png

                F 1 Reply Last reply Jul 27, 2019, 12:48 AM Reply Quote 0
                • F
                  free4 Rebel Alliance @Joao Paulo
                  last edited by free4 Jul 27, 2019, 12:22 PM Jul 27, 2019, 12:48 AM

                  @Joao-Paulo the cron job that has been given to you actually disable the captive portal without reflecting it inside the GUI...you should check the state of the captive portal directly with ipfw command

                  1 Reply Last reply Reply Quote 0
                  • K
                    kiokoman LAYER 8
                    last edited by kiokoman Jul 27, 2019, 10:00 AM Jul 27, 2019, 9:54 AM

                    @Joao-Paulo
                    you need to understand what that script is doing
                    IPFW is a stateful firewall used by captive portal
                    it does not literally disable captive portal
                    we are putting a firewall rules on top of every other rules inserted by captive portal, in this case the first rule should match and let any connection to go anywhere, so if we analazy the command

                    ipfw add 10 allow ip from any to any keep-state

                    we are telling ipfw to add a rules that allow any ip to go to any destination with priority 10, that should circumvent the captive portal

                    this is for example:

                    [2.4.4-RELEASE][root@pfSense.localdomain]/var/log: ipfw add 10 allow ip from any to any keep-state
                    00010 allow ip from any to any keep-state :default
                    [2.4.4-RELEASE][root@pfSense.localdomain]/var/log: ipfw list
                    00010 allow ip from any to any keep-state :default
                    01000 skipto tablearg ip from any to any via table(cp_ifaces)
                    01100 allow ip from any to any
                    02100 pipe tablearg ip from any to any MAC table(test_pipe_mac)
                    02101 allow pfsync from any to any
                    02102 allow carp from any to any
                    02103 allow ip from any to any layer2 mac-type 0x0806,0x8035
                    02104 allow ip from any to any layer2 mac-type 0x888e,0x88c7
                    

                    maybe the only trouble that can arise is if there is people that have used captive portal before we add that line and still have a state running, so please explain what is exactly not working

                    ̿' ̿'\̵͇̿̿\з=(◕_◕)=ε/̵͇̿̿/'̿'̿ ̿
                    Please do not use chat/PM to ask for help
                    we must focus on silencing this @guest character. we must make up lies and alter the copyrights !
                    Don't forget to Upvote with the 👍 button for any post you find to be helpful.

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post
                    Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                      This community forum collects and processes your personal information.
                      consent.not_received