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

    Has anyone been able to get CP working flawless on iOS and Mac devices?

    Scheduled Pinned Locked Moved Captive Portal
    30 Posts 7 Posters 6.0k 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.
    • GertjanG
      Gertjan
      last edited by

      I checked with the captive portal web server logs.
      Something is new.

      I connect to the portal - the entire "DHCP" session goes well.
      My iPhone obtains an Ipv4 : 192.168.2.167 (which is not a static lease, I do not have to on my portal)

      The, the captive portal magic kicks in:
      My device (iPhone) has established the wifi connection, an IP has been obtains.
      iOS checks if it has a open to "http://captive.apple.com/hotspot-detect.html" :
      05-29-2016 09:02:55 Local5.Info 192.168.1.1 May 29 09:03:01 pfsense.brit-hotel-fumel.net nginx: 192.168.2.176 - - [29/May/2016:09:03:01 +0200] "GET /hotspot-detect.html HTTP/1.0" 302 0 "-" "CaptiveNetworkSupport-325.10.1 wispr"

      It's redirected to (302) to
      05-29-2016 09:02:56 Local5.Info 192.168.1.1 May 29 09:03:02 pfsense.brit-hotel-fumel.net nginx: 192.168.2.176 - - [29/May/2016:09:03:02 +0200] "GET /index.php?zone=cpzone1&redirurl=http%3A%2F%2Fcaptive.apple.com%2Fhotspot-detect.html HTTP/1.0" 200 1504 "-" "CaptiveNetworkSupport-325.10.1 wispr"
      [my pfSense Captive portal] : /index.php?zone=cpzone1&redirurl=http://captive.apple.com/hotspot-detect.html HTTP/1.0"

      Now, the strange part - this is new : My device launches another GET to
      http://captive.apple.com/hotspot-detect.html :
      05-29-2016 09:02:56 Local5.Info 192.168.1.1 May 29 09:03:03 pfsense.brit-hotel-fumel.net nginx: 192.168.2.176 - - [29/May/2016:09:03:03 +0200] "GET /hotspot-detect.html HTTP/1.1" 302 5 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13F69"

      and of course, pfSense replies with another instance of the login page :
      05-29-2016 09:02:57 Local5.Info 192.168.1.1 May 29 09:03:03 pfsense.brit-hotel-fumel.net nginx: 192.168.2.176 - - [29/May/2016:09:03:03 +0200] "GET /index.php?zone=cpzone1&redirurl=http%3A%2F%2Fcaptive.apple.com%2Fhotspot-detect.html HTTP/1.1" 200 844 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13F69"

      My style.css get loaded :
      05-29-2016 09:02:57 Local5.Info 192.168.1.1 May 29 09:03:03 pfsense.brit-hotel-fumel.net nginx: 192.168.2.176 - - [29/May/2016:09:03:03 +0200] "GET /captiveportal-style.css HTTP/1.1" 200 836 "https://portal.brit-hotel-fumel.net:8003/index.php?zone=cpzone1&redirurl=http%3A%2F%2Fcaptive.apple.com%2Fhotspot-detect.html" "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13F69"

      My device tries another test to http://captive.apple.com/hotspot-detect.html :
      05-29-2016 09:02:57 Local5.Info 192.168.1.1 May 29 09:03:03 pfsense.brit-hotel-fumel.net nginx: 192.168.2.176 - - [29/May/2016:09:03:03 +0200] "GET /hotspot-detect.html HTTP/1.0" 302 0 "-" "CaptiveNetworkSupport-325.10.1 wispr"

      pfSense replies to it with another instance / login session :
      05-29-2016 09:02:58 Local5.Info 192.168.1.1 May 29 09:03:04 pfsense.brit-hotel-fumel.net nginx: 192.168.2.176 - - [29/May/2016:09:03:04 +0200] "GET /index.php?zone=cpzone1&redirurl=http%3A%2F%2Fcaptive.apple.com%2Fhotspot-detect.html HTTP/1.0" 200 1504 "-" "CaptiveNetworkSupport-325.10.1 wispr"

      I entered my login credentials, and validate (POST) :
      05-29-2016 09:03:22 Local5.Info 192.168.1.1 May 29 09:03:28 pfsense.brit-hotel-fumel.net nginx: 192.168.2.176 - - [29/May/2016:09:03:28 +0200] "POST /index.php?zone=cpzone1 HTTP/1.1" 302 5 "https://portal.brit-hotel-fumel.net:8003/index.php?zone=cpzone1&redirurl=http%3A%2F%2Fcaptive.apple.com%2Fhotspot-detect.html" "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13F69"

      and I reclick on "Enter", which generates another POST :
      05-29-2016 09:03:33 Local5.Info 192.168.1.1 May 29 09:03:40 pfsense.brit-hotel-fumel.net nginx: 192.168.2.176 - - [29/May/2016:09:03:40 +0200] "POST /index.php?zone=cpzone1 HTTP/1.1" 302 5 "https://portal.brit-hotel-fumel.net:8003/index.php?zone=cpzone1&redirurl=http%3A%2F%2Fcaptive.apple.com%2Fhotspot-detect.html" "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13F69"

      and I past the login procedure.

      When I do not "double click" on the "Login button" on the captive portal login page, after the first time, it times out with
      https://goo.gl/photos/vrhn6SU4xYf17tWn9

      I tracked down the first occurrence in my pfSense captive portal sever logs : April 14, 2016.
      That was the day I installed 2.3-RELEASE which came out the day before, April 12, 2016 ….. that was the day httpd was switched for ningx, right ?

      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
      • DerelictD
        Derelict LAYER 8 Netgate
        last edited by

        Still impossible to tell what is going on.

        Do a Diagnostics > Packet Capture while executing the exact same procedure. In the previous case you would filter on 192.168.2.176 in Host Address.

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

          I have the same problem. On all devices - not exclusively on an apple device - you need to press the "submit" button two times to get redirected. It wasn't a problem previous to version 2.3

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

            Still need a packet capture.

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

              I can't upload .cap files. The results of "packets captured" I put into a txt file.

              packetcapture_device.txt
              packetcapture_pfsense.txt

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

                Not enough detail and what are we looking at? What IP address is the specific client in question?

                Identifying the specific times you were taking the various steps would help too.

                Uploading pcaps would be better. If this site won't take them put them somewhere else.

                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
                • DerelictD
                  Derelict LAYER 8 Netgate
                  last edited by

                  @sbb:

                  I can't upload .cap files. The results of "packets captured" I put into a txt file.

                  Please at least put level of detail to full.

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

                    Thanks for your fast reply.

                    Device with IP 192.168.2.76:
                    http://www.file-upload.net/download-11627596/packetcapture_device_192168276.cap.html

                    Pfsense machine with IP 192.168.2.254:
                    http://www.file-upload.net/download-11627597/packetcapture_pfsense_1921682254.cap.html

                    1 Reply Last reply Reply Quote 0
                    • ?
                      Guest
                      last edited by

                      Have you tried changing the default login page by something more 2016ish ?

                      Since version 2.3 in the code of the login page must be placed a string of code that is there in the
                      default login page!!!! Otherwise you all will be getting problems with;

                      • pfSense updates/upgrades (particularly)
                      • Login of some CP guests

                      I was reading this in another german speaking forum I´ll try to find it back for more assistance
                      and/or the code string that is needed. I am not really sure if this helps you out here, but it can
                      be, so please don´t bother with me if this is not really 100% matching.

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

                        Test it again.

                        But this time, before pressing login a second time, check the captive portal sessions and see if the session was actually logged on. It looks to me like it will be. So instead of just pressing login a second time, bring up a web browser and try a site instead.

                        This is not a fix, but will confirm you're not dealing with a captive portal login problem but a site redirection problem instead.

                        The device capture you sent shows a redirect to htv-tennis.de.

                        The pfSense capture you sent shows a redirect to spiegel.de

                        Why are they different?

                        This is sent to the client after each login page POST.

                        HTTP/1.1 302 Moved Temporarily  (text/html)

                        Looking at the client capture, after the first redirect is sent the client just sends a "GET / HTTP/1.1" to 212.223.29.33 without establishing the TCP connection first (packet has PSH,ACK flags) so it either thinks it already has a session established or the client is broken. As far as the firewall is concerned, this is out-of-state traffic, will be blocked, and will probably show up in the firewall logs with TCP:PA flags. This connection attempt is retransmitted three times then reset a couple seconds later.

                        Then the client does the second login POST. The same HTTP 302 is sent by the portal. This time the client establishes a TCP session to the destination by issuing a SYN. This time it looks like it works.

                        There is not enough detail to see exactly what is happening but it initially looks to be a client problem. Maybe nginx is doing something different enough to make it fail but the same redirect is being sent to the client both times - I wonder if there is some sort of HTTP streaming mode that should be disabled on the portal server instance that forces clients to issue new TCP SYNs for every page request or something. A more complete packet capture will show whether the initial HTTP GET by the client after login is part of the pre-login TCP session that was initially intercepted by the portal.

                        I think the device capture is the only one necessary. Set the count to zero and capture the entire session. Turn off wi-fi on the device, delete the portal session if any, turn on capture, then turn on the device wi-fi. Don't stop the capture until the actual destination page at least starts to load.

                        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
                        • DerelictD
                          Derelict LAYER 8 Netgate
                          last edited by

                          I wonder what keepalive_timeout 0 in he portal's nginx.conf file would do here.

                          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
                          • GertjanG
                            Gertjan
                            last edited by

                            @Derelict:

                            But this time, before pressing login a second time, check the captive portal sessions and see if the session was actually logged on. It looks to me like it will be. So instead of just pressing login a second time, bring up a web browser and try a site instead.

                            This, I checked - and you're right.

                            After the first click (using capturing) I saw the POST from /index.html coming by, and pfSense confirmed me at the "Status -> Captive portal" page that the device WAS connected (or : the needed firewall rules were inject, all communication was possible to the net, etc).
                            Still, the "cripled-browser" that the iPhone uses (I don't recall the exact name of these kind of special login-browser) keeps spinning around.
                            And finally it times out with some completely non-related error about the AP.
                            Before, it showed pretty instantly the word "Succes" which is the result of GETting a page at portal.apple.com.

                            Btw : My AP's (Linksys WRT54xx séries, among others), are all working flawlessly the last 5 ? 6 or 7 years.

                            Anyway, I know now how to capture. I'll make some captures tomorrow.

                            I also bring my iPad (very old so no latest iOS) to see if this one connects fine (which could indicate : recent iOS issue).

                            @BlueKobold:

                            Have you tried changing the default login page by something more 2016ish ?

                            Since version 2.3 in the code of the login page must be placed a string of code that is there in the
                            default login page!!!! Otherwise you all will be getting problems with;

                            • pfSense updates/upgrades (particularly)
                            • Login of some CP guests
                              …

                            You mean this :

                            I confirm this is what I use in my own page - but, I'll be using the default pages for testing.

                            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
                              sbb
                              last edited by

                              @Derelict:

                              Test it again.

                              But this time, before pressing login a second time, check the captive portal sessions and see if the session was actually logged on. It looks to me like it will be. So instead of just pressing login a second time, bring up a web browser and try a site instead.

                              This is not a fix, but will confirm you're not dealing with a captive portal login problem but a site redirection problem instead.

                              Yeah same like Gertjan said. I am logged in after the first time cklicking the submit button. I can visit other sites, so it's a redirect problem.

                              @Derelict:

                              The device capture you sent shows a redirect to htv-tennis.de.

                              The pfSense capture you sent shows a redirect to spiegel.de

                              Why are they different?

                              I visited different sites when capturing the IP adress of the device and the ip adress of the pfsense machine.

                              @Derelict:

                              I think the device capture is the only one necessary. Set the count to zero and capture the entire session. Turn off wi-fi on the device, delete the portal session if any, turn on capture, then turn on the device wi-fi. Don't stop the capture until the actual destination page at least starts to load.

                              Here is a new caputure: http://www.file-upload.net/download-11630451/packetcapture.cap.html

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

                                Please excuse if this is way off, but: do you see blocked packets in the firewall log (dropped by the default rule)?
                                Then it might be somehow the same as this: https://forum.pfsense.org/index.php?topic=111964

                                Because it would match the general setup - first opened page (that will get redirected) is same as after auth (that should go through), because it is both times the captive portal detection from Apple. If the connection is dropped, it seems like you have not authenticated - the second click on the login button builds a new connection, which will go through (as will any other new connection).

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

                                  @skron:

                                  Please excuse if this is way off, but: do you see blocked packets in the firewall log (dropped by the default rule)?
                                  Then it might be somehow the same as this: https://forum.pfsense.org/index.php?topic=111964

                                  Because it would match the general setup - first opened page (that will get redirected) is same as after auth (that should go through), because it is both times the captive portal detection from Apple. If the connection is dropped, it seems like you have not authenticated - the second click on the login button builds a new connection, which will go through (as will any other new connection).

                                  yeah you could be right. I dunno how to export the firewall log. I tried to wait a longer time after clicking the submit button and I did get redirected. So exactly what you described in the other thread. The problem is users don't wait such a long time. A work around could be that I also define a "After authentication Redirection URL".

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

                                    Derelict nailed it.
                                    https://forum.pfsense.org/index.php?topic=112594.msg627568#msg627568 is the solution.
                                    No more "double click", after hitting the logging button, the "Succces" from captive.apple.com will show right away  :D

                                    Btw : It's NOT a firewall, issue - mine didn't change the last several years - its a web server (nginx) setup issue, in combination with iDevices.

                                    Derelict will post more info soon.

                                    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
                                      sbb
                                      last edited by

                                      @Gertjan:

                                      Derelict nailed it.
                                      https://forum.pfsense.org/index.php?topic=112594.msg627568#msg627568 is the solution.
                                      No more "double click", after hitting the logging button, the "Succces" from captive.apple.com will show right away  :D

                                      Btw : It's NOT a firewall, issue - mine didn't change the last several years - its a web server (nginx) setup issue, in combination with iDevices.

                                      Derelict will post more info soon.

                                      I did change keepalive_timeout to 0 also but it didn't work for me. Maybe I am doing something wrong

                                      edit: works now! I killed the captiveportal.pid again and that did it. But I am afraid every time you edit the captive portal page keepalive_timeout resets to "65". I think Derelict will clarify and write an instruction how to solve it (he pmed me that instruction)

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

                                        I'm pretty sure this will only happen if the initial URL attempted is the same as the redirect URL after authentication. Else a new TCP session will be established and the keepalive will be irrelevant.

                                        https://redmine.pfsense.org/issues/6421

                                        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
                                        • GertjanG
                                          Gertjan
                                          last edited by

                                          @Derelict:

                                          I'm pretty sure this will only happen if the initial URL attempted is the same as the redirect URL after authentication….

                                          I do not redirect, leaving it up to the initial http request where the visitor goes after authentication.

                                          redir.png
                                          redir.png_thumb

                                          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
                                            skron
                                            last edited by

                                            @Derelict:

                                            I'm pretty sure this will only happen if the initial URL attempted is the same as the redirect URL after authentication. Else a new TCP session will be established and the keepalive will be irrelevant.

                                            https://redmine.pfsense.org/issues/6421

                                            Yes, that would explain both issues - the one here, and the one in the linked thread.

                                            In case of the iOS/mac devices, it is the device itself opening the the same URL before/after auth (for CP detection) with the initial request.

                                            Thanks for looking into and opening a new bug on this!

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