From 04a0cf548eb1b233614058cb4cb2faca2a970149 Mon Sep 17 00:00:00 2001 From: Roel Date: Wed, 28 May 2014 21:25:36 +0200 Subject: [PATCH] updated lazyinstall, now includes hotspot, captive portal and init script --- lazyinstall/dhcp | 38 +++++++++++++++++++++++++++++++++++++ lazyinstall/firewall | 34 +++++++++++++++++++++++++++++++++ lazyinstall/lazyinstall2.sh | 10 ++++++++++ lazyinstall/meshenger | 16 ++++++++++++++++ lazyinstall/network | 6 ++++++ lazyinstall/wireless | 11 +++++++++-- 6 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 lazyinstall/dhcp create mode 100644 lazyinstall/firewall create mode 100755 lazyinstall/meshenger diff --git a/lazyinstall/dhcp b/lazyinstall/dhcp new file mode 100644 index 0000000..8b7e5d6 --- /dev/null +++ b/lazyinstall/dhcp @@ -0,0 +1,38 @@ +config dnsmasq + option domainneeded 1 + option boguspriv 1 + option filterwin2k 0 # enable for dial on demand + option localise_queries 1 + option rebind_protection 1 # disable if upstream must serve RFC1918 addresses + option rebind_localhost 1 # enable for RBL checking and similar services + #list rebind_domain example.lan # whitelist RFC1918 responses for domains + option local '/lan/' + option domain 'lan' + option expandhosts 1 + option nonegcache 0 + option authoritative 1 + option readethers 1 + option leasefile '/tmp/dhcp.leases' + option resolvfile '/tmp/resolv.conf.auto' + #list server '/mycompany.local/1.2.3.4' + #option nonwildcard 1 + #list interface br-lan + #list notinterface lo + #list bogusnxdomain '64.94.110.11' + list server '//192.168.2.1' + +config dhcp lan + option interface lan + option start 100 + option limit 150 + option leasetime 12h + +config dhcp wan + option interface wan + option ignore 1 + +config dhcp hotspot + option 'interface' 'hotspot' + option 'start' '100' + option 'limit' '150' + option 'dynamicdhcp' '1' diff --git a/lazyinstall/firewall b/lazyinstall/firewall new file mode 100644 index 0000000..4ccbe87 --- /dev/null +++ b/lazyinstall/firewall @@ -0,0 +1,34 @@ +config 'zone' + option 'name' 'hotspot' + option 'input' 'ACCEPT' + option 'forward' 'ACCEPT' #was REJECT + option 'output' 'ACCEPT' + +config 'rule' + + option 'src' 'hotspot' + option 'dest_port' '53' + option 'proto' 'tcpudp' + option 'target' 'ACCEPT' + +config 'rule' + option 'src' 'hotspot' + option 'src_port' '67-68' + option 'dest_port' '67-68' + option 'proto' 'udp' + option 'target' 'ACCEPT' + +config 'rule' + option 'target' 'ACCEPT' + option 'src' 'hotspot' # guest wifi interface + option 'proto' 'tcp' + option '_name' 'Website' # this can maybe go? + option 'dest_port' '80' + +config 'redirect' + option 'proto' 'tcp' + option '_name' 'Website' # this can maybe go? + option 'src' 'hotspot' # guest wifi interface + option 'src_dport' '80' + option 'dest_port' '80' + option 'dest_ip' '192.168.2.1' # ip of webserver \ No newline at end of file diff --git a/lazyinstall/lazyinstall2.sh b/lazyinstall/lazyinstall2.sh index 413dfe5..2b0382e 100755 --- a/lazyinstall/lazyinstall2.sh +++ b/lazyinstall/lazyinstall2.sh @@ -10,10 +10,18 @@ swapon /dev/sda2 mv fstab_extroot /etc/config/fstab +echo 'Configuring wireless and hotspot' + head -n 10 /etc/config/wireless >> tmp_wireless cat wireless >> tmp_wireless mv tmp_wireless /etc/config/wireless +mv firewall /etc/config/firewall + +mv dhcp /etc/config/dhcp + +echo "address=/#/192.168.2.1 " >> /etc/dnsmasq.conf + sleep 1 mv network /etc/config/network @@ -28,6 +36,8 @@ git clone git://github.com/jngrt/meshenger.git mv uhttpd /etc/config/uhttpd +mv meshenger /etc/init.d/meshenger + echo 'my ip address is:' #klopt nog niet ifconfig br-lan | grep 'inet addr' diff --git a/lazyinstall/meshenger b/lazyinstall/meshenger new file mode 100755 index 0000000..83eff40 --- /dev/null +++ b/lazyinstall/meshenger @@ -0,0 +1,16 @@ +#!/bin/sh /etc/rc.common +#meshenger startup script + +START=10 +STOP=15 + +start() { + echo 'starting Meshenger' + python ~/meshenger/main.py & +} + +stop() { + echo 'Killing Meshenger' + killall python +} + diff --git a/lazyinstall/network b/lazyinstall/network index af2aa44..c3251c3 100644 --- a/lazyinstall/network +++ b/lazyinstall/network @@ -18,3 +18,9 @@ config interface 'mesh' option mtu '1528' option proto 'none' +config interface 'hotspot' + option 'iface' 'radio0' #use your existing wifi device (look in config/wireless below) + option 'proto' 'static' + option 'ipaddr' '192.168.2.1' + option 'netmask' '255.255.255.0' + option 'type' 'bridge' \ No newline at end of file diff --git a/lazyinstall/wireless b/lazyinstall/wireless index 13683ec..5729520 100644 --- a/lazyinstall/wireless +++ b/lazyinstall/wireless @@ -1,8 +1,15 @@ - config wifi-iface 'wmesh' option device 'radio0' option ifname 'adhoc0' option network 'mesh' option mode 'adhoc' option ssid 'mesh' - option bssid '66:66:66:66:66:66' \ No newline at end of file + option bssid '66:66:66:66:66:66' + +config wifi-iface + option 'device' 'radio0' #use your excisting wifi device, look in the list above. + option 'ssid' 'meshenger_node' #use a unique name for your network? + option 'network' 'hotspot' + option 'mode' 'ap' + option 'encryption' 'none' + option 'isolate' '1' \ No newline at end of file