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

    Any Change And Save Update Captive Portal Bug

    Scheduled Pinned Locked Moved Captive Portal
    50 Posts 6 Posters 11.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
      streetsfinest
      last edited by

      The failure happened today and actually every single day in the past. Whats your idea?

      F 1 Reply Last reply Reply Quote 0
      • F
        free4 Rebel Alliance @streetsfinest
        last edited by

        @streetsfinest said in Any Change And Save Update Captive Portal Bug:

        The failure happened today and actually every single day in the past. Whats your idea?

        I was thinking that the problem could come from check_reload_status
        But i was apparently wrong

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

          @streetsfinest : any news on my questions ?

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

          S 1 Reply Last reply Reply Quote 0
          • S
            streetsfinest @Gertjan
            last edited by

            @gertjan

            Sorry for the delay!
            These are the users who are currently marked as active in the webconfig:

            172.16.2.19 c4:61:8b:24:51:65 tmujXFpT8sZ 12/04/2018 07:37:51
            172.16.2.14 e4:e4:ab:2f:07:60 ePJmntaUt2X 12/04/2018 08:22:51
            172.16.2.15 08:c5:e1:9c:dd:61 MZPM3AetRDm 12/05/2018 08:21:38
            172.16.2.18 8c:f5:a3:1c:ab:7c bEYtpEZBvtX 12/11/2018 10:58:22
            172.16.2.16 fc:db:b3:d1:99:3b de2SdfsZB2p 12/11/2018 11:52:27
            172.16.2.23 ac:5f:3e:e0:7f:34 fHwDGUrqxXr 12/12/2018 11:33:54

            These are the entries on the shell:

            [2.4.4-RELEASE][root@firewall01]/root: ipfw table all list
            --- table(cp_ifaces), set(0) ---
            em0.24 2100 6431485 3910816564 1544694662
            --- table(company_guest_auth_up), set(0) ---
            172.16.2.14/32 e4:e4:ab:2f:07:60 2006 82251 12132714 1544029688
            172.16.2.15/32 08:c5:e1:9c:dd:61 2000 456811 105345127 1544204452
            172.16.2.16/32 fc:db:b3:d1:99:3b 2008 110792 15084931 1544650234
            172.16.2.18/32 8c:f5:a3:1c:ab:7c 2010 158374 17991642 1544565826
            172.16.2.19/32 c4:61:8b:24:51:65 2004 266827 103579459 1544130687
            172.16.2.23/32 ac:5f:3e:e0:7f:34 2002 56379 4834459 1544649475
            --- table(company_guest_host_ips), set(0) ---
            172.16.2.2/32 0 369100 92909044 1544694660
            --- table(company_guest_pipe_mac), set(0) ---
            --- table(company_guest_auth_down), set(0) ---
            172.16.2.14/32 2007 118970 110192748 1544678486
            172.16.2.15/32 2001 702015 859258240 1544639803
            172.16.2.16/32 2009 168581 191962139 1544651420
            172.16.2.18/32 2011 252903 328096547 1544629175
            172.16.2.19/32 2005 265407 238158210 1544666548
            172.16.2.23/32 2003 92898 127969742 1544650439
            --- table(company_guest_allowed_up), set(0) ---
            --- table(company_guest_allowed_down), set(0) ---

            [2.4.4-RELEASE][root@firewall01]/root: ipfw table company_guest_auth_up list
            --- table(company_guest_auth_up), set(0) ---
            172.16.2.14/32 e4:e4:ab:2f:07:60 2006 82251 12132714 1544029688
            172.16.2.15/32 08:c5:e1:9c:dd:61 2000 456811 105345127 1544204452
            172.16.2.16/32 fc:db:b3:d1:99:3b 2008 110792 15084931 1544650234
            172.16.2.18/32 8c:f5:a3:1c:ab:7c 2010 158374 17991642 1544565826
            172.16.2.19/32 c4:61:8b:24:51:65 2004 266827 103579459 1544130687
            172.16.2.23/32 ac:5f:3e:e0:7f:34 2002 56379 4834459 1544649475
            [2.4.4-RELEASE][root@firewall01]/root: ipfw table company_guest_auth_down list
            --- table(company_guest_auth_down), set(0) ---
            172.16.2.14/32 2007 118970 110192748 1544678486
            172.16.2.15/32 2001 702015 859258240 1544639803
            172.16.2.16/32 2009 168581 191962139 1544651420
            172.16.2.18/32 2011 252903 328096547 1544629175
            172.16.2.19/32 2005 265407 238158210 1544666548
            172.16.2.23/32 2003 92898 127969742 1544650439

            1 Reply Last reply Reply Quote 0
            • S
              streetsfinest @free4
              last edited by

              @free4

              Thank you for trying to help me!

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

                What the webconfig shows, is nothing more as the content of a local database with connected users :
                They are :
                172.16.2.14
                172.16.2.15
                172.16.2.16
                172.16.2.18
                172.16.2.19
                172.16.2.23

                Both tables company_guest_auth_up and table company_guest_auth_down should also contain these same IP's. And they do.

                There is another firewall, pf, which is fed with the GUI firewall rules for your portal interface.

                Check out
                ipfw list :

                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(cpzone1_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
                02105 allow ip from any to any layer2 mac-type 0x8863,0x8864
                02106 deny ip from any to any layer2 not mac-type 0x0800,0x86dd
                
                02107 allow ip from any to table(cpzone1_host_ips) in
                02108 allow ip from table(cpzone1_host_ips) to any out
                
                02109 allow ip from any to 255.255.255.255 in
                02110 allow ip from 255.255.255.255 to any out
                
                02111 pipe tablearg ip from table(cpzone1_allowed_up) to any in
                02112 pipe tablearg ip from any to table(cpzone1_allowed_down) in
                02113 pipe tablearg ip from table(cpzone1_allowed_up) to any out
                02114 pipe tablearg ip from any to table(cpzone1_allowed_down) out
                
                02115 pipe tablearg ip from table(cpzone1_auth_up) to any layer2 in
                02116 pipe tablearg ip from any to table(cpzone1_auth_down) layer2 out
                
                02117 fwd 127.0.0.1,8003 tcp from any to any 443 in
                02118 fwd 127.0.0.1,8002 tcp from any to any 80 in
                
                02119 allow tcp from any to any out
                02120 skipto 65534 ip from any to any
                
                65534 deny ip from any to any
                65535 allow ip from any to any
                

                All these lines are actually easy to read :
                Line 02118 (and 02117) will get hit if the the network connected user has no IP/MAC into one (or two) of the tables 02111 -> 02116.

                The login code places the IP/MAC into the tables company_guest_auth_down and company_guest_auth_up.

                As long as these IP/MAC's are there, clients are not redirected to the captive portal by these firewall rules 02117/02118, except if they use the URL of the portal, something like
                https://your.portal.net:800x?zone=company_guest

                Check your logged in database and ipfw ones more, do an edit on the captive portal config page, and check both again.
                You see what happens : tables company_guest_auth_down and company_guest_auth_up will be empty : people get redirected to the login portal (and can't login, because the database (== GUI Status => Captive Portal) considers them as logged in again.

                So, the get back to your issue : if both ipfw tables tables company_guest_auth_down and company_guest_auth_up contain teh IP/MAC of visitors, these visitors are not redirected to the login page. At least, not on behalf of pfSense.

                Your issue is not related to the "config save => connected visitors logged out and can't re login" bug.

                Show you "html login page" please.

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

                S 1 Reply Last reply Reply Quote 0
                • S
                  streetsfinest @Gertjan
                  last edited by

                  @gertjan

                  There should not be another firewall in the network.

                  This is the current html login page:

                  <!DOCTYPE html>
                  <html>
                  
                  <head>
                  
                    <meta charset="UTF-8">
                    <meta name="viewport" content="width=device-width, initial-scale=1.0">
                    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
                    <title>Company Guest WLAN</title>
                    <style>
                  	  #content,.login,.login-card a,.login-card h1,.login-help{text-align:center}body,html{margin:0;padding:0;width:100%;height:100%;display:table}#content{font-family:'Source Sans Pro',sans-serif;background-color:#1C1275;background:linear-gradient(135deg, #1475CF, #2B40B5, #1C1275);-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover;display:table-cell;vertical-align:middle}.login-card{padding:40px;width:280px;background-color:#F7F7F7;margin:100px auto 10px;border-radius:2px;box-shadow:0 2px 2px rgba(0,0,0,.3);overflow:hidden}.login-card h1{font-weight:400;font-size:2.3em;color:#1383c6}.login-card h1 span{color:#f26721}.login-card img{width:70%;height:70%}.login-card input[type=submit]{width:100%;display:block;margin-bottom:10px;position:relative}.login-card input[type=text],input[type=password]{height:44px;font-size:16px;width:100%;margin-bottom:10px;-webkit-appearance:none;background:#fff;border:1px solid #d9d9d9;border-top:1px solid silver;padding:0 8px;box-sizing:border-box;-moz-box-sizing:border-box}.login-card input[type=text]:hover,input[type=password]:hover{border:1px solid #b9b9b9;border-top:1px solid #a0a0a0;-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.login{font-size:14px;font-family:Arial,sans-serif;font-weight:700;height:36px;padding:0 8px}.login-submit{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;color:#fff;text-shadow:0 1px rgba(0,0,0,.1);background-color:#4d90fe}.login-submit:disabled{opacity:.6}.login-submit:hover{border:0;text-shadow:0 1px rgba(0,0,0,.3);background-color:#357ae8}.login-card a{text-decoration:none;color:#222;font-weight:400;display:inline-block;opacity:.6;transition:opacity ease .5s}.login-card a:hover{opacity:1}.login-help{width:100%;font-size:12px}.list{list-style-type:none;padding:0}.list__item{margin:0 0 .7rem;padding:0}label{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;text-align:left;font-size:14px;}input[type=checkbox]{-webkit-box-flex:0;-webkit-flex:none;-ms-flex:none;flex:none;margin-right:10px;float:left}@media screen and (max-width:450px){.login-card{width:70%!important}.login-card img{width:30%;height:30%}}textarea{width:66%;margin:auto;height:120px;max-height:120px;background-color:#f7f7f7;padding:20px}#terms{display:none;padding-top:100px;padding-bottom:300px;}.auth_source{border: 1px solid lightgray; padding:20px 8px 0px 8px; margin-top: -2em; border-radius: 2px; }.auth_head{background-color:#f7f7f7;display:inline-block;}.auth_head_div{text-align:left;}#error-message{text-align:left;color:#ff3e3e;font-style:italic;}
                    </style>
                  </head>
                  
                  <body>
                  <div id="content">
                  	<div class="login-card">
                  		<img src="captiveportal-logo.png"/><br>
                   		<h1></h1>
                  		<div id="error-message">
                  			#PORTAL_MESSAGE#
                  		</div>
                  	  <form name="login_form" method="post" action="#PORTAL_ACTION#">
                  				<input name="auth_voucher" type="text" placeholder="Voucher Code">		  <div class="login-help">
                  			<ul class="list">
                  				<li class="list__item">
                  				  <label class="label--checkbox">
                  					<input type="checkbox" class="checkbox" onchange="document.getElementById('login').disabled = !this.checked;">
                  					<span>I agree with the <a  rel="noopener" href="#terms" onclick="document.getElementById('terms').style.display = 'block';">terms & conditions</a></span>
                  				  </label>
                  				</li>
                  			</ul>
                  		  </div>
                  		<input name="redirurl" type="hidden" value="#PORTAL_REDIRURL#">
                  		<input type="submit" name="accept" class="login login-submit" value="Login" id="login" disabled>
                  	  </form>
                  	  </div>
                  	<div id="terms">
                  		<textarea readonly>TERMS</textarea>
                  	</div>
                  </div>
                  </body>
                  </html>
                  
                  

                  These are the current captive portal settings:

                  2_1544710276183_3.png 1_1544710276183_2.png 0_1544710276183_1.png

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

                    According to your settings you use the default, build in login page.

                    Check : "Use custom captive portal page" and compare the code html shown with your html .
                    The extremely important line :

                    <input name="zone" type="hidden" value="$PORTAL_ZONE$" />
                    

                    is missing in your html ....

                    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
                    • S
                      streetsfinest
                      last edited by

                      Ah i got it!
                      I changed the settings like you write to me now:

                      0_1544715112108_1.PNG

                      The new login page has the missing line now:

                      <body>
                      <div id="content">
                      	<div class="login-card">
                      		<img src="captiveportal-logo.png"/><br>
                       		<h1></h1>
                      		<div id="error-message">
                      			#PORTAL_MESSAGE#
                      		</div>
                      	  <form name="login_form" method="post" action="#PORTAL_ACTION#">
                      				<input name="auth_voucher" type="text" placeholder="Voucher Code">		  <div class="login-help">
                      			<ul class="list">
                      				<li class="list__item">
                      				  <label class="label--checkbox">
                      					<input type="checkbox" class="checkbox" onchange="document.getElementById('login').disabled = !this.checked;">
                      					<span>I agree with the <a  rel="noopener" href="#terms" onclick="document.getElementById('terms').style.display = 'block';">terms & conditions</a></span>
                      				  </label>
                      				</li>
                      			</ul>
                      		  </div>
                      		<input name="redirurl" type="hidden" value="#PORTAL_REDIRURL#">
                      		<input type="submit" name="accept" class="login login-submit" value="Login" id="login" disabled>
                      		**<input name="zone" type="hidden" value="#PORTAL_ZONE#" />**
                      	  </form>
                      	  </div>
                      	<div id="terms">
                      

                      I have disconnected all users and will test the new configuration!
                      Thank you very much! I will give you all a feedback if it works now.

                      1 Reply Last reply Reply Quote 0
                      • S
                        streetsfinest
                        last edited by

                        Wish you all a happy new year!
                        I would like to give you a short feedback:

                        After adding the code:

                        <input name="zone" type="hidden" value="$PORTAL_ZONE$" />
                        

                        in the custom login page it seems to work!
                        Thank you very much for your help.

                        I have another question!
                        All of the employees use the vouchers for connecting to the guest wifi with private devices, but they have to type in the voucher every single day. This is very annoying for them. Is there any possibility to "save" the vouchers entries in the captive portal so that they do not need to type it in every single day?

                        GertjanG F 2 Replies Last reply Reply Quote 0
                        • GertjanG
                          Gertjan @streetsfinest
                          last edited by

                          @streetsfinest said in Any Change And Save Update Captive Portal Bug:

                          but they have to type in the voucher every single day

                          Check your idle and hard time out values.

                          Visitors are thrown of the portal after "idle" time - and "hard" time.
                          They can reconnect, of course, if the credentials are valid.

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

                          S 1 Reply Last reply Reply Quote 0
                          • F
                            free4 Rebel Alliance @streetsfinest
                            last edited by free4

                            @streetsfinest said in Any Change And Save Update Captive Portal Bug:

                            Wish you all a happy new year!
                            I would like to give you a short feedback:

                            After adding the code:

                            <input name="zone" type="hidden" value="$PORTAL_ZONE$" />
                            

                            in the custom login page it seems to work!
                            Thank you very much for your help.

                            That's actually super strange

                            I checked everywhere in the code, there is no references to $_POST['zone'].
                            This hidden input should have absolutely no effect on pfSense's Captive Portal in 2.4.X

                            This hidden input was used long time ago, but it's now an outdated string. Or at least it's supposed to be....
                            Maybe you spotted a new bug?

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

                              @free4 said in Any Change And Save Update Captive Portal Bug:

                              This hidden input was used long time ago,

                              @free4 : He, ho -> time out ^^ : check out the very first line of the index.php file.
                              If the "zone" isn't defined, everything stops right away.
                              It's the mandatory parameter that makes it possible to support multiple captive portals on pfSense.

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

                              F 1 Reply Last reply Reply Quote 0
                              • F
                                free4 Rebel Alliance @Gertjan
                                last edited by free4

                                @gertjan said in Any Change And Save Update Captive Portal Bug:

                                @free4 said in Any Change And Save Update Captive Portal Bug:

                                This hidden input was used long time ago,

                                @free4 : He, ho -> time out ^^ : check out the very first line of the index.php file.
                                If the "zone" isn't defined, everything stops right away.
                                It's the mandatory parameter that makes it ppfSenseossible to support multiple captive portals on .

                                I know, but it's a $_REQUEST (so it can contain both GET and POST data)

                                The problem is, that the first browser request to display the captive portal login form is a GET one, so if cpzone=.... was missing in the URL, the login form woudn't even display. So i am sure that a GET parameter cpzone exists all the time during login process (if it didn't a blank page would be displayed instead, and an error message would appear clearly in the logs)

                                anyway, doesn't really matter. Case closed, i guess.

                                1 Reply Last reply Reply Quote 0
                                • S
                                  streetsfinest @Gertjan
                                  last edited by streetsfinest

                                  @gertjan thanks for your answer!

                                  In my opinion, if there is no value in the hard and idle timeout, it means that the users will not be disconnected. Is that right? I mean, what is the default time for those two options, if i leave it blank? I have not set those two options for now:

                                  0_1546584408835_1ad3f210-ac8b-4320-9a9e-0624e0142355-grafik.png

                                  Should i set those options?

                                  F 1 Reply Last reply Reply Quote 0
                                  • F
                                    free4 Rebel Alliance @streetsfinest
                                    last edited by

                                    @streetsfinest check the validity time of your vouchers. You probably set up 1 day, so after 1 day all your users are disconnected. You can create vouchers with a much, much bigger validity time

                                    If you need multiple validity times (1 day for guests and 30 for employees for instance), well you could create multiple rolls

                                    S 1 Reply Last reply Reply Quote 0
                                    • S
                                      streetsfinest @free4
                                      last edited by

                                      @free4

                                      Yes, i have vouchers with a validity time of more than 3 month.
                                      When an employee is start working in the morning, he must always retype the voucher.
                                      So @Gertjan has the idea or give me the tip to set idle or hard timeout settings.

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

                                        Not setting an idle time and hard time out is "not recommended".

                                        And remember the subject of this thread : if you re save the portal settings, your users will have troubles re connecting (firewall rule are flushed ...).

                                        When using user/password or vouchers or then it is normal hat user have to retype their access credentials.
                                        That's what happens what you give access to "untrusted users" on an trusted network (the portal).
                                        If you trust your employees, consider using this :
                                        0_1546600730552_1a93acc6-047b-4dd4-a4a9-fce4059b63b0-image.png
                                        on a seperate portal instance.

                                        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
                                        • F
                                          free4 Rebel Alliance @magokbas
                                          last edited by

                                          @magokbas said in Any Change And Save Update Captive Portal Bug:

                                          @Gertjan:

                                          Hi,

                                          Yep, probably true. I see the same thing.
                                          This time the ipfw firewall rules are (still) destroyed, but the session stays present in captive portal SQLITE database : the user seems to be logged in but without ipfw rules they're hitting into the wall.

                                          Temporarily solution : Finish up you config, and don't change settings when users are connected  ;)

                                          yeah I am doing it right now. I can not even touch it. a very annoying situation

                                          There is now a fix avaliable for this issue: https://forum.netgate.com/topic/137824/pfsense-no-internet-when-it-is-said-you-are-connected/13

                                          S 1 Reply Last reply Reply Quote 0
                                          • S
                                            streetsfinest @free4
                                            last edited by

                                            @free4

                                            Thank you for creating this patch!
                                            Could you please explain how to install the patch?
                                            I have tried to install via the patch installer:

                                            0_1546844771105_76da9f3b-471d-486a-92e0-1ff56357a500-grafik.png

                                            0_1546844804075_118c96ee-a923-47d4-a395-bf43547c3576-grafik.png

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