Splines / raspi-captive-portal

⚡ A Captive Portal & Access Point setup for use with the Raspberry Pi (no Internet access)
https://dominicplein.medium.com/captive-portal-access-point-on-the-raspberry-pi-easy-setup-28a9bf72e998
MIT License
29 stars 7 forks source link

Conflicts generated by setup.py, problem with hyphen in password "splines-raspi" #4

Closed ballen4705 closed 6 months ago

ballen4705 commented 1 year ago

Platform is RP4b with latest stock bullseye 64-bit lite distribution.

Two issues are reported here.

(1) Running setup.py generates two conflicts. See attached transcript of stderr and stdout.

      ibnode72 : Conflicts: nodejs-legacy
      nodejs : Conflicts: npm)

(2) I was unable to connect to the AP using the password splines-raspi. The problem is with the hyphen. I suspect that if the default character set on the computer is different than on your systems, the hyphen has another representation. An easy fix is to change the pw in /etc/hostapd/hostapd.conf to splines1.

[EDIT] Examining /etc/hostapd/hostapd.conf with od -a and od -x does not reveal anything odd. The hyphen/minus is correctly encoded as one byte containing 0x2d. But it's also clear that eliminating this character from /etc/hostapd/hostapd.conf solved the problem. I wonder if my iPhone is somehow encoding that symbol differently than expected by hostapd when it is authenticating. Or if some other element in that chain of communications is adding its own encoding info.

Even better, eliminate these four lines from /etc/hostapd/hostapd.conf:

       wpa=2
       wpa_key_mgmt=WPA-PSK
       rsn_pairwise=CCMP
       wpa_passphrase=splines1

This gives access without a password.

Attached is the output of python setup.py 2>&1 | tee ../transcript.txt, run as root. transcript.txt

Below, inline, is a description of my install.

Cheers, Bruce

(1) Image & verify Bullseye 64-bit lite (3 May 2023)

(2) Boot RP4B with monitor and ethernet select keyboard type (UK, mac) enter username/pw

(3) login as normal user ifconfig to verify that ethernet is running (not wifi)

(4) sudo su apt-get update apt-get upgrade apt install git raspi-config, enable ssh reboot

(5) login as normal user sudo su git clone https://github.com/Splines/raspi-captive-portal.git cd ./raspi-captive-portal python setup.py 2>&1 | tee ../transcript.txt (answer Y twice to questions) (note warnings that "apt does not have a stable CLI, use with caution in scripts) (note warnings libnode72 : Conflicts: nodejs-legacy, nodejs : Conflicts: npm)

(6) I was able to find the Splines Raspi AP No PW was needed I was correctly redirected to the web page Then the connection was dropped by my iPhone Note that on the webpage the Endpoint /api/ping test: showed "...". Not sure if this is correct

(7) rebooted switched phone into "airplane" mode to eliminate telephone network found Splines Raspi AP advertised on wireless use pw "splines-raspi" got "incorrect password" error looked in raspi-captive-portal/access-point did not find server/src/server.ts as described in docs I did find hostapd.conf which contained wpa_passphrase = splines-raspi check with sysctl status hostapd showed that hostapd is using /etc/hostapd/hostapd.conf, which matched raspi-captive-portal/access-point/hostapd.conf

(8) Modified PW in /etc/hostapd/hostapd.conf and in ~/raspi-captive-portal/access-point/hostapd.conf to read "splines1" rebooted it now works correctly

(9) Eliminate these four lines from /etc/hostapd/hostapd.conf for access without a pw: wpa=2 wpa_key_mgmt=WPA-PSK rsn_pairwise=CCMP wpa_passphrase=splines1

[EDIT]

I did experimented with changing the locale on my system, and then going through the installation procedure. With that, I was able to also login using the splines-raspi password. I have no idea what the source of the problem is, but simplifying the password by eliminating the hyphen might be a good idea.

An additional question. I'm not a java programmer, so the biggest hurdle to putting this to use in my own project is that I have a webserver built with python, similar to this: https://pythonbasics.org/webserver/ . (I've also done stuff with apache/php in the past, but that's more complicated.) Some simple https examples are here: https://anvileight.com/blog/posts/simple-python-http-server/#:~:text=The%20standard%20Python%20library%20has,minimalistic%20HTTP%2FHTTPS%20web%20server.

Could you say something about how to modify your code base for this? Or alternatively, could you modify your landing page by adding an input field and a button and using these to execute a simple script or run some code on the Pi? This provides a good starting point for extending it further.

By the way, I'm not sure if the API/ping test is supposed to "do something". The landing page just displays fixed text. Should I see something happen, i.e. some activity?

Splines commented 1 year ago

Thanks a lot for your findings, Bruce @ballen4705 . I haven't yet found the time to look into this in detail but will do so eventually ;) (hopefully within the next two weeks).

ballen4705 commented 1 year ago

Ok, thanks. Please let me know if any further information would be helpful.

Splines commented 6 months ago

Sorry for the very, very late reply. I finally found some time to tackle the issues you've described. Respective fixes are available in the new v1.0.1 release of this repo 🙌.

See the release info for more information.