MWRPHotspot
This is a package for Melbourne Wireless Nodes to implement a simple light-weight captive portal. The majority of existing captive portal applications are more comercially oriented and often require the setup of a radius server.
Latest released version is v0.8.1. Released 14/08/2006.
Typical Setup
-----------
| DHCP |
| Client |
| (Laptop)|
| |
-----------
|
|-WiFi - 'melbournewireless.org.au' Adhoc SSID (Behind NAT)
|-10.10.x.x
|
------------
| Melb |
| Wireless |
| Node |
| running |
| MWHotspot|
------------
|
|-Node Owner's wired LAN (Behind NAT)
|-192.168.x.x
|
------------
| Node |
| Owner's |
| Internet |
| NAT |
| Router |
------------
|
|-Broadband ISP connection
|-To Node Owner's Premesis
|
\/\/\/\/\/\/
/ \
\ Internet /
/ \
\ /
/\/\/\/\/\/\
|
|-Authentication between Hotspot node and wireless.org.au server
|
-----------
| WoA |
| Server |
| running |
| MW User |
| Database|
-----------
Dan's Suggested Development Roadmap
After version 0.8.1...
Solve double-NAT issue
- Most Hotspot routers will not be directly connectedto the Internet - they will be on a LAN behind a NAT router. To complete authentication, the WoA server must communicate with the Hotspot router. If the Hotspot router is behind NAT, the WoA server can't reach it. The Node Owner must set up port-forwarding on their Internet Router to allow the the WoA server access. This requirement is undesirable as it detracts from the "plug-and-playability" of the Hotspot router. To make a MW Node as easy as possible to install, it is important be able to "drop-in" the Hotspot onto any Internet-connected LAN without any configuration. We could do this two ways:
- Implement an unencrypted IP tunnel between Hotspot node and WoA Server. CIPE or OpenVPN seem good options but the Linux kernels on the node and WoA server will need support compiled in.
- Set up the Hotspot so it initiates all connections with the WoA server - after the username and password have been sent by the DHCP Client, the Hotspot contacts the WoA server with the Client's MAC address and asks if it has been authenticated.
Simple Config option
- When used with the Melbourne Wireless Firmware - at the download stage and also inside the firmware itself, there should be a simple Yes/No question: "Do you want to share your Internet Access with Melbourne Wireless members?".
- If YES:
- OLSR Dynamic Gateway plugin is activated
- If Internet is really available:
- Hotspot prompts DHCP clients with username/password
- If Internet not actually available:
- Hotspot displays Internet Not Available page
- If NO:
- OLSR Dynamic Gateway plugin is deactivated
- Hotspot displays Internet Not Available page
- Node owner can still manually add entries to the Access Control List to allow specified DHCP Clients access to the Internet
- Obviously we would need to include one or two pre-packaged configurations and answering Yes or No activates the appropriate config
- At all times (if Internet is available or not), a Guest Access option should be available - this allows a DHCP client to browse the Melbourne Wireless network. The Hotspot should only enforce this upon local DHCP clients. Routed traffic from other nodes with a 10.10.x.x destination should be allowed to pass without any splash page being displayed to them - this stops people being multi-splashed on multihop paths.
Ready for Beta users.
If you have a WRT and want to run it as a hotspot and know a little about iptables ( or want to ) then install the package and give it a try leave any questions or feedback at the bottom of this page
Hotspot
This implementation is based on a few simple concepts:
- Use of MW website sign-on to authenticate users, so you do need to have a route to the Intenet.
- Interception of incoming http requests from connected but not-signed-on users
- Modification of web server to return a 301 (redirect) instead of a 404 (Not Found) messages to "capture" a user trying to access a web page that they cannot get to because of the Node firewall.
There is a default splash page that lists terms and conditions of network access. A user may connect to the network if they agree with the T&Cs. There is also a check box to indicate if you are a Melbourne Wireless member.
The Node owner can decide what level of access (full, restricted or none) they want to grant the public and a MW member. Restricted levels of access can be set up that allow only specified services ( e.g. POP3, SSH, certain web sites).
Disclaimer
This package is not for everyone. If you know your way around iptables then you probably don't need it. It is intended for people that are not comfortable tweaking these things but want to open their node up in a controlled manner.
Also, if you try this and things go wrong I'll try to get you going again, but you may have to wait until I have time to do it. I offer no warrenty or suitability of purpose etc. etc.
If you are unsure then don't install it just now, wait until the beta testing has worked out the remaining bugs.
How it works
On boot up an init script ( S45firewall ) sets up your firewall. In the PREROUTING table it redirects all http traffic from the wireless interface to the access port of the patched httpd. This is the capture. All other traffic from the wireless interface is REJECTED.
The user is presented with a splash page (like this ). If they do not accept the T&Cs then they get a page requesting they dis-associate form the network. They will not be able to do anything as the firewall will DROP their packets.
If the user is a MW member and check the option, they will get a redirect to the MW web site and get a sign-on page. If they correctly sign on then the firewall will be modified to allow them through.
A member of the public does not have to sign-on, once they accept the T&Cs they get re-directed to a welcome page ( like this ) that lets then know what access they have.
Once the user has been added to either the public_users or member_users table then they are able to access the network and services as defined for the group they are in.
What is involved
- Simple init script to set up the firewall
- Some commands for adding and removing users from iptables
- Some web pages and some cgi-scripts
- A modified (tiny) httpd to handle the captured users
- You will need the ip-tables mac module in your Linux distribution. There are two parts of this, 1) the kernel module ipt_mac.o and 2) the iptables loadable module
Firewall
If you are running the hotspot package then it becomes your firewall. It is configured using iptables and is very tight. You choose what ports and services you want to allow each class of user. See MWRPfirewall for a more detailed description and hints on how to set it up if you have a different arrangement of ports and interfaces.
Platforms
OpenWrt package
The Beta version is available to download. You can download it and install from a local machine or run
ipkg install http://melbournewireless.org.au/files/wrt54/Packages/mwhotspot_0.8.1_mipsel.ipk
Once installed it will add Melb Wireless to your packages and you can install updates easily by entering
ipkg update
ipkg mwhotspot
Other Linux
There is a general tarball that you can download and install. There are only a few moving parts so it's not that dificult. Included is a tiny httpd for x86 that will be installed with the tarball. This can be run on a non-standard port allowing the "captured" http requests to be processed correctly while signed-on users cold access web content from a regular (un-modified) web server.
CVS access
CVS access is available. Use the following:
$ export CVSROOT=:pserver:anoncvs@wireless.org.au:/var/cvs
$ cvs checkout mwrp
Non-Linux
Sorry, this is based around manipulating the netfilter parameters using iptables.
Customization and configuration
Once the package is installed there is a simple shell script menu ( /bin/hotpot/menuconfig ). Running this script will generate your hotspot configuration data.
- /etc/hotspot/hotspot.cfg, configuration env vars used by S45firewall
- /etc/hotspot/hotspot.acl, pre-defined mac addresses and their acess groups
- /etc/hotspot/hotspot.ports, open ports for member and public groups
You can run the script as may times as you want, at any time. The changes will not come into effect until the S45firewall is reloaded ( either by running it from the command line or rebooting ).
Melbourne Wireless hotspot
Configuration Menu
------------------
1. Select Zones
2. Configure Zone
3. Manage ACL
4. Configure ports
5. Exit, Save changes
6. Quit Don't save
-------------------
make selection (1-6)
1. Select Zones
You are presented with the names of the four configurable zones here:
- LAN, the public zone your hotspot will expose
- WAN, the zone of the Internet connection if connected directly
- PRI, your private LAN zone if the node is connected to one
- DMZ, your DMZ segment if you have one ( this is not coded out yet)
You need to select the zones you want first before doing any further configuration.
2. Configure Zone
For each of the zones you selected in part 1. of the menu there are a number of configuration parameters that need to be captured. A simple set of questions ask for the name of the interface (i.e. br0, vlan1, eth1) IP addresses and other configuration information needed for the hotspot and firewall only. This will not do any configuration of the NVRAM variables, interfaces or routing and bridging. If you try to configure a zone and get a message indicating the zone is not configured go back to !. Select Zones and re-select the zone.
3. Manage ACL
A privileged user is one that does not have to go through the capture process, i.e. your own laptop machine. Using this mechanism I have turned of the AP I was using internally as my laptop can now just pass through my MW Node instead.
Privileged users information is maintained in the file /etc/hotspot/hotspot.acl. A line in this file looks like this:
<mac address> <hostname> <group> <access>
00:03:23:d3:b1:34 myhotspot1 owner allow
00:30:45:ea:2d:f7 badguy public deny
4. Configure ports
In this menu section you are able to select the access to grant MW members and the general public ( full, restricted, none). If restricted access is selected then you are prompted for ports that should be open for this group of users.
A future enhancement will make this a bit easier to use and allow you to capture IP addresses or address ranges.
Moving capture httpd to non standard port
The httpd that is provided in the package is a very lightweight one. For a full linux distribution you probably want to keep using your existing web server and should just run the tiny httpd on a different port.
Using menuconfig select Configure Zones and LAN zone. One of the options there will be for setting the port used by the capture httpd. Changing this option to another number will set an environment variable 'HS_LAN_CAPTURE_PORT that is used by both the S45firewall and the S50httpd scripts.
In the S45firewall script
$IPT -t nat -A PREROUTING -p tcp --destport 80
-j DNAT --to ${NETIP}:${HS_LAN_CAPTURE_PORT:-80}
In the S50httpd script
grr- example here breaks wiki page formatting
All unauthorized user traffic will get captured in PREROUTING and redirected to port 8086. Once the user is authorized then they will get ACCEPTed in PREROUTING before this line so their port 80 traffic will be unaffected.
Problems
Internet connection
When configuring the script if you are not connected to the internet then you may not be able to correctly resolve names. The router should be configured as a DNS proxy and the DHCP server should have the appropriate options configured to tell DHCP clients to use the router as the DNS resolver. The firewall script is set up to allow icmp, dhcp and dns traffic from the public LAN segment to the router rather than forward it to other devices.
Limited set of ports able to be opened for members and public users
This was a first pass list any ports you think should be included in the menu and I'll add them. I could also add a little bit of code to add any port I suppose.
Beta testing comments & questions
Excellent work Dave - I've just installed it on a WRT54G v3.1 running WhiteRussian RC4. Just one thing - RC4 now has it's own web interface "webif" that also uses /www/index.html on the default port. I had to remove the "webif" package before I could install MWRPhotspot.OK, There is no reason we need to re-direct to index.html, will try it out with a different name to avoid confusion
The splash page should probably appear on port 80 on the wireless interface whilst the admin webpage should appear on port 80 the lan interface. Likewise, port 8086 could be used as an "obscure port" to allow the admin to see the admin webpage via the wireless interface, and to preview the splash page on the LAN port will make this configurable
To summarise my recommended defaults:
On the Public WIFI (and maybe WAN) interface:
Port 80 - mwhotspot (redirect to 8086), Port 8080 webif
On the Private LAN interface:
Port 80 - webif, Port 8086 mwhotspot - no redirect
- Another thing - the scripts are in /bin/hotspot, but the package does not append /bin/hostpot to the $PATH, so the menuconfig script fails unless you modify $PATH manually. I was wondering if they should just be in /bin or /usr/bin to avoid this issue
- With the Select Zones bit - perhaps have preset defaults already set, and display these zones at the top menu. once you have runit the first timethere are default values for each parameter. Perhaps I should include a default/example hotspot.cfg so there are defaults the first time through
- With Configure Zones - everything I select says "XXX zone not configured" - do I need to do something else before configuring zones? Other than that, I like the submenu structure here. You need to select the zones under option 1. first, then you can configure the ones you selected
- What does ACL mean? Access Control List I suppose, but this might be intimidating for some users - perhaps some docs here . Also, when you display this page, show the existing ACL entries - or maybe even on a "status" page that displays all the current settings. once you have configured some then you get walked through the list with a keep/discard choice. May be able to make this clearer
- Can we have a menu option to change the IP address/web address that the user is redirected to? At the moment it wants to go to 10.10.1.65 and it's hard-coded into index.html. The address is in index.html but that should get patched during the install. In the postinstall script as part of ipkg your lan_addr should be set from the nvram variable. I probably need to run this patch each time you run the configuration script
Since OpenWRT now has a web interface, It'd be nice if these menuconfig scripts were web-based also. I believe webif has been designed for "plug-in" interfaces for other packages. The script based menu was easy for me- non-web person to offer configuration for the masses. All it does is set variables in files that are used by the other parts of the package. A web knowledgable person should be able to do the same in a few hours using the script as a template
In general, this package is a corker - it is already much better than NoCatSplash - which I've used and had all sorts of trouble with.
It'd be nice if the config scripts could do a bit of autoconfiguring - i.e. doing ifconfig and iwconfig and working out what interface is what - and presenting these interfaces to the user and ask him/her which is public or private. Under Openwrt, having the public wireless interface separate from the LAN would require breaking the bridge - perhaps we could distribute a package that does this automatically by setting the appropriate NVRAM vars - with the appropriate warnings and "are you sure" dialogs. yeah, We almost ask all the right questions. I can do the auto config in the next pass. Wanted to get this bit locked down before moving forward though.
A package like this raises a couple of political points too - do we want to say that Internet access is being provided by Melbourne Wireless? I notice that the terms and conditions are a bit of a cut and paste job - but that's OK I understand it's beta software. We should sit down and discuss what we want the splash page to say. I Defer to the comittee on this. It can say whatever they want it to say. I will add a choice of splash to the config menu so we can have the theemes as you have suggested
My personal view is that perhaps in the future the package should be "themeable" - and that the Melb Wireless look should be one of many themes. the default theme should be a generic splash page with generic T&Cs. yep - will do
But once again, great job! thanks! - happy to help move the ball forward here
Version 7 (current) modified Mon, 26 Jul 2021 12:49:29 +0000 by
Dan [EditText] [Spelling] [Current] [Raw] [Code] [Diff] [Subscribe] [VersionHistory] [Revert] [Delete] [RecentChanges]