|
Some of this is just going to be a repeat from my pre-release post, but since this is the full release, I feel I should put it all here anyway. Before I get too far into this, I will state this: this is a dual-numbered release. It is numbered 0.3 for my OSD600 course, but since this is the first release that is actually close to the original idea (0.1 and 0.2 were just working on DBus in XPCOM), it is officially numbered 0.1. For those who are new to this blog, or just the idea of the NetworkManaher Automatic Web Authentication I've been working on (which I'm calling "nmAutoLogin" inside itself) , the idea is that several networks, such as colleges, workplaces, café hotspots, trains, airplanes, etc. require you to navigate to a webpage and login to there before you can access the internet, even outside of the browser. Having to do this manually can be a bit of a chore, or just an annoyance. Would it not be nice if you could just have NetworkManager in Linux connect to a wireless network, then automatically have a browser like Firefox open this page and log in to it? That's what the idea here is: When NetworkManager connects to a wifi network that needs such a login to take place, a daemon will pick up on this connection, open Firefox if it's not open, navigate to the page, and log the user in, using Firefox's Password Manager to hold the username & password for this website. The reasoning for using Firefox rather than one of several web browsing libraries available out there is relatively sound: - Firefox has a Password Manager: Why would we want to store passwords in yet another place, when we can keep them centralized?
- Firefox is a GUI: If something goes wrong (wrong password, unable to connect, etc) the user should be able to see this, and be able to react to it
- Javascript Popup Windows: Some of these network websites will pop up a little window that runs some javascript over time to make sure the user is active, and that if they disocnnect, it will log them out. Why should we try to integrate a full Javascript engine into something else, when we already have a browser that can do it all?
The main problem with trying to get this to work, is that there is no way to control Firefox from outside of Firefox. The solution for this was to write an extension that includes an XPCOM component allowing it to listen to signals sent out on DBus, and then have the usual Javascript in an extension that would pick up on this, and react accordingly. At present, most of the code for this release is actually in this extension, even if the DBus work is more extensive in the Daemon. The basic structure of how this entire thing works:
- NetworkManager connects to a wireless network
- The nmAutoLogin daemon is running, listening for the PropertiesChanged signal sent out by NM
- Waits until the connection is finalized
- Picks up theActiveConnection information and uses this to grab the SSID of the network
- (future, not implemented yet) Uses the SSID as a key to get the appropriate URL for the login page
- (future) Checks to see if Firefox is running or not. If it is, go to step 5, if not, open it
- Sens out a signal on DBus of "network connect" to prep anything listening, then the URL for the given network
- The Firefox extension picks up the "network connect" signal and the URL
- Opens a new window with the send URL
- Submits document.forms[0] (Note: I know this doesn't work in 100% of cases, but it's a simplified version for now)
- The network is logged into, anything that the web page needs to do is done
- ???
- Profit! err... Use the internet!
- Learn that I shouldn't be trusted to write numbered lists without doing something like this...
Instructions on how to install and use this all: - Download and extract the contents of the tarball to the desire directory
- Install release/nmAutoLogin-x86.xpi into Firefox, and restart when asked to do so
- In terminal:
- > cd <extracted root>/release/
> python nmAutoLogin.py - or, alternatively...
- > cd <extracted root>/release/
> chmod +x nmAutoLogin.py > ./nmAutoLogin.py
- With nmAutoLogin.py running and Firefox opened with the extension installed, connect (or reconnect) to selected wireless network
- Watch as Firefox opens a new window and attempts to log in
Now, for some information about this specific release, namely, the changes since when I posted my 0.2... - No changes in the binary XPCOM side of things, other than turning off vocal
- Re-wrote about 80% of the Extension's Javascript
- The code for working with the DBusClient side of things is the same as before (sendSignal, createClient)
- Realized that if the initial window is closed, it breaks, or trying to open a second window crashes it
- Added WindowReference count to always tell when the first window is opened (create everything) or the last closed (close everything)
- Re-worked the Threading to work no matter which window is active
- Remove any dependency on an initial window by getting rid of "window.setInterval"
- Created the nmAutoLogin Python daemon
Now, taken from the README taken from the code, plans for the future: - Check to see if Firefox is open or not
- If open, send signal
- If not, open it, wait for "FFOpen" signal (or similar)
- Send "network connect" and URL
- Read in SSID and URL information from file
- Send this to FF
- CSV likely
If you have any questions, comments, retorts, criticisms, hatreds, feel free to comment on my blog here, or send me an email if you've got my address. |