Raspberry connecting to WIFI with captive portal - authentication

Currently I have learned how to config my Pi to connect to the WIFI with or without a password, however when I wanna use the WIFI in, say a coffee house or a hotel, where the WIFI provided requires logging on a captive portal to get to use it, I know that with a browser it could be easy to do it since the login page appears right up as you open the browser, but how can I do it with my Pi through the command line?
Thank you.

Assuming you are not asking how to script repeatedly connecting to a certain captive portal (this could potentially be accomplished with curl), you probably want to use a text-based web browser like Elinks or Lynx.

Related

localhost and 192.168.x.x over HTTPS for a-frame webVR development and local testing

I'm trying to develop a A-frame-based VR experience.
I can test it on my mac via http://localhost but can't do the same using mobile phone or VR headset via http://192.168.1.123.
The problem is that those browsers demand that the page is served over HTTPS rather than HTTP, otherwise it denies access to the device motion sensor, making testing impossible.
Using the following instructions, I managed to successfully have my VR web page served over with a valid certificate.
https://www.freecodecamp.org/news/how-to-get-https-working-on-your-local-development-environment-in-5-minutes-7af615770eec/
https://github.com/mattdesl/budo/blob/master/docs/command-line-usage.md#ssl-and-https
But, that is not enough, mobile device and headset access the page over a local-wifi IP like 192.168.1.123 rather than localhost and the ssl certificate doesn't seem to work for those, even if i replace localhost by the correct IP when generating the domain key & certificates.
i guess each device browser would need to have its trusted store updated or something...
Would be curious to know how people solved their problem in their a-frame local development and testing flow.
Partial answer -- for Oculus Quest or Go browser development at least.
You can use the Chrome remote device debugging tools:
https://developer.oculus.com/documentation/oculus-browser/browser-remote-debugging/
Then setup port forwarding for the remote device:
https://developers.google.com/web/tools/chrome-devtools/remote-debugging/local-server
This method allows you to sidestep the whole certificate thing since you can still use localhost:port to which the browser grants appropriate device permissions.
Since you can't use IP numbers, you want to include your local domain name into the certificate, like this:
https://stackoverflow.com/a/10176685/573216
Worked for me in a similar context.

Setting a remote authentication server on a router

I'm looking for a way to set an external authentication server that will work on many/most wireless routers. Or , alternatively several ways that will work on different wireless routers. It needs to be done programmatically, meaning, that a computer connected to the router needs to be able to use some api maybe to do this.
I don't know if this is possible, I tried to find answers on Google, but with limited knowledge, I'm not sure that I'm even looking in the right place.
What I'm trying to achieve:
I'm trying to create an application that will allow people to open there WIFI so other people can borrow it.
The ide is:
To borrowed wifis:
Create an account with the application.
Log into the application. This app will, when you are logged in, automatically connect you to a wifi nearby that is shared. The share wifi will only be accessible if you have a valid username-password combo with the application
To share your wifi:
From the same application, you go into some menu and press "share this wifi", and somehow, I need this to configure the currently connected router to use the an external authentication server as well as the current WIFI key. So that, people can essentially use their the application username-password combo to log into this router.
Any help is appreciated.
Try google-ing for Radius Server , WPA(2) Enterprise , or 802.1x.
These keywords are very related.
To setup a radius authentication you need to have a router which supports wpa(2) enterprise and a radius server (probably google-able how to setup on windows/linux).
Programmatically connecting is possible, only a bit more difficult because it uses wpa(2) enterprise authentication.
If you could supply some more details i should be able to help you further.

Embedded wifi device that can accept terms on a captive portal?

I'm building out an IoT solution for a client and the network admins are insisting that the devices only connect through the guest network, which has a captive portal with terms of service that must be accepted with a UI button press before gaining external internet access. Most IoT Solutions I've looked at so far (electric imp, Spark core) explicitly state that they cannot connect to a captive portal. I've seen other higher-level code for automatically interacting with a captive portal but I have not found a solution that allows an embedded wifi device (like the CC3000) to automatically accept terms on a captive portal.
Has anyone seen or built a custom wifi stack for something like the CC3000 that can recognize and interact with a captive portal? is there another embedded wifi solution (xbee wifi maybe?) that has had success in this area?
I wouldn't solve this problem in the stack. I would go for a high-level code executed automatically after connecting to the network. Some simple script for example which automatically "presses the UI button" for you. Depending on the design of that page this may be as simple as a single http-request.
Another solution (maybe): Depending on the Wifi-Modules you've chosen the MAC-Addresses of your devices are predicable. Maybe the network admins can add a rule to their config to allow these devices on their guest network without the need of that captive portal.
After considering all options, I believe we are going to go embed the behavour into the SparkCore firmware and insert a captive portal check in the wifi connection code.
spark_utilities.cpp line 807 (Internet_Test function)
https://github.com/spark/firmware/blob/master/src/spark_utilities.cpp#L807

Which Google OAuth Flow is good for web application not reachable from the internet?

I wrote a small application which needs access to Google API with OAuth2 and which is typically run on maybe a Raspberry Pie to reduce power consumption since it needs to run pretty much 24/7. The device my application runs on is typically connected a LAN at home.
The user controls the application using a web interface from a PC/Tablet/... in the same network. However the web application is reachable from the LAN only, it cannot (and should not for security reasons) be accessed over the Internet, because it hides behind a NAT and/or a firewall.
The documentation states that I have the following options:
Web server applications
This forces me to use a redirect URL which must be known in advance. Since my app is most likely accessed by a dynamic private IP address, there is no way I know the URL in advance.
Installed applications
Yes, that would work. I just need people to copy and paste the returned code into a web form of mine. However that is somewhat uncool.
Client-side (JavaScript) applications
This does not give me a refresh token which I totally need.
Applications on limited-input devices
Polling? Well... If it works... However it requires the user to match a code shown on the device with a code displayed in the webbrowser. If I use that I can just as well ask the user to copy&paste the code returned by the installed app mode.
As far as I can see the copy&paste the code with installed app is my best chance. Is it really? Or is there is possibility to get along without that bit?

AOL desktop sign in on wireless network

I don't know why? Whenever I install AOL desktop (9.5, 9.6, 10.0) on my computer and I'm connected to the internet using cable, every thing is ok. I can browse websites and sign in to AOL.
But whenever I connect to the internet using my wireless network at home, I can not sign in to AOL, but I can still browse the web.
My wireless network uses WPA2-Personal with AES encryption type.
I always get the AC-3000 error message whenever I want to sign into AOL. None of AOL solutions could be useful to solve this.
What do I have to do ?
You didn't mention what version of windows you are using but my suspicion would be that if you are on Windows Vista/7 then the cable connection is identified as "home" or private and that the wireless connection is identified as public and the AOL connection (which used to be on port 5190 IIRC) is getting blocked as a result.
If I am right, to change what apps have access on which network types, you can follow the instructions here:
http://www.addictivetips.com/windows-tips/how-to-stop-a-program-from-gaining-unsolicited-internet-access-in-windows-7/
Although it is about how to stop a program from accessing the internet, it works just as well the other way around ;)
You could use netstat to determine what the successful connection to AOL is on the cable set up in terms of destination and IP and then attempt a simple telnet connection to the same address/port on the wireless set up to verify if this is blocked at the network/port level or if it is blocking the application (usually referred to as ACS). If the telnet connection succeeds and does not timeout, then it is an application level restriction which you will need to fix .