The FreedomPortal project is an exhibition of digital artworks installed on Wi-Fi routers spread out in the public space.
These instructions explain how to :
- create a FreedomPortal app
- deploy that app on a Wi-Fi router, so that it act as a captive portal for all clients connecting
In order to use these instructions, You need a Wi-Fi router:
- able to support openWRT (https://openwrt.org/)
- with a USB port so you can plug a USB key to extend the router's disk space
- with enough flash memory (I am unsure of the exact amount of memory necessary, but probably 8Mb or more)
We have been using GL-inet routers, which have all of the above, and come with openWRT pre-installed. Following instructions are for these specific routers, but can be easily adapted to another model.
In its simplest form, i.e. if you only want to serve static html and assets, a FreedomPortal app is a node.js app with the following structure :
- config.js : config for the FreedomPortal app.
- package.json : config for node.js.
- www : folder containing your html, css and other assets.
First, you must have node.js and npm installed on your system.
Then, with your terminal create a folder and inside that folder initialize the node app :
mkdir my-appcd my-appnpm init
Once this is done, install the FreedomPortal library :
npm install --save freedom-portal
Finally create a config file for your FreedomPortal app. You can find an example there.
Then, you can try that everything works by starting the app :
node ./node_modules/freedom-portal/bin/main.js /absolute/path/to/config.js
Go to http://localhost/ with your browser, check that your html pages and assets are served correctly.
Format a USB key, create a single partition ext4 called PORTALKEY (to match the configurations in
scripts/). The reason we need ext4, is that we need to be able to create symlinks.
Copy the source code of your FreedomPortal app on the usb stick under
log/ directory for log files.
On first connection on GL-inet routers, go to the router's web interface 192.168.8.1 to set a password which will be used to connect through SSH.
Use that password to connect through SSH
ssh firstname.lastname@example.org .
We need to stop the default router's web server, and disable it so it won't be started at next boot.
/etc/init.d/uhttpd stop/etc/init.d/lighttpd stop/etc/init.d/uhttpd disable/etc/init.d/lighttpd disable
For this step, the router needs Internet access.
To make some space, we will remove some unused packages. Run the following :
NB: the first and second commands might need to run twice, because packages we are trying to remove depend upon each other.
opkg remove gl-inet luci luci-base luci-* lua lighttpd-* lighttpdopkg remove gl-inet luci luci-base luci-* lua lighttpd-* lighttpdopkg remove kmod-video*opkg remove kmod-video*opkg remove mjpg-streamerrm -rf /usr/lib/luarm -rf /usr/lib/lighttpd/rm -rf /www/*
Then to install the packages we need, first update repo with :
opkg install nodejs
Copy the script for starting the portal app on startup :
cp scripts/portalapp-init.d /etc/init.d/portalapp
make it executable :
chmod +x /etc/init.d/portalapp
Activate at next boot by running
You can test that everything works by launching the server with
Add this line to
config dnsmasq...list address '/#/192.168.8.1'
Add this to the end of
config redirectoption src 'lan'option proto 'tcp'option src_ip '!192.168.8.1'option src_dport '80'option dest_ip '192.168.8.1'option dest_port '80'
/etc/config/wireless change the encryption option to
none and change the
ssid. Max length of SSID is 32 characters!
- try to put an https address in address bar
- try to put IP address in address bar
- try to put non-https url
192.168.0.1:Where the WiFi comes from