789
Posts: 2
Joined: Sun May 08, 2016 9:44 pm

Hostapot with login page

Mon May 16, 2016 10:36 pm

Hey all!
I'v just managed to make my raspberry pi into a hotspot, and all it working.
I also installed an apache on my pi, so when connected devices browse for 10.10.0.1 (my pi's address - the default gateway) they can see the login webpage I made.

I followed this tutorial to make the captive portal: https://projectzme.wordpress.com/2012/0 ... -on-linux/

I made that all connections to http, we be re-directed to my login page at 10.10.0.1 (according to the link above)
I wanted to re-direct also all https pages back to my page at 10.10.0.1 by adding the rules:

Code: Select all

sudo iptables -t mangle -A PREROUTING -i wlan0 -p tcp -m tcp --dport 443 -j internet

Code: Select all

sudo iptables -t nat -A PREROUTING -i wlan0 -p tcp -m mark --mark 99 -m tcp --dport 443 -j DNAT --to-destination 10.10.0.1
I have a couple of questions:
1. re routing for https (port 443) doesn't work. It will either not return anything (making chrome say it can't get the page) like when browsing for https://cbs.com, but when browsing for https://google.com - it works fine, even if I didn't go to the login page!
Are the rules I added are wrong? or is it that an https request can't receive http?

2. The routing works if I put a https address (like cbs.com) but when browsing for a page (like http://www.cbs.com/shows/2016-finales/p ... and-molly/) it's says that the apache server on the pi can't get this page.
Why doesn't it just re rout?
3. The blocking rules are only redirecting (and effectively blocking) http, but all other ports are working.I tried

Code: Select all

ping 8.8.8.8
in my WIN10 PC, and it worked ok. How can I block all the ports until the user loges in?

4. In the given link above, it says that to stop the redirection, I need to run the

Code: Select all

rmtrack
script. But when I run it in my login page (in the background) it just get stuck, but all the same, I can browse the internet without ant problem. I this script needed? why does it get stuck?


Thanks!

Return to “Beginners”