#!/bin/sh # GL-MT6000, after TollGate's setup (99-tollgate-setup) has made its # networks: the wired ports are the owner's, in TollGate's private network # (br-private) with its private SSID; br-lan keeps only the open TollGate # SSID, and nothing on it reaches the router's admin services -- anyone # nearby can join that SSID, and nodogsplash opens the router to every # client that has paid. Idempotent. uci -q get network.private_bridge >/dev/null || exit 0 # br-lan: the open SSID only. for dev in $(uci show network | sed -n "s/^network\.\([^.]*\)\.name='br-lan'$/\1/p"); do uci -q delete network.$dev.ports uci set network.$dev.bridge_empty='1' done # br-private: the switch ports. uci -q delete network.private_bridge.ports for port in lan1 lan2 lan3 lan4 lan5; do uci add_list network.private_bridge.ports=$port done uci set network.private_bridge.bridge_empty='1' # TollGate's private DHCP section lacks dhcpv4: OpenWrt's dnsmasq init now # defaults it to disabled, so the private network had no DHCP at all. uci set dhcp.private.dhcpv4='server' # No SSH, telnet or uhttpd (LuCI) from the public zone. The portal needs # only nodogsplash (2050), TollGate (2121), DNS and DHCP. uci set firewall.public_no_admin=rule uci set firewall.public_no_admin.name='Block-Admin-From-Public' uci set firewall.public_no_admin.src='lan' uci set firewall.public_no_admin.proto='tcp' uci set firewall.public_no_admin.dest_port='22 23 443 8080' uci set firewall.public_no_admin.target='REJECT' for port in 22 23 8080; do uci -q del_list nodogsplash.@nodogsplash[0].users_to_router="allow tcp port $port" done uci commit network uci commit dhcp uci commit firewall uci commit nodogsplash exit 0