| 
				
			 | 
			
			
				@@ -7189,17 +7189,7 @@ function enable_wifi_hotspot { 
			 | 
		
	
		
			
			| 
				7189
			 | 
			
				7189
			 | 
			
			
				       fi 
			 | 
		
	
		
			
			| 
				7190
			 | 
			
				7190
			 | 
			
			
				   fi 
			 | 
		
	
		
			
			| 
				7191
			 | 
			
				7191
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				7192
			 | 
			
				
			 | 
			
			
				-  if ! grep -q "Wifi hotspot" /etc/network/interfaces; then 
			 | 
		
	
		
			
			| 
				7193
			 | 
			
				
			 | 
			
			
				-      echo '' >> /etc/network/interfaces 
			 | 
		
	
		
			
			| 
				7194
			 | 
			
				
			 | 
			
			
				-      echo '# Wifi hotspot' >> /etc/network/interfaces 
			 | 
		
	
		
			
			| 
				7195
			 | 
			
				
			 | 
			
			
				-      echo "auto $WIFI_INTERFACE" >> /etc/network/interfaces 
			 | 
		
	
		
			
			| 
				7196
			 | 
			
				
			 | 
			
			
				-      echo "iface $WIFI_INTERFACE inet static" >> /etc/network/interfaces 
			 | 
		
	
		
			
			| 
				7197
			 | 
			
				
			 | 
			
			
				-      echo "    address $WIFI_STATIC_IP_ADDRESS" >> /etc/network/interfaces 
			 | 
		
	
		
			
			| 
				7198
			 | 
			
				
			 | 
			
			
				-      echo '    netmask 255.255.255.0' >> /etc/network/interfaces 
			 | 
		
	
		
			
			| 
				7199
			 | 
			
				
			 | 
			
			
				-      service networking restart 
			 | 
		
	
		
			
			| 
				7200
			 | 
			
				
			 | 
			
			
				-  fi 
			 | 
		
	
		
			
			| 
				7201
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				7202
			 | 
			
				
			 | 
			
			
				-  apt-get -y install hostapd isc-dhcp-server 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7192
			 | 
			
			
				+  apt-get -y install hostapd isc-dhcp-server bridge-utils 
			 | 
		
	
		
			
			| 
				7203
			 | 
			
				7193
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				7204
			 | 
			
				7194
			 | 
			
			
				   if [ ! -f /etc/default/hostapd ]; then 
			 | 
		
	
		
			
			| 
				7205
			 | 
			
				7195
			 | 
			
			
				       echo 'Unable to find /etc/default/hostapd. hostapd may not have installed correctly' 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -7211,6 +7201,7 @@ function enable_wifi_hotspot { 
			 | 
		
	
		
			
			| 
				7211
			 | 
			
				7201
			 | 
			
			
				   sed -i 's|#DAEMON_CONF=.*|DAEMON_CONF="/etc/hostapd/hostapd.conf"|g' /etc/default/hostapd 
			 | 
		
	
		
			
			| 
				7212
			 | 
			
				7202
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				7213
			 | 
			
				7203
			 | 
			
			
				   echo "interface=$WIFI_INTERFACE" > /etc/hostapd/hostapd.conf 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7204
			 | 
			
			
				+  echo 'bridge=br0' >> /etc/hostapd/hostapd.conf 
			 | 
		
	
		
			
			| 
				7214
			 | 
			
				7205
			 | 
			
			
				   echo "ssid=$WIFI_ESSID" >> /etc/hostapd/hostapd.conf 
			 | 
		
	
		
			
			| 
				7215
			 | 
			
				7206
			 | 
			
			
				   echo "hw_mode=$WIFI_HOTSPOT_MODE" >> /etc/hostapd/hostapd.conf 
			 | 
		
	
		
			
			| 
				7216
			 | 
			
				7207
			 | 
			
			
				   echo "channel=${WIFI_HOTSPOT_CHANNEL}" >> /etc/hostapd/hostapd.conf 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -7223,48 +7214,71 @@ function enable_wifi_hotspot { 
			 | 
		
	
		
			
			| 
				7223
			 | 
			
				7214
			 | 
			
			
				   echo 'wpa_pairwise=TKIP' >> /etc/hostapd/hostapd.conf 
			 | 
		
	
		
			
			| 
				7224
			 | 
			
				7215
			 | 
			
			
				   echo 'rsn_pairwise=CCMP' >> /etc/hostapd/hostapd.conf 
			 | 
		
	
		
			
			| 
				7225
			 | 
			
				7216
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				7226
			 | 
			
				
			 | 
			
			
				-  service hostapd restart 
			 | 
		
	
		
			
			| 
				7227
			 | 
			
				
			 | 
			
			
				-  systemctl daemon-reload 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7217
			 | 
			
			
				+  if ! grep -q "auto lo br0" /etc/network/interfaces; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7218
			 | 
			
			
				+      sed -i 's/auto lo/auto lo br0/g' /etc/network/interfaces 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7219
			 | 
			
			
				+  fi 
			 | 
		
	
		
			
			| 
				7228
			 | 
			
				7220
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				7229
			 | 
			
				
			 | 
			
			
				-  sed -i 's/#net.ipv4.ip_forward/net.ipv4.ip_forward/g' /etc/sysctl.conf 
			 | 
		
	
		
			
			| 
				7230
			 | 
			
				
			 | 
			
			
				-  sed -i 's/net.ipv4.ip_forward=.*/net.ipv4.ip_forward=1/g' /etc/sysctl.conf 
			 | 
		
	
		
			
			| 
				7231
			 | 
			
				
			 | 
			
			
				-  echo 1 > /proc/sys/net/ipv4/ip_forward 
			 | 
		
	
		
			
			| 
				7232
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				7233
			 | 
			
				
			 | 
			
			
				-  sed -i "s/net.ipv4.conf.all.accept_redirects = 0/net.ipv4.conf.all.accept_redirects = 1/g" /etc/sysctl.conf 
			 | 
		
	
		
			
			| 
				7234
			 | 
			
				
			 | 
			
			
				-  sed -i "s/net.ipv4.conf.all.send_redirects = 0/net.ipv4.conf.all.send_redirects = 1/g" /etc/sysctl.conf 
			 | 
		
	
		
			
			| 
				7235
			 | 
			
				
			 | 
			
			
				-  sed -i "s/net.ipv4.conf.all.accept_source_route = 0/net.ipv4.conf.all.accept_source_route = 1/g" /etc/sysctl.conf 
			 | 
		
	
		
			
			| 
				7236
			 | 
			
				
			 | 
			
			
				-  sed -i "s/net.ipv4.conf.default.rp_filter=1/#net.ipv4.conf.default.rp_filter=1/g" /etc/sysctl.conf 
			 | 
		
	
		
			
			| 
				7237
			 | 
			
				
			 | 
			
			
				-  sed -i "s/net.ipv4.conf.all.rp_filter=1/#net.ipv4.conf.all.rp_filter=1/g" /etc/sysctl.conf 
			 | 
		
	
		
			
			| 
				7238
			 | 
			
				
			 | 
			
			
				-  sed -i "s/net.ipv4.ip_forward=0/#net.ipv4.ip_forward=1/g" /etc/sysctl.conf 
			 | 
		
	
		
			
			| 
				7239
			 | 
			
				
			 | 
			
			
				-  sed -i 's/net.ipv4.icmp_echo_ignore_all = 1/net.ipv4.icmp_echo_ignore_all = 0/g' /etc/sysctl.conf 
			 | 
		
	
		
			
			| 
				7240
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				7241
			 | 
			
				
			 | 
			
			
				-  iptables --flush 
			 | 
		
	
		
			
			| 
				7242
			 | 
			
				
			 | 
			
			
				-  iptables --table nat --flush 
			 | 
		
	
		
			
			| 
				7243
			 | 
			
				
			 | 
			
			
				-  iptables --delete-chain 
			 | 
		
	
		
			
			| 
				7244
			 | 
			
				
			 | 
			
			
				-  iptables --table nat --delete-chain 
			 | 
		
	
		
			
			| 
				7245
			 | 
			
				
			 | 
			
			
				-  iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE 
			 | 
		
	
		
			
			| 
				7246
			 | 
			
				
			 | 
			
			
				-  iptables -A FORWARD -i eth0 -o $WIFI_INTERFACE -m state --state RELATED,ESTABLISHED -j ACCEPT 
			 | 
		
	
		
			
			| 
				7247
			 | 
			
				
			 | 
			
			
				-  iptables -A FORWARD -i $WIFI_INTERFACE -o eth0 -j ACCEPT 
			 | 
		
	
		
			
			| 
				7248
			 | 
			
				
			 | 
			
			
				-  save_firewall_settings 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7221
			 | 
			
			
				+  if ! grep -q "Wifi hotspot" /etc/network/interfaces; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7222
			 | 
			
			
				+      echo '' >> /etc/network/interfaces 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7223
			 | 
			
			
				+      echo '# Wifi hotspot' >> /etc/network/interfaces 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7224
			 | 
			
			
				+      echo "allow-hotplug $WIFI_INTERFACE" >> /etc/network/interfaces 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7225
			 | 
			
			
				+      echo "iface $WIFI_INTERFACE inet manual" >> /etc/network/interfaces 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7226
			 | 
			
			
				+  fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7227
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7228
			 | 
			
			
				+  if ! grep -q "Wireless bridge" /etc/network/interfaces; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7229
			 | 
			
			
				+      echo '' >> /etc/network/interfaces 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7230
			 | 
			
			
				+      echo '# Wireless bridge' >> /etc/network/interfaces 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7231
			 | 
			
			
				+      echo 'iface br0 inet static' >> /etc/network/interfaces 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7232
			 | 
			
			
				+      echo "    bridge_ports $WIFI_INTERFACE eth0" >> /etc/network/interfaces 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7233
			 | 
			
			
				+      echo "    address $WIFI_STATIC_IP_ADDRESS" >> /etc/network/interfaces 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7234
			 | 
			
			
				+      echo '    netmask 255.255.255.0' >> /etc/network/interfaces 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7235
			 | 
			
			
				+      echo "    network $WIFI_SUBNET" >> /etc/network/interfaces 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7236
			 | 
			
			
				+      echo "    gateway $ROUTER_IP_ADDRESS" >> /etc/network/interfaces 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7237
			 | 
			
			
				+      echo "    dns-nameservers $ROUTER_IP_ADDRESS" >> /etc/network/interfaces 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7238
			 | 
			
			
				+  fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7239
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7240
			 | 
			
			
				+  #sed -i 's/#net.ipv4.ip_forward/net.ipv4.ip_forward/g' /etc/sysctl.conf 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7241
			 | 
			
			
				+  #sed -i 's/net.ipv4.ip_forward=.*/net.ipv4.ip_forward=1/g' /etc/sysctl.conf 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7242
			 | 
			
			
				+  #echo 1 > /proc/sys/net/ipv4/ip_forward 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7243
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7244
			 | 
			
			
				+  #sed -i "s/net.ipv4.conf.all.accept_redirects = 0/net.ipv4.conf.all.accept_redirects = 1/g" /etc/sysctl.conf 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7245
			 | 
			
			
				+  #sed -i "s/net.ipv4.conf.all.send_redirects = 0/net.ipv4.conf.all.send_redirects = 1/g" /etc/sysctl.conf 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7246
			 | 
			
			
				+  #sed -i "s/net.ipv4.conf.all.accept_source_route = 0/net.ipv4.conf.all.accept_source_route = 1/g" /etc/sysctl.conf 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7247
			 | 
			
			
				+  #sed -i "s/net.ipv4.conf.default.rp_filter=1/#net.ipv4.conf.default.rp_filter=1/g" /etc/sysctl.conf 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7248
			 | 
			
			
				+  #sed -i "s/net.ipv4.conf.all.rp_filter=1/#net.ipv4.conf.all.rp_filter=1/g" /etc/sysctl.conf 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7249
			 | 
			
			
				+  #sed -i "s/net.ipv4.ip_forward=0/#net.ipv4.ip_forward=1/g" /etc/sysctl.conf 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7250
			 | 
			
			
				+  #sed -i 's/net.ipv4.icmp_echo_ignore_all = 1/net.ipv4.icmp_echo_ignore_all = 0/g' /etc/sysctl.conf 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7251
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7252
			 | 
			
			
				+  #iptables --flush 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7253
			 | 
			
			
				+  #iptables --table nat --flush 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7254
			 | 
			
			
				+  #iptables --delete-chain 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7255
			 | 
			
			
				+  #iptables --table nat --delete-chain 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7256
			 | 
			
			
				+  #iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7257
			 | 
			
			
				+  #iptables -A FORWARD -i eth0 -o $WIFI_INTERFACE -m state --state RELATED,ESTABLISHED -j ACCEPT 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7258
			 | 
			
			
				+  #iptables -A FORWARD -i $WIFI_INTERFACE -o eth0 -j ACCEPT 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7259
			 | 
			
			
				+  #save_firewall_settings 
			 | 
		
	
		
			
			| 
				7249
			 | 
			
				7260
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				7250
			 | 
			
				7261
			 | 
			
			
				   sed -i 's/option domain-name "example.org";/#option domain-name "example.org";/g' /etc/dhcp/dhcpd.conf 
			 | 
		
	
		
			
			| 
				7251
			 | 
			
				7262
			 | 
			
			
				   sed -i 's/option domain-name-servers ns1.example.org, ns2.example.org;/#option domain-name-servers ns1.example.org, ns2.example.org;/g' /etc/dhcp/dhcpd.conf 
			 | 
		
	
		
			
			| 
				7252
			 | 
			
				7263
			 | 
			
			
				   sed -i 's/#authoritative;/authoritative;/g' /etc/dhcp/dhcpd.conf 
			 | 
		
	
		
			
			| 
				7253
			 | 
			
				7264
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				7254
			 | 
			
				7265
			 | 
			
			
				   if ! grep -q "subnet $WIFI_SUBNET netmask 255.255.255.0" /etc/dhcp/dhcpd.conf; then 
			 | 
		
	
		
			
			| 
				7255
			 | 
			
				
			 | 
			
			
				-	  echo "subnet $WIFI_SUBNET netmask 255.255.255.0 {" >> /etc/dhcp/dhcpd.conf 
			 | 
		
	
		
			
			| 
				7256
			 | 
			
				
			 | 
			
			
				-	  echo "    range $WIFI_IP_RANGE_START $WIFI_IP_RANGE_END;" >> /etc/dhcp/dhcpd.conf 
			 | 
		
	
		
			
			| 
				7257
			 | 
			
				
			 | 
			
			
				-	  echo "    option broadcast-address $WIFI_BROADCAST_ADDRESS;" >> /etc/dhcp/dhcpd.conf 
			 | 
		
	
		
			
			| 
				7258
			 | 
			
				
			 | 
			
			
				-	  echo "    option routers $ROUTER_IP_ADDRESS;" >> /etc/dhcp/dhcpd.conf 
			 | 
		
	
		
			
			| 
				7259
			 | 
			
				
			 | 
			
			
				-	  echo '    default-lease-time 600;' >> /etc/dhcp/dhcpd.conf 
			 | 
		
	
		
			
			| 
				7260
			 | 
			
				
			 | 
			
			
				-	  echo '    max-lease-time 7200;' >> /etc/dhcp/dhcpd.conf 
			 | 
		
	
		
			
			| 
				7261
			 | 
			
				
			 | 
			
			
				-	  echo '    option domain-name "local";' >> /etc/dhcp/dhcpd.conf 
			 | 
		
	
		
			
			| 
				7262
			 | 
			
				
			 | 
			
			
				-	  echo "    option domain-name-servers $WIFI_DNS_SERVERS;" >> /etc/dhcp/dhcpd.conf 
			 | 
		
	
		
			
			| 
				7263
			 | 
			
				
			 | 
			
			
				-	  echo '}' >> /etc/dhcp/dhcpd.conf 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7266
			 | 
			
			
				+      echo "subnet $WIFI_SUBNET netmask 255.255.255.0 {" >> /etc/dhcp/dhcpd.conf 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7267
			 | 
			
			
				+      echo "    range $WIFI_IP_RANGE_START $WIFI_IP_RANGE_END;" >> /etc/dhcp/dhcpd.conf 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7268
			 | 
			
			
				+      echo "    option broadcast-address $WIFI_BROADCAST_ADDRESS;" >> /etc/dhcp/dhcpd.conf 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7269
			 | 
			
			
				+      echo "    option routers $ROUTER_IP_ADDRESS;" >> /etc/dhcp/dhcpd.conf 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7270
			 | 
			
			
				+      echo '    default-lease-time 600;' >> /etc/dhcp/dhcpd.conf 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7271
			 | 
			
			
				+      echo '    max-lease-time 7200;' >> /etc/dhcp/dhcpd.conf 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7272
			 | 
			
			
				+      echo '    option domain-name "local";' >> /etc/dhcp/dhcpd.conf 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7273
			 | 
			
			
				+      echo "    option domain-name-servers $WIFI_DNS_SERVERS;" >> /etc/dhcp/dhcpd.conf 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7274
			 | 
			
			
				+      echo '}' >> /etc/dhcp/dhcpd.conf 
			 | 
		
	
		
			
			| 
				7264
			 | 
			
				7275
			 | 
			
			
				   fi 
			 | 
		
	
		
			
			| 
				7265
			 | 
			
				7276
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				7266
			 | 
			
				7277
			 | 
			
			
				   sed -i "s/INTERFACES=.*/INTERFACES='$WIFI_INTERFACE'/g" /etc/default/isc-dhcp-server 
			 | 
		
	
		
			
			| 
				7267
			 | 
			
				7278
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				
			 | 
			
				7279
			 | 
			
			
				+  service networking restart 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7280
			 | 
			
			
				+  service hostapd restart 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7281
			 | 
			
			
				+  systemctl daemon-reload 
			 | 
		
	
		
			
			| 
				7268
			 | 
			
				7282
			 | 
			
			
				   service isc-dhcp-server restart 
			 | 
		
	
		
			
			| 
				7269
			 | 
			
				7283
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				7270
			 | 
			
				7284
			 | 
			
			
				   # Add details to the README file 
			 |