I wrote an automated script (makeThisHostApt.sh) for https://github.com/comarius/liveimage to setup easy any device into a host spot by simply running a script.
The script is tuned for 'liveimage' project and would configure 'liveimage' and 'lighthttpd' and requires few small changes after installation.
- Prerequisites for Wifi AP
- apt-get -y install --reinstall hostapd
- apt-get install dnsmasq
- Prerequisites for local web server (optional)
- apt-get -y install lighttpd php5-cgi
- lighttpd would be reconfigured to run under $USER
- One time commands
- lighty-enable-mod fastcgi-php
- sudo service lighttpd stop (would be ran from another startup script)
- sudo usermod -a -G www-data $USER
Making a Wi-Fi Hot-Spot implies to change these files:
- /etc/network/interfaces Setup the AP IP/Network
- /etc/hostapd/hostapd.conf SSID name, AP-channel, password
- /etc/dnsmasq.conf DNS server for clients
- /etc/dhcp/dhcp.conf IP range DHCP for wifi clients
- /etc/init.d/lighttpd Modified scrip to run under $USER
- /etc/lighttpd/lighttpd.conf config modified to run php, and to tun as $USER
For Nano-Pi Neo-2 use
- sudo turn-wifi-into-apmode yes/no
- and ignore the script.
Furthermore if you want the WifiHost to trap any incoming http request and to redirect it to local HTTP server you can run alternatively setupHoneyPot.sh
To run the script clone the git and delete everything except HOSTAPD folder. The folder contains the template files for the system used by the script.
The script can be ran in test mode, and would generate a folder called OUT where you would find generated / changed files for the root file system. Either can copy them on the roof file system, or rerun in deploy mode.
The tree structure for generated files which patches the rootfs is:
│ ├── dhcp
│ │ └── dhcp.conf
│ ├── dnsmasq.conf
│ ├── hostapd
│ │ └── hostapd.conf
│ ├── init.d
│ │ ├── autostart
│ │ └── lighttpd
│ ├── lighttpd
│ │ └── lighttpd.conf
│ └── network
│ └── interfaces
- Delete related liveimage stuff
- /home/<pi> /.autostart
- remove line 3, 4, 24..27 (these are lines in original file)
- If there is no http server required
- shell: $sudo apt-remove --purge lighttpd
- /home/<pi> /.autostart
- remove from line 7 to line 15 (these are lines in original file)
- shell: sudo update-rc.d lighttpd remove
- For AP honeypot
- change line ./resetip.sh $WLAN with sudo iptables -F if was not already changed
- If !@#%^@!
- kill wpa-suplicant
- add a line to $HOME/.autostart to kill the process early.
Sept 12 2017, Marius C, Toronto