├── LICENSE ├── LICENSES ├── GPL-3.0-or-later.txt └── MIT.txt ├── MESHdesk ├── Makefile └── files │ └── MESHdesk │ ├── a.lua │ ├── b.lua │ ├── bailout.lua │ ├── batman_neighbours.lua │ ├── captive_portals │ ├── 1 │ │ ├── auth.action │ │ ├── privoxy.conf │ │ └── unique.conf │ ├── 2 │ │ ├── auth.action │ │ ├── privoxy.conf │ │ └── unique.conf │ ├── 3 │ │ ├── auth.action │ │ ├── privoxy.conf │ │ └── unique.conf │ ├── 4 │ │ ├── auth.action │ │ ├── privoxy.conf │ │ └── unique.conf │ ├── 5 │ │ ├── auth.action │ │ ├── privoxy.conf │ │ └── unique.conf │ ├── 6 │ │ ├── auth.action │ │ ├── privoxy.conf │ │ └── unique.conf │ ├── 7 │ │ ├── auth.action │ │ ├── privoxy.conf │ │ └── unique.conf │ ├── 8 │ │ ├── auth.action │ │ ├── privoxy.conf │ │ └── unique.conf │ ├── 9 │ │ ├── auth.action │ │ ├── privoxy.conf │ │ └── unique.conf │ ├── 10 │ │ ├── auth.action │ │ ├── privoxy.conf │ │ └── unique.conf │ ├── 11 │ │ ├── auth.action │ │ ├── privoxy.conf │ │ └── unique.conf │ ├── 12 │ │ ├── auth.action │ │ ├── privoxy.conf │ │ └── unique.conf │ ├── 13 │ │ ├── auth.action │ │ ├── privoxy.conf │ │ └── unique.conf │ ├── 14 │ │ ├── auth.action │ │ ├── privoxy.conf │ │ └── unique.conf │ ├── 15 │ │ ├── auth.action │ │ ├── privoxy.conf │ │ └── unique.conf │ ├── 16 │ │ ├── auth.action │ │ ├── privoxy.conf │ │ └── unique.conf │ ├── cert.pem │ ├── chilli_1.conf │ ├── chilli_10.conf │ ├── chilli_11.conf │ ├── chilli_12.conf │ ├── chilli_13.conf │ ├── chilli_14.conf │ ├── chilli_15.conf │ ├── chilli_16.conf │ ├── chilli_2.conf │ ├── chilli_3.conf │ ├── chilli_4.conf │ ├── chilli_5.conf │ ├── chilli_6.conf │ ├── chilli_7.conf │ ├── chilli_8.conf │ ├── chilli_9.conf │ ├── common.conf │ └── key.pem │ ├── configs │ ├── captive_config.json │ ├── dhcp_network_eth_one │ ├── dhcp_network_one_eth │ ├── dhcp_network_one_eth_atheros │ ├── dhcp_network_one_eth_atheros_yuncore_xd3200 │ ├── dhcp_network_one_eth_mediatek │ ├── dhcp_network_one_eth_mediatek_1226 │ ├── dhcp_network_two_eth │ ├── frmwr_network_eth_one │ ├── frmwr_network_eth_one_rutx │ ├── frmwr_network_eth_one_rutx_rain │ ├── frmwr_network_one_eth │ ├── frmwr_network_one_eth_atheros │ ├── frmwr_network_one_eth_atheros_yuncore_ex3200 │ ├── frmwr_network_one_eth_mediatek │ ├── frmwr_network_two_eth │ ├── ipv6 │ │ ├── dhcp_network_eth_one │ │ ├── dhcp_network_one_eth │ │ ├── dhcp_network_one_eth_atheros │ │ ├── dhcp_network_one_eth_atheros_yuncore_xd3200 │ │ └── dhcp_network_two_eth │ ├── local_config_gateway.json │ ├── local_config_standard.json │ ├── local_network │ ├── network-archer-c7-v5 │ ├── network_bravotek_ap1200 │ ├── network_bus_router_1 │ ├── network_hap_ac_l │ ├── network_mt_rb750_gr3 │ ├── network_uap-pro │ ├── network_ubnt_ac_mesh │ ├── network_ubnt_ac_mesh_pro │ ├── network_ubnt_loco_ac │ ├── network_xiaomi_4a_100 │ ├── network_xiaomi_4a_1g │ ├── network_xiaomi_4c │ └── wan_network │ ├── coova_startup.lua │ ├── files │ └── common │ │ ├── 50-dnsmasq │ │ ├── 70-meshdesk │ │ ├── passwd │ │ ├── radiusdesk.html │ │ ├── shadow │ │ └── up.sh │ ├── gpio_utils │ ├── gpio_flash.sh │ └── gpio_set_clear.sh │ ├── heartbeat.lua │ ├── hotplug_dir │ └── hotplug.d │ │ └── iface │ │ └── 70-meshdesk │ ├── hotplug_lan.lua │ ├── led.lua │ ├── libs │ ├── class.lua │ ├── json.lua │ ├── ltn12.lua │ ├── rdAccel.lua │ ├── rdAccelstats.lua │ ├── rdActions.lua │ ├── rdAdvNftables.lua │ ├── rdAlfred.lua │ ├── rdBatman.lua │ ├── rdCoa.lua │ ├── rdConfig.lua │ ├── rdConfigModeMesh.lua │ ├── rdCoovaChilli.lua │ ├── rdExternal.lua │ ├── rdFirmwareConfig.lua │ ├── rdGateway.lua │ ├── rdJsonReports.lua │ ├── rdLeds.lua │ ├── rdLocalMesh.lua │ ├── rdLocalModeMesh.lua │ ├── rdLogger.lua │ ├── rdMorse.lua │ ├── rdMqttUtils.lua │ ├── rdMwan.lua │ ├── rdNetstats.lua │ ├── rdNetstatsWan.lua │ ├── rdNetwork.lua │ ├── rdNftables.lua │ ├── rdOpenvpn.lua │ ├── rdOpenvpnstats.lua │ ├── rdProxyLogs.lua │ ├── rdRebootSettings.lua │ ├── rdSoftflowLogs.lua │ ├── rdSqliteReports.lua │ ├── rdSqm.lua │ ├── rdSystem.lua │ ├── rdSystemstats.lua │ ├── rdVis.lua │ └── rdWireless.lua │ ├── licensechecker.lua │ ├── mac_setter.lua │ ├── main_led.lua │ ├── md_prep │ ├── md_prerun │ ├── mesh_status │ ├── meshdesk │ ├── mqtt.lua │ ├── mqtt_watcher.lua │ ├── reporting │ ├── accel_report_to_server.lua │ ├── check_for_actions.lua │ ├── check_for_coa.lua │ ├── dynamic_gateway.lua │ ├── dynamic_gateway_curl.lua │ ├── report_sampling.lua │ ├── report_sampling_wani.lua │ ├── report_to_server.lua │ └── report_to_server_no_wani.lua │ ├── rogue_scan.lua │ ├── test_ping.lua │ ├── tests │ ├── json_parse.lua │ ├── report_softflow_logs.lua │ ├── sample_config.json │ ├── sample_config_accel.json │ ├── sample_config_batman_adv.json │ ├── sample_config_openvpn.json │ ├── test_accel_config.lua │ ├── test_accel_stats.lua │ ├── test_actions.lua │ ├── test_batman_config.lua │ ├── test_firmware_config.lua │ ├── test_netstats_wan.lua │ ├── test_network.lua │ ├── test_network_add_macs.lua │ ├── test_openvpn_config.lua │ ├── test_proxy_logs.lua │ ├── test_rd_config.lua │ ├── test_reboot_settings.lua │ ├── test_softflow_logs.lua │ ├── test_sqlite_reports.lua │ ├── test_system_config.lua │ ├── test_uci_write.lua │ ├── test_vis.lua │ ├── test_wifi_config.lua │ └── ubus_lua.lua │ ├── utils │ ├── fetch_adv_firewall.lua │ ├── fetch_firewall.lua │ ├── fetch_sqm.lua │ ├── hostapd_disconnect.lua │ ├── nft_setter.lua │ ├── sqm_report_wip.lua │ ├── ssid_on_off.lua │ └── util_speedtest2mqtt.lua │ └── watchdog.lua ├── README.md ├── files ├── etc │ ├── banner │ ├── chilli │ │ └── up.sh │ ├── config │ │ └── system │ ├── hostapd.vlan │ ├── openvpn.user │ ├── passwd │ ├── rc.local │ └── shadow ├── usr │ └── share │ │ └── ucode │ │ └── luci │ │ └── template │ │ └── themes │ │ └── material │ │ └── footer.ut └── www │ └── luci-static │ └── material │ ├── brand.png │ ├── cascade.css │ ├── custom.css │ ├── icons │ └── menu.svg │ ├── logo.svg │ └── logo_48.png ├── luci-app-meshdesk ├── Makefile ├── luasrc │ ├── controller │ │ └── meshdesk │ │ │ └── meshdesk.lua │ └── model │ │ └── cbi │ │ └── meshdesk │ │ └── meshdesk.lua └── root │ └── usr │ └── share │ └── rpcd │ └── acl.d │ └── luci-app-meshdesk.json ├── openwrt-accel-ppp ├── LICENSE ├── Makefile ├── README.md └── files │ ├── accel-ppp.conf │ └── accel-ppp.init └── ppsk └── hostapd.sh /LICENSES/MIT.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [year] [fullname] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /MESHdesk/Makefile: -------------------------------------------------------------------------------- 1 | include $(TOPDIR)/rules.mk 2 | 3 | PKG_NAME:=MESHdesk 4 | PKG_VERSION:=9.5.6 5 | PKG_RELEASE:=01 6 | 7 | include $(INCLUDE_DIR)/package.mk 8 | 9 | define Package/MESHdesk 10 | SECTION:=net 11 | CATEGORY:=Base system 12 | TITLE:=MESHdesk firmware 13 | URL:=http://radiusdesk.com/ 14 | endef 15 | 16 | 17 | define Package/MESHdesk/description 18 | MESHdesk is part of RADIUSdesk 19 | endef 20 | 21 | define Build/Compile 22 | rm -rf $(PKG_INSTALL_DIR) 23 | mkdir -p $(PKG_INSTALL_DIR) 24 | endef 25 | 26 | define Package/MESHdesk/install 27 | $(INSTALL_DIR) $(1)/etc/MESHdesk 28 | $(INSTALL_DIR) $(1)/etc/MESHdesk/captive_portals 29 | $(INSTALL_DIR) $(1)/etc/MESHdesk/configs 30 | $(INSTALL_DIR) $(1)/etc/MESHdesk/files 31 | $(INSTALL_DIR) $(1)/etc/MESHdesk/libs 32 | $(INSTALL_DIR) $(1)/etc/MESHdesk/reporting 33 | $(INSTALL_DIR) $(1)/etc/MESHdesk/tests 34 | $(INSTALL_DIR) $(1)/etc/MESHdesk/utils 35 | cp -r ./files/MESHdesk/captive_portals/* $(1)/etc/MESHdesk/captive_portals 36 | cp -r ./files/MESHdesk/configs/* $(1)/etc/MESHdesk/configs 37 | cp -r ./files/MESHdesk/files/* $(1)/etc/MESHdesk/files 38 | cp -r ./files/MESHdesk/libs/* $(1)/etc/MESHdesk/libs 39 | cp -r ./files/MESHdesk/reporting/* $(1)/etc/MESHdesk/reporting 40 | cp -r ./files/MESHdesk/tests/* $(1)/etc/MESHdesk/tests 41 | cp -r ./files/MESHdesk/utils/* $(1)/etc/MESHdesk/utils 42 | $(INSTALL_BIN) ./files/MESHdesk/a.lua $(1)/etc/MESHdesk/ 43 | $(INSTALL_BIN) ./files/MESHdesk/batman_neighbours.lua $(1)/etc/MESHdesk/ 44 | $(INSTALL_BIN) ./files/MESHdesk/heartbeat.lua $(1)/etc/MESHdesk/ 45 | $(INSTALL_BIN) ./files/MESHdesk/hotplug_lan.lua $(1)/etc/MESHdesk/ 46 | $(INSTALL_BIN) ./files/MESHdesk/led.lua $(1)/etc/MESHdesk/ 47 | $(INSTALL_BIN) ./files/MESHdesk/main_led.lua $(1)/etc/MESHdesk/ 48 | $(INSTALL_BIN) ./files/MESHdesk/bailout.lua $(1)/etc/MESHdesk/ 49 | $(INSTALL_BIN) ./files/MESHdesk/watchdog.lua $(1)/etc/MESHdesk/ 50 | $(INSTALL_BIN) ./files/MESHdesk/mqtt.lua $(1)/etc/MESHdesk/ 51 | $(INSTALL_BIN) ./files/MESHdesk/mqtt_watcher.lua $(1)/etc/MESHdesk/ 52 | $(INSTALL_BIN) ./files/MESHdesk/rogue_scan.lua $(1)/etc/MESHdesk/ 53 | $(INSTALL_BIN) ./files/MESHdesk/mac_setter.lua $(1)/etc/MESHdesk/ 54 | mkdir -p $(1)/etc/init.d 55 | $(INSTALL_BIN) ./files/MESHdesk/md_prerun $(1)/etc/init.d 56 | $(INSTALL_BIN) ./files/MESHdesk/md_prep $(1)/etc/init.d 57 | mkdir -p $(1)/etc/config 58 | $(INSTALL_DATA) ./files/MESHdesk/meshdesk $(1)/etc/config 59 | mkdir -p $(1)/etc/hotplug.d/iface 60 | cp ./files/MESHdesk/files/common/70-meshdesk $(1)/etc/hotplug.d/iface/ 61 | cp ./files/MESHdesk/files/common/50-dnsmasq $(1)/etc/hotplug.d/iface/ 62 | mkdir -p $(1)/etc/chilli/www 63 | cp ./files/MESHdesk/files/common/radiusdesk.html $(1)/etc/chilli/www 64 | endef 65 | 66 | define Package/MESHdesk/postinst 67 | #!/bin/sh 68 | exit 0 69 | endef 70 | 71 | define Package/MESHdesk/prerm 72 | #!/bin/sh 73 | # check if we are on real system 74 | if [ -z "$${IPKG_INSTROOT}" ]; then 75 | echo "Removing rc.d symlink for MESHdesk" 76 | /etc/init.d/md_prerun disable 77 | /etc/init.d/md_prep disable 78 | fi 79 | exit 0 80 | endef 81 | 82 | $(eval $(call BuildPackage,MESHdesk)) 83 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/b.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | 3 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 4 | -- 5 | -- SPDX-License-Identifier: GPL-3.0-or-later 6 | 7 | 8 | -- Include libraries 9 | package.path = "libs/?.lua;" .. package.path; 10 | require("rdLogger"); 11 | require("rdConfig"); 12 | 13 | local uci = require("uci"); 14 | local uci_cursor = uci.cursor(); 15 | local dns_works = false; --'global' flag which indicates if we could resolve DNS to IP 16 | local debug = true; 17 | local c = rdConfig(); 18 | local l = rdLogger(); 19 | local config_success = false; 20 | 21 | --====================================== 22 | ---- Some helper functions ------------ 23 | --====================================== 24 | function log(m,p) 25 | if(debug)then 26 | print(m); 27 | l:log(m,p) 28 | end 29 | end 30 | 31 | function fetch_latest_config() 32 | local config_file = uci_cursor:get('meshdesk','settings','config_file'); 33 | local wifi_captive = false; 34 | local found_config = false; 35 | os.execute("/etc/MESHdesk/main_led.lua start lan"); 36 | local ret_tbl = c:fetchFreshConfig('lan'); 37 | dns_works = ret_tbl.dns_works; 38 | if(ret_tbl.got_settings)then 39 | log("Lekker man Got the slettings"); 40 | local ret_conf = c:configureDevice(config_file,true);--include doWanSynch here 41 | if(ret_conf.config_success == true)then 42 | config_success = true; 43 | end 44 | end 45 | end 46 | 47 | fetch_latest_config(); 48 | if(config_success)then 49 | l:log("Fresh configuration successful commited"); 50 | else 51 | l:log("Could not commit fresh configuration"); 52 | end 53 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/bailout.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | 3 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 4 | -- 5 | -- SPDX-License-Identifier: GPL-3.0-or-later 6 | 7 | 8 | --[[ 9 | 24 May 2018 10 | This script can be called when trouble arises as a gentle way to attempt to bring back the hardware to a working state. 11 | Once called it will take 24 hours before activated. 12 | Also remember to call with the & in order to send it to the background 13 | --]] 14 | 15 | -- Include libraries 16 | package.path = "libs/?.lua;" .. package.path; 17 | local socket = require("socket"); 18 | 19 | function sleep(sec) 20 | socket.select(nil, nil, sec) 21 | end 22 | 23 | sleep(86400); 24 | os.execute("reboot"); 25 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/1/auth.action: -------------------------------------------------------------------------------- 1 | { \ 2 | #+hide-forwarded-for-headers \ 3 | +hide-from-header{block} \ 4 | +set-image-blocker{pattern} \ 5 | +add-header{Proxy-Connection: Keep-Alive}\ 6 | +add-header{Proxy-Authorization: Basic DDDtaW46YWRtaW4=} / 7 | } 8 | / 9 | 10 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/1/privoxy.conf: -------------------------------------------------------------------------------- 1 | logdir /var/log 2 | logfile privoxy1.log 3 | confdir /etc/privoxy 4 | filterfile default.filter 5 | actionsfile match-all.action 6 | actionsfile default.action 7 | #actionsfile /etc/MESHdesk/captive_portals/1/auth.action 8 | listen-address 10.0.0.4:8118 9 | toggle 1 10 | enable-remote-toggle 1 11 | enable-remote-http-toggle 0 12 | enable-edit-actions 1 13 | enforce-blocks 0 14 | buffer-limit 4096 15 | forwarded-connect-retries 0 16 | accept-intercepted-requests 1 17 | enable-proxy-authentication-forwarding 1 18 | allow-cgi-request-crunching 0 19 | split-large-forms 0 20 | keep-alive-timeout 300 21 | socket-timeout 300 22 | permit-access 10.1.0.0/16 23 | debug 512 24 | debug 1 25 | #forward / 198.27.111.78:3128 26 | forward <10.*> . 27 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/1/unique.conf: -------------------------------------------------------------------------------- 1 | uamlisten 10.1.0.1 2 | net 10.1.0.0/16 3 | dynip 10.1.1.0/16 4 | uamhomepage http://10.1.0.1:3990/www/radiusdesk.html 5 | radiuslocationname "MD_hotspot-1" 6 | radiuslocationid "isocc=,cc=,ac=,network=MD-1," 7 | 8 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/10/auth.action: -------------------------------------------------------------------------------- 1 | { \ 2 | #+hide-forwarded-for-headers \ 3 | +hide-from-header{block} \ 4 | +set-image-blocker{pattern} \ 5 | +add-header{Proxy-Connection: Keep-Alive}\ 6 | +add-header{Proxy-Authorization: Basic DDDtaW46YWRtaW4=} / 7 | } 8 | / 9 | 10 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/10/privoxy.conf: -------------------------------------------------------------------------------- 1 | logdir /var/log 2 | logfile privoxy10.log 3 | confdir /etc/privoxy 4 | filterfile default.filter 5 | actionsfile match-all.action 6 | actionsfile default.action 7 | actionsfile /etc/MESHdesk/captive_portals/10/auth.action 8 | listen-address 10.0.0.4:8127 9 | toggle 1 10 | enable-remote-toggle 1 11 | enable-remote-http-toggle 0 12 | enable-edit-actions 1 13 | enforce-blocks 0 14 | buffer-limit 4096 15 | forwarded-connect-retries 0 16 | accept-intercepted-requests 1 17 | enable-proxy-authentication-forwarding 1 18 | allow-cgi-request-crunching 0 19 | split-large-forms 0 20 | keep-alive-timeout 300 21 | socket-timeout 300 22 | permit-access 10.10.0.0/24 23 | debug 512 24 | debug 4096 25 | debug 8192 26 | forward / 198.27.111.78:3128 27 | forward <10.*> . 28 | 29 | 30 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/10/unique.conf: -------------------------------------------------------------------------------- 1 | uamlisten 10.10.0.1 2 | net 10.10.0.0/16 3 | dynip 10.10.1.0/16 4 | uamhomepage http://10.10.0.1:3990/www/radiusdesk.html 5 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/11/auth.action: -------------------------------------------------------------------------------- 1 | { \ 2 | #+hide-forwarded-for-headers \ 3 | +hide-from-header{block} \ 4 | +set-image-blocker{pattern} \ 5 | +add-header{Proxy-Connection: Keep-Alive}\ 6 | +add-header{Proxy-Authorization: Basic DDDtaW46YWRtaW4=} / 7 | } 8 | / 9 | 10 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/11/privoxy.conf: -------------------------------------------------------------------------------- 1 | logdir /var/log 2 | logfile privoxy11.log 3 | confdir /etc/privoxy 4 | filterfile default.filter 5 | actionsfile match-all.action 6 | actionsfile default.action 7 | actionsfile /etc/MESHdesk/captive_portals/11/auth.action 8 | listen-address 10.0.0.4:8128 9 | toggle 1 10 | enable-remote-toggle 1 11 | enable-remote-http-toggle 0 12 | enable-edit-actions 1 13 | enforce-blocks 0 14 | buffer-limit 4096 15 | forwarded-connect-retries 0 16 | accept-intercepted-requests 1 17 | enable-proxy-authentication-forwarding 1 18 | allow-cgi-request-crunching 0 19 | split-large-forms 0 20 | keep-alive-timeout 300 21 | socket-timeout 300 22 | permit-access 10.11.0.0/24 23 | debug 512 24 | debug 4096 25 | debug 8192 26 | forward / 198.27.111.78:3128 27 | forward <10.*> . 28 | 29 | 30 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/11/unique.conf: -------------------------------------------------------------------------------- 1 | uamlisten 10.11.0.1 2 | net 10.11.0.0/16 3 | dynip 10.11.1.0/16 4 | uamhomepage http://10.11.0.1:3990/www/radiusdesk.html 5 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/12/auth.action: -------------------------------------------------------------------------------- 1 | { \ 2 | #+hide-forwarded-for-headers \ 3 | +hide-from-header{block} \ 4 | +set-image-blocker{pattern} \ 5 | +add-header{Proxy-Connection: Keep-Alive}\ 6 | +add-header{Proxy-Authorization: Basic DDDtaW46YWRtaW4=} / 7 | } 8 | / 9 | 10 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/12/privoxy.conf: -------------------------------------------------------------------------------- 1 | logdir /var/log 2 | logfile privoxy12.log 3 | confdir /etc/privoxy 4 | filterfile default.filter 5 | actionsfile match-all.action 6 | actionsfile default.action 7 | actionsfile /etc/MESHdesk/captive_portals/12/auth.action 8 | listen-address 10.0.0.4:8129 9 | toggle 1 10 | enable-remote-toggle 1 11 | enable-remote-http-toggle 0 12 | enable-edit-actions 1 13 | enforce-blocks 0 14 | buffer-limit 4096 15 | forwarded-connect-retries 0 16 | accept-intercepted-requests 1 17 | enable-proxy-authentication-forwarding 1 18 | allow-cgi-request-crunching 0 19 | split-large-forms 0 20 | keep-alive-timeout 300 21 | socket-timeout 300 22 | permit-access 10.12.0.0/24 23 | debug 512 24 | debug 4096 25 | debug 8192 26 | forward / 198.27.111.78:3128 27 | forward <10.*> . 28 | 29 | 30 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/12/unique.conf: -------------------------------------------------------------------------------- 1 | uamlisten 10.12.0.1 2 | net 10.12.0.0/16 3 | dynip 10.12.1.0/16 4 | uamhomepage http://10.12.0.1:3990/www/radiusdesk.html 5 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/13/auth.action: -------------------------------------------------------------------------------- 1 | { \ 2 | #+hide-forwarded-for-headers \ 3 | +hide-from-header{block} \ 4 | +set-image-blocker{pattern} \ 5 | +add-header{Proxy-Connection: Keep-Alive}\ 6 | +add-header{Proxy-Authorization: Basic DDDtaW46YWRtaW4=} / 7 | } 8 | / 9 | 10 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/13/privoxy.conf: -------------------------------------------------------------------------------- 1 | logdir /var/log 2 | logfile privoxy13.log 3 | confdir /etc/privoxy 4 | filterfile default.filter 5 | actionsfile match-all.action 6 | actionsfile default.action 7 | actionsfile /etc/MESHdesk/captive_portals/13/auth.action 8 | listen-address 10.0.0.4:8130 9 | toggle 1 10 | enable-remote-toggle 1 11 | enable-remote-http-toggle 0 12 | enable-edit-actions 1 13 | enforce-blocks 0 14 | buffer-limit 4096 15 | forwarded-connect-retries 0 16 | accept-intercepted-requests 1 17 | enable-proxy-authentication-forwarding 1 18 | allow-cgi-request-crunching 0 19 | split-large-forms 0 20 | keep-alive-timeout 300 21 | socket-timeout 300 22 | permit-access 10.13.0.0/24 23 | debug 512 24 | debug 4096 25 | debug 8192 26 | forward / 198.27.111.78:3128 27 | forward <10.*> . 28 | 29 | 30 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/13/unique.conf: -------------------------------------------------------------------------------- 1 | uamlisten 10.13.0.1 2 | net 10.13.0.0/16 3 | dynip 10.13.1.0/16 4 | uamhomepage http://10.13.0.1:3990/www/radiusdesk.html 5 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/14/auth.action: -------------------------------------------------------------------------------- 1 | { \ 2 | #+hide-forwarded-for-headers \ 3 | +hide-from-header{block} \ 4 | +set-image-blocker{pattern} \ 5 | +add-header{Proxy-Connection: Keep-Alive}\ 6 | +add-header{Proxy-Authorization: Basic DDDtaW46YWRtaW4=} / 7 | } 8 | / 9 | 10 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/14/privoxy.conf: -------------------------------------------------------------------------------- 1 | logdir /var/log 2 | logfile privoxy14.log 3 | confdir /etc/privoxy 4 | filterfile default.filter 5 | actionsfile match-all.action 6 | actionsfile default.action 7 | actionsfile /etc/MESHdesk/captive_portals/14/auth.action 8 | listen-address 10.0.0.4:8131 9 | toggle 1 10 | enable-remote-toggle 1 11 | enable-remote-http-toggle 0 12 | enable-edit-actions 1 13 | enforce-blocks 0 14 | buffer-limit 4096 15 | forwarded-connect-retries 0 16 | accept-intercepted-requests 1 17 | enable-proxy-authentication-forwarding 1 18 | allow-cgi-request-crunching 0 19 | split-large-forms 0 20 | keep-alive-timeout 300 21 | socket-timeout 300 22 | permit-access 10.14.0.0/24 23 | debug 512 24 | debug 4096 25 | debug 8192 26 | forward / 198.27.111.78:3128 27 | forward <10.*> . 28 | 29 | 30 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/14/unique.conf: -------------------------------------------------------------------------------- 1 | uamlisten 10.14.0.1 2 | net 10.14.0.0/16 3 | dynip 10.14.1.0/16 4 | uamhomepage http://10.14.0.1:3990/www/radiusdesk.html 5 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/15/auth.action: -------------------------------------------------------------------------------- 1 | { \ 2 | #+hide-forwarded-for-headers \ 3 | +hide-from-header{block} \ 4 | +set-image-blocker{pattern} \ 5 | +add-header{Proxy-Connection: Keep-Alive}\ 6 | +add-header{Proxy-Authorization: Basic DDDtaW46YWRtaW4=} / 7 | } 8 | / 9 | 10 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/15/privoxy.conf: -------------------------------------------------------------------------------- 1 | logdir /var/log 2 | logfile privoxy15.log 3 | confdir /etc/privoxy 4 | filterfile default.filter 5 | actionsfile match-all.action 6 | actionsfile default.action 7 | actionsfile /etc/MESHdesk/captive_portals/15/auth.action 8 | listen-address 10.0.0.4:8132 9 | toggle 1 10 | enable-remote-toggle 1 11 | enable-remote-http-toggle 0 12 | enable-edit-actions 1 13 | enforce-blocks 0 14 | buffer-limit 4096 15 | forwarded-connect-retries 0 16 | accept-intercepted-requests 1 17 | enable-proxy-authentication-forwarding 1 18 | allow-cgi-request-crunching 0 19 | split-large-forms 0 20 | keep-alive-timeout 300 21 | socket-timeout 300 22 | permit-access 10.15.0.0/24 23 | debug 512 24 | debug 4096 25 | debug 8192 26 | forward / 198.27.111.78:3128 27 | forward <10.*> . 28 | 29 | 30 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/15/unique.conf: -------------------------------------------------------------------------------- 1 | uamlisten 10.15.0.1 2 | net 10.15.0.0/16 3 | dynip 10.15.1.0/16 4 | uamhomepage http://10.15.0.1:3990/www/radiusdesk.html 5 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/16/auth.action: -------------------------------------------------------------------------------- 1 | { \ 2 | #+hide-forwarded-for-headers \ 3 | +hide-from-header{block} \ 4 | +set-image-blocker{pattern} \ 5 | +add-header{Proxy-Connection: Keep-Alive}\ 6 | +add-header{Proxy-Authorization: Basic DDDtaW46YWRtaW4=} / 7 | } 8 | / 9 | 10 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/16/privoxy.conf: -------------------------------------------------------------------------------- 1 | logdir /var/log 2 | logfile privoxy16.log 3 | confdir /etc/privoxy 4 | filterfile default.filter 5 | actionsfile match-all.action 6 | actionsfile default.action 7 | actionsfile /etc/MESHdesk/captive_portals/16/auth.action 8 | listen-address 10.0.0.4:8133 9 | toggle 1 10 | enable-remote-toggle 1 11 | enable-remote-http-toggle 0 12 | enable-edit-actions 1 13 | enforce-blocks 0 14 | buffer-limit 4096 15 | forwarded-connect-retries 0 16 | accept-intercepted-requests 1 17 | enable-proxy-authentication-forwarding 1 18 | allow-cgi-request-crunching 0 19 | split-large-forms 0 20 | keep-alive-timeout 300 21 | socket-timeout 300 22 | permit-access 10.16.0.0/24 23 | debug 512 24 | debug 4096 25 | debug 8192 26 | forward / 198.27.111.78:3128 27 | forward <10.*> . 28 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/16/unique.conf: -------------------------------------------------------------------------------- 1 | uamlisten 10.16.0.1 2 | net 10.16.0.0/16 3 | dynip 10.16.1.0/16 4 | uamhomepage http://10.16.0.1:3990/www/radiusdesk.html 5 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/2/auth.action: -------------------------------------------------------------------------------- 1 | { \ 2 | #+hide-forwarded-for-headers \ 3 | +hide-from-header{block} \ 4 | +set-image-blocker{pattern} \ 5 | +add-header{Proxy-Connection: Keep-Alive}\ 6 | +add-header{Proxy-Authorization: Basic DDDtaW46YWRtaW4=} / 7 | } 8 | / 9 | 10 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/2/privoxy.conf: -------------------------------------------------------------------------------- 1 | logdir /var/log 2 | logfile privoxy2.log 3 | confdir /etc/privoxy 4 | filterfile default.filter 5 | actionsfile match-all.action 6 | actionsfile default.action 7 | actionsfile /etc/MESHdesk/captive_portals/2/auth.action 8 | listen-address 10.0.0.4:8119 9 | toggle 1 10 | enable-remote-toggle 1 11 | enable-remote-http-toggle 0 12 | enable-edit-actions 1 13 | enforce-blocks 0 14 | buffer-limit 4096 15 | forwarded-connect-retries 0 16 | accept-intercepted-requests 1 17 | enable-proxy-authentication-forwarding 1 18 | allow-cgi-request-crunching 0 19 | split-large-forms 0 20 | keep-alive-timeout 300 21 | socket-timeout 300 22 | permit-access 10.2.0.0/16 23 | debug 512 24 | debug 1 25 | forward / 198.27.111.78:3128 26 | forward <10.*> . 27 | 28 | 29 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/2/unique.conf: -------------------------------------------------------------------------------- 1 | uamlisten 10.2.0.1 2 | net 10.2.0.0/16 3 | dynip 10.2.1.0/16 4 | uamhomepage http://10.2.0.1:3990/www/radiusdesk.html 5 | radiuslocationname "MD_hotspot-2" 6 | radiuslocationid "isocc=,cc=,ac=,network=MD-2," 7 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/3/auth.action: -------------------------------------------------------------------------------- 1 | { \ 2 | #+hide-forwarded-for-headers \ 3 | +hide-from-header{block} \ 4 | +set-image-blocker{pattern} \ 5 | +add-header{Proxy-Connection: Keep-Alive}\ 6 | +add-header{Proxy-Authorization: Basic DDDtaW46YWRtaW4=} / 7 | } 8 | / 9 | 10 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/3/privoxy.conf: -------------------------------------------------------------------------------- 1 | logdir /var/log 2 | logfile privoxy3.log 3 | confdir /etc/privoxy 4 | filterfile default.filter 5 | actionsfile match-all.action 6 | actionsfile default.action 7 | actionsfile /etc/MESHdesk/captive_portals/3/auth.action 8 | listen-address 10.0.0.4:8120 9 | toggle 1 10 | enable-remote-toggle 1 11 | enable-remote-http-toggle 0 12 | enable-edit-actions 1 13 | enforce-blocks 0 14 | buffer-limit 4096 15 | forwarded-connect-retries 0 16 | accept-intercepted-requests 1 17 | enable-proxy-authentication-forwarding 1 18 | allow-cgi-request-crunching 0 19 | split-large-forms 0 20 | keep-alive-timeout 300 21 | socket-timeout 300 22 | permit-access 10.3.0.0/16 23 | debug 512 24 | debug 1 25 | forward / 198.27.111.78:3128 26 | forward <10.*> . 27 | 28 | 29 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/3/unique.conf: -------------------------------------------------------------------------------- 1 | uamlisten 10.3.0.1 2 | net 10.3.0.0/16 3 | dynip 10.3.1.0/16 4 | uamhomepage http://10.3.0.1:3990/www/radiusdesk.html 5 | radiuslocationname "MD_hotspot-2" 6 | radiuslocationid "isocc=,cc=,ac=,network=MD-3," 7 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/4/auth.action: -------------------------------------------------------------------------------- 1 | { \ 2 | #+hide-forwarded-for-headers \ 3 | +hide-from-header{block} \ 4 | +set-image-blocker{pattern} \ 5 | +add-header{Proxy-Connection: Keep-Alive}\ 6 | +add-header{Proxy-Authorization: Basic DDDtaW46YWRtaW4=} / 7 | } 8 | / 9 | 10 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/4/privoxy.conf: -------------------------------------------------------------------------------- 1 | logdir /var/log 2 | logfile privoxy4.log 3 | confdir /etc/privoxy 4 | filterfile default.filter 5 | actionsfile match-all.action 6 | actionsfile default.action 7 | actionsfile /etc/MESHdesk/captive_portals/4/auth.action 8 | listen-address 10.0.0.4:8121 9 | toggle 1 10 | enable-remote-toggle 1 11 | enable-remote-http-toggle 0 12 | enable-edit-actions 1 13 | enforce-blocks 0 14 | buffer-limit 4096 15 | forwarded-connect-retries 0 16 | accept-intercepted-requests 1 17 | enable-proxy-authentication-forwarding 1 18 | allow-cgi-request-crunching 0 19 | split-large-forms 0 20 | keep-alive-timeout 300 21 | socket-timeout 300 22 | permit-access 10.4.0.0/16 23 | debug 512 24 | debug 1 25 | forward / 198.27.111.78:3128 26 | forward <10.*> . 27 | 28 | 29 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/4/unique.conf: -------------------------------------------------------------------------------- 1 | uamlisten 10.4.0.1 2 | net 10.4.0.0/16 3 | dynip 10.4.1.0/16 4 | uamhomepage http://10.4.0.1:3990/www/radiusdesk.html 5 | radiuslocationname "MD_hotspot-4" 6 | radiuslocationid "isocc=,cc=,ac=,network=MD-4," 7 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/5/auth.action: -------------------------------------------------------------------------------- 1 | { \ 2 | #+hide-forwarded-for-headers \ 3 | +hide-from-header{block} \ 4 | +set-image-blocker{pattern} \ 5 | +add-header{Proxy-Connection: Keep-Alive}\ 6 | +add-header{Proxy-Authorization: Basic DDDtaW46YWRtaW4=} / 7 | } 8 | / 9 | 10 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/5/privoxy.conf: -------------------------------------------------------------------------------- 1 | logdir /var/log 2 | logfile privoxy5.log 3 | confdir /etc/privoxy 4 | filterfile default.filter 5 | actionsfile match-all.action 6 | actionsfile default.action 7 | actionsfile /etc/MESHdesk/captive_portals/5/auth.action 8 | listen-address 10.0.0.4:8122 9 | toggle 1 10 | enable-remote-toggle 1 11 | enable-remote-http-toggle 0 12 | enable-edit-actions 1 13 | enforce-blocks 0 14 | buffer-limit 4096 15 | forwarded-connect-retries 0 16 | accept-intercepted-requests 1 17 | enable-proxy-authentication-forwarding 1 18 | allow-cgi-request-crunching 0 19 | split-large-forms 0 20 | keep-alive-timeout 300 21 | socket-timeout 300 22 | permit-access 10.5.0.0/24 23 | debug 512 24 | debug 4096 25 | debug 8192 26 | forward / 198.27.111.78:3128 27 | forward <10.*> . 28 | 29 | 30 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/5/unique.conf: -------------------------------------------------------------------------------- 1 | uamlisten 10.5.0.1 2 | net 10.5.0.0/16 3 | dynip 10.5.1.0/16 4 | uamhomepage http://10.5.0.1:3990/www/radiusdesk.html 5 | radiuslocationname "MD_hotspot-5" 6 | radiuslocationid "isocc=,cc=,ac=,network=MD-5," 7 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/6/auth.action: -------------------------------------------------------------------------------- 1 | { \ 2 | #+hide-forwarded-for-headers \ 3 | +hide-from-header{block} \ 4 | +set-image-blocker{pattern} \ 5 | +add-header{Proxy-Connection: Keep-Alive}\ 6 | +add-header{Proxy-Authorization: Basic DDDtaW46YWRtaW4=} / 7 | } 8 | / 9 | 10 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/6/privoxy.conf: -------------------------------------------------------------------------------- 1 | logdir /var/log 2 | logfile privoxy6.log 3 | confdir /etc/privoxy 4 | filterfile default.filter 5 | actionsfile match-all.action 6 | actionsfile default.action 7 | actionsfile /etc/MESHdesk/captive_portals/6/auth.action 8 | listen-address 10.0.0.4:8123 9 | toggle 1 10 | enable-remote-toggle 1 11 | enable-remote-http-toggle 0 12 | enable-edit-actions 1 13 | enforce-blocks 0 14 | buffer-limit 4096 15 | forwarded-connect-retries 0 16 | accept-intercepted-requests 1 17 | enable-proxy-authentication-forwarding 1 18 | allow-cgi-request-crunching 0 19 | split-large-forms 0 20 | keep-alive-timeout 300 21 | socket-timeout 300 22 | permit-access 10.6.0.0/24 23 | debug 512 24 | debug 4096 25 | debug 8192 26 | forward / 198.27.111.78:3128 27 | forward <10.*> . 28 | 29 | 30 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/6/unique.conf: -------------------------------------------------------------------------------- 1 | uamlisten 10.6.0.1 2 | net 10.6.0.0/16 3 | dynip 10.6.1.0/16 4 | uamhomepage http://10.6.0.1:3990/www/radiusdesk.html 5 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/7/auth.action: -------------------------------------------------------------------------------- 1 | { \ 2 | #+hide-forwarded-for-headers \ 3 | +hide-from-header{block} \ 4 | +set-image-blocker{pattern} \ 5 | +add-header{Proxy-Connection: Keep-Alive}\ 6 | +add-header{Proxy-Authorization: Basic DDDtaW46YWRtaW4=} / 7 | } 8 | / 9 | 10 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/7/privoxy.conf: -------------------------------------------------------------------------------- 1 | logdir /var/log 2 | logfile privoxy7.log 3 | confdir /etc/privoxy 4 | filterfile default.filter 5 | actionsfile match-all.action 6 | actionsfile default.action 7 | actionsfile /etc/MESHdesk/captive_portals/7/auth.action 8 | listen-address 10.0.0.4:8124 9 | toggle 1 10 | enable-remote-toggle 1 11 | enable-remote-http-toggle 0 12 | enable-edit-actions 1 13 | enforce-blocks 0 14 | buffer-limit 4096 15 | forwarded-connect-retries 0 16 | accept-intercepted-requests 1 17 | enable-proxy-authentication-forwarding 1 18 | allow-cgi-request-crunching 0 19 | split-large-forms 0 20 | keep-alive-timeout 300 21 | socket-timeout 300 22 | permit-access 10.7.0.0/24 23 | debug 512 24 | debug 4096 25 | debug 8192 26 | forward / 198.27.111.78:3128 27 | forward <10.*> . 28 | 29 | 30 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/7/unique.conf: -------------------------------------------------------------------------------- 1 | uamlisten 10.7.0.1 2 | net 10.7.0.0/16 3 | dynip 10.7.1.0/16 4 | uamhomepage http://10.7.0.1:3990/www/radiusdesk.html 5 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/8/auth.action: -------------------------------------------------------------------------------- 1 | { \ 2 | #+hide-forwarded-for-headers \ 3 | +hide-from-header{block} \ 4 | +set-image-blocker{pattern} \ 5 | +add-header{Proxy-Connection: Keep-Alive}\ 6 | +add-header{Proxy-Authorization: Basic DDDtaW46YWRtaW4=} / 7 | } 8 | / 9 | 10 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/8/privoxy.conf: -------------------------------------------------------------------------------- 1 | logdir /var/log 2 | logfile privoxy8.log 3 | confdir /etc/privoxy 4 | filterfile default.filter 5 | actionsfile match-all.action 6 | actionsfile default.action 7 | actionsfile /etc/MESHdesk/captive_portals/8/auth.action 8 | listen-address 10.0.0.4:8125 9 | toggle 1 10 | enable-remote-toggle 1 11 | enable-remote-http-toggle 0 12 | enable-edit-actions 1 13 | enforce-blocks 0 14 | buffer-limit 4096 15 | forwarded-connect-retries 0 16 | accept-intercepted-requests 1 17 | enable-proxy-authentication-forwarding 1 18 | allow-cgi-request-crunching 0 19 | split-large-forms 0 20 | keep-alive-timeout 300 21 | socket-timeout 300 22 | permit-access 10.8.0.0/24 23 | debug 512 24 | debug 4096 25 | debug 8192 26 | forward / 198.27.111.78:3128 27 | forward <10.*> . 28 | 29 | 30 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/8/unique.conf: -------------------------------------------------------------------------------- 1 | uamlisten 10.8.0.1 2 | net 10.8.0.0/16 3 | dynip 10.8.1.0/16 4 | uamhomepage http://10.8.0.1:3990/www/radiusdesk.html 5 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/9/auth.action: -------------------------------------------------------------------------------- 1 | { \ 2 | #+hide-forwarded-for-headers \ 3 | +hide-from-header{block} \ 4 | +set-image-blocker{pattern} \ 5 | +add-header{Proxy-Connection: Keep-Alive}\ 6 | +add-header{Proxy-Authorization: Basic DDDtaW46YWRtaW4=} / 7 | } 8 | / 9 | 10 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/9/privoxy.conf: -------------------------------------------------------------------------------- 1 | logdir /var/log 2 | logfile privoxy9.log 3 | confdir /etc/privoxy 4 | filterfile default.filter 5 | actionsfile match-all.action 6 | actionsfile default.action 7 | actionsfile /etc/MESHdesk/captive_portals/9/auth.action 8 | listen-address 10.0.0.4:8126 9 | toggle 1 10 | enable-remote-toggle 1 11 | enable-remote-http-toggle 0 12 | enable-edit-actions 1 13 | enforce-blocks 0 14 | buffer-limit 4096 15 | forwarded-connect-retries 0 16 | accept-intercepted-requests 1 17 | enable-proxy-authentication-forwarding 1 18 | allow-cgi-request-crunching 0 19 | split-large-forms 0 20 | keep-alive-timeout 300 21 | socket-timeout 300 22 | permit-access 10.9.0.0/24 23 | debug 512 24 | debug 4096 25 | debug 8192 26 | forward / 198.27.111.78:3128 27 | forward <10.*> . 28 | 29 | 30 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/9/unique.conf: -------------------------------------------------------------------------------- 1 | uamlisten 10.9.0.1 2 | net 10.9.0.0/16 3 | dynip 10.9.1.0/16 4 | uamhomepage http://10.9.0.1:3990/www/radiusdesk.html 5 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/chilli_1.conf: -------------------------------------------------------------------------------- 1 | include /etc/MESHdesk/captive_portals/common.conf 2 | include /etc/MESHdesk/captive_portals/1/unique.conf 3 | include /etc/MESHdesk/captive_portals/1/specific.conf 4 | 5 | ipup=/etc/chilli/up.sh 6 | ipdown=/etc/chilli/down.sh 7 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/chilli_10.conf: -------------------------------------------------------------------------------- 1 | include /etc/MESHdesk/captive_portals/common.conf 2 | include /etc/MESHdesk/captive_portals/10/unique.conf 3 | include /etc/MESHdesk/captive_portals/10/specific.conf 4 | 5 | ipup=/etc/chilli/up.sh 6 | ipdown=/etc/chilli/down.sh 7 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/chilli_11.conf: -------------------------------------------------------------------------------- 1 | include /etc/MESHdesk/captive_portals/common.conf 2 | include /etc/MESHdesk/captive_portals/11/unique.conf 3 | include /etc/MESHdesk/captive_portals/11/specific.conf 4 | 5 | ipup=/etc/chilli/up.sh 6 | ipdown=/etc/chilli/down.sh 7 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/chilli_12.conf: -------------------------------------------------------------------------------- 1 | include /etc/MESHdesk/captive_portals/common.conf 2 | include /etc/MESHdesk/captive_portals/12/unique.conf 3 | include /etc/MESHdesk/captive_portals/12/specific.conf 4 | 5 | ipup=/etc/chilli/up.sh 6 | ipdown=/etc/chilli/down.sh 7 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/chilli_13.conf: -------------------------------------------------------------------------------- 1 | include /etc/MESHdesk/captive_portals/common.conf 2 | include /etc/MESHdesk/captive_portals/13/unique.conf 3 | include /etc/MESHdesk/captive_portals/13/specific.conf 4 | 5 | ipup=/etc/chilli/up.sh 6 | ipdown=/etc/chilli/down.sh 7 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/chilli_14.conf: -------------------------------------------------------------------------------- 1 | include /etc/MESHdesk/captive_portals/common.conf 2 | include /etc/MESHdesk/captive_portals/14/unique.conf 3 | include /etc/MESHdesk/captive_portals/14/specific.conf 4 | 5 | ipup=/etc/chilli/up.sh 6 | ipdown=/etc/chilli/down.sh 7 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/chilli_15.conf: -------------------------------------------------------------------------------- 1 | include /etc/MESHdesk/captive_portals/common.conf 2 | include /etc/MESHdesk/captive_portals/15/unique.conf 3 | include /etc/MESHdesk/captive_portals/15/specific.conf 4 | 5 | ipup=/etc/chilli/up.sh 6 | ipdown=/etc/chilli/down.sh 7 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/chilli_16.conf: -------------------------------------------------------------------------------- 1 | include /etc/MESHdesk/captive_portals/common.conf 2 | include /etc/MESHdesk/captive_portals/16/unique.conf 3 | include /etc/MESHdesk/captive_portals/16/specific.conf 4 | 5 | ipup=/etc/chilli/up.sh 6 | ipdown=/etc/chilli/down.sh 7 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/chilli_2.conf: -------------------------------------------------------------------------------- 1 | include /etc/MESHdesk/captive_portals/common.conf 2 | include /etc/MESHdesk/captive_portals/2/unique.conf 3 | include /etc/MESHdesk/captive_portals/2/specific.conf 4 | 5 | ipup=/etc/chilli/up.sh 6 | ipdown=/etc/chilli/down.sh 7 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/chilli_3.conf: -------------------------------------------------------------------------------- 1 | include /etc/MESHdesk/captive_portals/common.conf 2 | include /etc/MESHdesk/captive_portals/3/unique.conf 3 | include /etc/MESHdesk/captive_portals/3/specific.conf 4 | 5 | ipup=/etc/chilli/up.sh 6 | ipdown=/etc/chilli/down.sh 7 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/chilli_4.conf: -------------------------------------------------------------------------------- 1 | include /etc/MESHdesk/captive_portals/common.conf 2 | include /etc/MESHdesk/captive_portals/4/unique.conf 3 | include /etc/MESHdesk/captive_portals/4/specific.conf 4 | 5 | ipup=/etc/chilli/up.sh 6 | ipdown=/etc/chilli/down.sh 7 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/chilli_5.conf: -------------------------------------------------------------------------------- 1 | include /etc/MESHdesk/captive_portals/common.conf 2 | include /etc/MESHdesk/captive_portals/5/unique.conf 3 | include /etc/MESHdesk/captive_portals/5/specific.conf 4 | 5 | ipup=/etc/chilli/up.sh 6 | ipdown=/etc/chilli/down.sh 7 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/chilli_6.conf: -------------------------------------------------------------------------------- 1 | include /etc/MESHdesk/captive_portals/common.conf 2 | include /etc/MESHdesk/captive_portals/6/unique.conf 3 | include /etc/MESHdesk/captive_portals/6/specific.conf 4 | 5 | ipup=/etc/chilli/up.sh 6 | ipdown=/etc/chilli/down.sh 7 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/chilli_7.conf: -------------------------------------------------------------------------------- 1 | include /etc/MESHdesk/captive_portals/common.conf 2 | include /etc/MESHdesk/captive_portals/7/unique.conf 3 | include /etc/MESHdesk/captive_portals/7/specific.conf 4 | 5 | ipup=/etc/chilli/up.sh 6 | ipdown=/etc/chilli/down.sh 7 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/chilli_8.conf: -------------------------------------------------------------------------------- 1 | include /etc/MESHdesk/captive_portals/common.conf 2 | include /etc/MESHdesk/captive_portals/8/unique.conf 3 | include /etc/MESHdesk/captive_portals/8/specific.conf 4 | 5 | ipup=/etc/chilli/up.sh 6 | ipdown=/etc/chilli/down.sh 7 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/chilli_9.conf: -------------------------------------------------------------------------------- 1 | include /etc/MESHdesk/captive_portals/common.conf 2 | include /etc/MESHdesk/captive_portals/9/unique.conf 3 | include /etc/MESHdesk/captive_portals/9/specific.conf 4 | 5 | ipup=/etc/chilli/up.sh 6 | ipdown=/etc/chilli/down.sh 7 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/common.conf: -------------------------------------------------------------------------------- 1 | #===Common Coova Settings=== 2 | uamport 3990 3 | domain "mesh-manager.com" 4 | wwwdir /etc/chilli/www 5 | wwwbin /etc/chilli/wwwsh 6 | uamuiport 4990 7 | locationname "MESHdesk" 8 | radiusauthport 1812 9 | radiusacctport 1813 10 | papalwaysok 11 | uamaliasname "uam" 12 | adminupdatefile "/etc/chilli/local.conf" 13 | mtu 1468 14 | uamuissl 15 | sslkeyfile "/etc/MESHdesk/captive_portals/key.pem" 16 | sslcertfile "/etc/MESHdesk/captive_portals/cert.pem" 17 | #coaport 3799 18 | 19 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/captive_portals/key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCxI0EdT2RlF4CH 3 | 8dnew/bK4uOk0zoekG1vxcCh1tU3bhPVj/y7pqFMXiZmiU2oLZUhLVhiVjId13Kc 4 | E8dIF2kybN1W7zYhAz22q6x7HxdJPh9l1fClV73N0/owEn41aRGYQg6KlzEK45FV 5 | vX61XdaaReDeRmHBxLoH66Yep5MnGXQGj9gwW5FopPWF6m4/4SjVYyZlltK6x90M 6 | 9D6UxOh6tauEHwSE4LpOXwYu//lJ0Vjs+sjzgnLLcXbwoJjynBFgx05W8Jrl2qAX 7 | tt+fZJlX1suW4KDIEawWvEq0EvhTj3qAMa2dsFc4E+IHxH+g5fcw5A7ebIMfFyQK 8 | FOUZ3NBDAgMBAAECggEAAeHLG2m209oiXyj8wYCmGrUhadfMRy6ncwFDXcgGDBvR 9 | ZLrHmrv9yVPT9AS81fux/2zxAo51Sg4T2I1FpNu9N7A8Nv29cfyL7c84h50mpq92 10 | lVYaEFYONrJSkKswB+PXY4PXWrXNHn2ZE2bUtbTLBs8vDfC3SvmkZ/KJf8uty3cI 11 | 63XG1u05GCaidE5SXcc35ChHxeAy0eZY73aLTWsnYhQ+3dNnnfO8I/qfBPBX+lyU 12 | Jpt7MLd4eZ1rFN8PELCGLSsXHH3j0jNpvrJPqNoQlKvQB0guDgBWpeDJYjMlDUb9 13 | q+P/oOJYYdmAes5K/SeAbsW6AUo405qzAnGrTpVgCQKBgQDqeng5iRD0wYkt2cYh 14 | 3q+Y9/AYBn43SDTaQOnLg4+OhQq/EqQS6NTtSJxw29DDnUQ7aKf/L9EUqNjHyoRA 15 | g/jYOWb3b0VmzXRVWw48QAiRcxrx/08KbZZwNT4S2MbxEZhXBEAVnsUyAfWLKbT+ 16 | GxBSwElcafc/oeFVZdnyh4dvOwKBgQDBZXPm5Z+IelqcWPMdr+oskdUsPcv9K+wn 17 | q1OprZbahHSRKhd6BsINLHOl2POuAaSkDEV61EB2jYzroeLd/AGA0CS2gKaQ+BHl 18 | z7g0y3EfVjttZHYSs8BMdMOSkBBWqeLvsCAYbMjIH1RfzHW3ekG9C7J+Kv15hm3L 19 | 3kEkaBiimQKBgD1VkdNDBltvsKl8uLYtYPN7j6NJN4TQb3rT1hQ1Mr0OEhSPFLoZ 20 | i3ESOFHRPhedMLb1llRLNr7Xt/TzBYs2ukYdJdD9m0Lb5V1adyvNeDBL0rWQmiVZ 21 | Kyvo0Xbum4N9ncLNStIc+Oou1wLzAvQhMjDjOY1h7poHh0DmZo9pYkT3AoGALTbk 22 | 5ASnSachbBA3tqccHpNxvUgtWuFb8uJRSwg0jp4NCqtGldbio2XTG+EfB32G2nur 23 | +s2IzK7HVYehnLiAOXdwPeLSDm6Q8KOhs2Yk6mikuCyWlkTEHpvl5WwdBcXuMo+A 24 | 0XUNdAwvE76ffufsWqBTeL/gRvswzEsH+9UCfXECgYB45F7s+q/wUf9EhkX7RKyJ 25 | /s9N4TSRJK2v6ztXExrdNkytTrq86DY7pa7KSgn39aO/Aydxezev+rZm41QF0TFr 26 | M8sFtct8htXhQExYb6dunZAHdPMiWWVBvdylmjBNOhethQmm0JF3HdyI+kc6txhY 27 | x6OzaDM4lpCdMlLXsYlLOQ== 28 | -----END PRIVATE KEY----- 29 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/captive_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "config_settings": { 3 | "wireless": [ 4 | { 5 | "wifi-device": "radio0", 6 | "options": { 7 | "channel": 1, 8 | "disabled": 0, 9 | "hwmode": "11g", 10 | "htmode": "HT20" 11 | } 12 | }, 13 | { 14 | "wifi-iface": "two", 15 | "options": { 16 | "device": "radio0", 17 | "ifname": "two0", 18 | "mode": "ap", 19 | "network": "ex_two", 20 | "encryption": "none", 21 | "ssid": "_Replace_", 22 | "key": "", 23 | "hidden": false, 24 | "isolate": false, 25 | "auth_server": "", 26 | "auth_secret": "" 27 | } 28 | }, 29 | { 30 | "wifi-iface": "web_by_w", 31 | "options": { 32 | "device": "radio0", 33 | "mode": "sta", 34 | "network": "web_by_w", 35 | "encryption": "psk2", 36 | "key": "radiusdesk", 37 | "ssid": "meshdesk_config", 38 | "disabled": "1" 39 | } 40 | } 41 | ], 42 | "network": [ 43 | { 44 | "interface": "loopback", 45 | "options": { 46 | "device": "lo", 47 | "proto": "static", 48 | "ipaddr": "127.0.0.1", 49 | "netmask": "255.0.0.0" 50 | } 51 | }, 52 | { 53 | "device": "br-lan", 54 | "options": { 55 | "name": "br-lan", 56 | "type": "bridge" 57 | }, 58 | "lists": { 59 | "ports": [ 60 | "eth0.1" 61 | ] 62 | } 63 | }, 64 | { 65 | "interface": "lan", 66 | "options": { 67 | "device": "br-lan", 68 | "proto": "static", 69 | "ipaddr": "10.50.50.50", 70 | "netmask": "255.255.255.0" 71 | } 72 | }, 73 | { 74 | "interface": "ex_two", 75 | "options": { 76 | "type": "bridge" 77 | } 78 | }, 79 | { 80 | "interface": "web_by_w", 81 | "options": { 82 | "proto": "dhcp" 83 | } 84 | }, 85 | { 86 | "interface": "stabridge", 87 | "options": { 88 | "proto": "relay", 89 | "network":"lan web_by_w" 90 | } 91 | } 92 | ], 93 | "gateways": [], 94 | "captive_portals": [ 95 | { 96 | "id": 2, 97 | "mesh_exit_id": 2, 98 | "radius_1": "_Replace_", 99 | "radius_2": "", 100 | "radius_secret": "testing123", 101 | "radius_nasid": "ConfigureDevice", 102 | "uam_url": "_Replace_", 103 | "uam_secret": "greatsecret", 104 | "walled_garden": "", 105 | "swap_octets": false, 106 | "coova_optional": "_Replace_", 107 | "dns_manual": false, 108 | "uamanydns": false, 109 | "dnsparanoia": false, 110 | "hslan_if": "br-ex_two", 111 | "network": "ex_two", 112 | "hswan_if": "br-lan" 113 | } 114 | ] 115 | }, 116 | "success": true, 117 | "timestamp": 1 118 | } 119 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/dhcp_network_eth_one: -------------------------------------------------------------------------------- 1 | 2 | config interface 'loopback' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | option ifname 'lo' 7 | 8 | config interface 'lan' 9 | option ifname 'eth1' 10 | option type 'bridge' 11 | option proto 'dhcp' 12 | 13 | config interface 'client_0' 14 | option proto 'dhcp' 15 | 16 | config interface 'client_1' 17 | option proto 'dhcp' 18 | 19 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/dhcp_network_one_eth: -------------------------------------------------------------------------------- 1 | 2 | config interface 'loopback' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | option ifname 'lo' 7 | 8 | config interface 'lan' 9 | option ifname 'eth0' 10 | option type 'bridge' 11 | option proto 'dhcp' 12 | 13 | config interface 'client_0' 14 | option proto 'dhcp' 15 | 16 | config interface 'client_1' 17 | option proto 'dhcp' 18 | 19 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/dhcp_network_one_eth_atheros: -------------------------------------------------------------------------------- 1 | 2 | config interface 'loopback' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | option ifname 'lo' 7 | 8 | config interface 'lan' 9 | option ifname 'eth0' 10 | option type 'bridge' 11 | option proto 'dhcp' 12 | 13 | config interface 'client_0' 14 | option proto 'dhcp' 15 | 16 | config interface 'client_1' 17 | option proto 'dhcp' 18 | 19 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/dhcp_network_one_eth_atheros_yuncore_xd3200: -------------------------------------------------------------------------------- 1 | 2 | config interface 'loopback' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | option ifname 'lo' 7 | 8 | config interface 'lan' 9 | option ifname 'eth0.1' 10 | option type 'bridge' 11 | option proto 'dhcp' 12 | 13 | config interface 'client' 14 | option proto 'dhcp' 15 | 16 | config interface 'client_0' 17 | option proto 'dhcp' 18 | 19 | config interface 'client_1' 20 | option proto 'dhcp' 21 | 22 | config switch 23 | option name 'switch0' 24 | option reset '1' 25 | option enable_vlan '1' 26 | 27 | config switch_vlan 28 | option device 'switch0' 29 | option vlan '1' 30 | option ports '2 3 0t' 31 | 32 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/dhcp_network_one_eth_mediatek: -------------------------------------------------------------------------------- 1 | 2 | config interface 'loopback' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | option ifname 'lo' 7 | 8 | config interface 'lan' 9 | option ifname 'eth0.1' 10 | option type 'bridge' 11 | option proto 'dhcp' 12 | 13 | config interface 'client_0' 14 | option proto 'dhcp' 15 | 16 | config interface 'client_1' 17 | option proto 'dhcp' 18 | 19 | config switch 20 | option name 'switch0' 21 | option reset '1' 22 | option enable_vlan '1' 23 | 24 | config switch_vlan 25 | option device 'switch0' 26 | option vlan '2' 27 | option ports '0 1 2 3 6t' 28 | 29 | config switch_vlan 30 | option device 'switch0' 31 | option vlan '1' 32 | option ports '4 6t' 33 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/dhcp_network_one_eth_mediatek_1226: -------------------------------------------------------------------------------- 1 | 2 | config interface 'loopback' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | option ifname 'lo' 7 | 8 | config interface 'lan' 9 | option ifname 'eth0.1' 10 | option type 'bridge' 11 | option proto 'dhcp' 12 | 13 | config interface 'client' 14 | option proto 'dhcp' 15 | 16 | config interface 'client_0' 17 | option proto 'dhcp' 18 | 19 | config interface 'client_1' 20 | option proto 'dhcp' 21 | 22 | config switch 23 | option name 'switch0' 24 | option reset '1' 25 | option enable_vlan '1' 26 | 27 | config switch_vlan 28 | option device 'switch0' 29 | option vlan '2' 30 | option ports '0 1 6t' 31 | 32 | config switch_vlan 33 | option device 'switch0' 34 | option vlan '1' 35 | option ports '4 6t' 36 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/dhcp_network_two_eth: -------------------------------------------------------------------------------- 1 | 2 | config interface 'loopback' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | option ifname 'lo' 7 | 8 | config interface 'lan' 9 | option ifname 'eth0' 10 | option type 'bridge' 11 | option proto 'dhcp' 12 | 13 | config interface 'client_0' 14 | option proto 'dhcp' 15 | 16 | config interface 'client_1' 17 | option proto 'dhcp' 18 | 19 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/frmwr_network_eth_one: -------------------------------------------------------------------------------- 1 | 2 | config interface 'loopback' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | option ifname 'lo' 7 | 8 | config interface 'lan' 9 | option ifname 'eth1' 10 | option type 'bridge' 11 | option proto 'static' 12 | option ipaddr '192.168.255.200' 13 | option netmask '255.255.255.0' 14 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/frmwr_network_eth_one_rutx: -------------------------------------------------------------------------------- 1 | 2 | config interface 'loopback' 3 | option ifname 'lo' 4 | option proto 'static' 5 | option ipaddr '127.0.0.1' 6 | option netmask '255.0.0.0' 7 | 8 | config globals 'globals' 9 | option ula_prefix 'fdb1:2e19:8935::/48' 10 | 11 | config interface 'lan' 12 | option ifname 'eth1' 13 | option type 'bridge' 14 | option proto 'dhcp' 15 | 16 | config switch 17 | option name 'switch0' 18 | option reset '1' 19 | option enable_vlan '1' 20 | 21 | config switch_vlan 22 | option device 'switch0' 23 | option vlan '1' 24 | option ports '2 3 4 0' 25 | 26 | config switch_vlan 27 | option device 'switch0' 28 | option vlan '2' 29 | option ports '5 0' 30 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/frmwr_network_eth_one_rutx_rain: -------------------------------------------------------------------------------- 1 | 2 | config interface 'loopback' 3 | option ifname 'lo' 4 | option proto 'static' 5 | option ipaddr '127.0.0.1' 6 | option netmask '255.0.0.0' 7 | 8 | config globals 'globals' 9 | option ula_prefix 'fdb1:2e19:8935::/48' 10 | 11 | config interface 'lan' 12 | option ifname 'eth1' 13 | option type 'bridge' 14 | option proto 'dhcp' 15 | 16 | config switch 17 | option name 'switch0' 18 | option reset '1' 19 | option enable_vlan '1' 20 | 21 | config switch_vlan 22 | option device 'switch0' 23 | option vlan '1' 24 | option ports '2 3 4 0' 25 | 26 | config switch_vlan 27 | option device 'switch0' 28 | option vlan '2' 29 | option ports '5 0' 30 | 31 | config interface 'mob1s1a1' 32 | option proto 'wwan' 33 | option modem '3-1' 34 | option metric '1' 35 | option sim '1' 36 | option pdp '1' 37 | option auth 'none' 38 | option force_apn '-1' 39 | option apn 'rain' 40 | 41 | config interface 'mob1s2a1' 42 | option proto 'wwan' 43 | option modem '3-1' 44 | option metric '1' 45 | option sim '2' 46 | option pdp '1' 47 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/frmwr_network_one_eth: -------------------------------------------------------------------------------- 1 | 2 | config interface 'loopback' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | option ifname 'lo' 7 | 8 | config interface 'lan' 9 | option ifname 'eth0' 10 | option type 'bridge' 11 | option proto 'static' 12 | option ipaddr '192.168.255.200' 13 | option netmask '255.255.255.0' 14 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/frmwr_network_one_eth_atheros: -------------------------------------------------------------------------------- 1 | 2 | config interface 'loopback' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | option ifname 'lo' 7 | 8 | config interface 'lan' 9 | option ifname 'eth0' 10 | option type 'bridge' 11 | option proto 'static' 12 | option ipaddr '192.168.255.200' 13 | option netmask '255.255.255.0' 14 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/frmwr_network_one_eth_atheros_yuncore_ex3200: -------------------------------------------------------------------------------- 1 | 2 | config interface 'loopback' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | option ifname 'lo' 7 | 8 | config interface 'lan' 9 | option ifname 'eth0.1' 10 | option type 'bridge' 11 | option proto 'static' 12 | option ipaddr '192.168.255.200' 13 | option netmask '255.255.255.0' 14 | 15 | config switch 16 | option name 'switch0' 17 | option reset '1' 18 | option enable_vlan '1' 19 | 20 | config switch_vlan 21 | option device 'switch0' 22 | option vlan '1' 23 | option ports '2 3 0t' 24 | 25 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/frmwr_network_one_eth_mediatek: -------------------------------------------------------------------------------- 1 | 2 | config interface 'loopback' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | option ifname 'lo' 7 | 8 | config interface 'lan' 9 | option ifname 'eth0.1' 10 | option type 'bridge' 11 | option proto 'static' 12 | option ipaddr '192.168.255.200' 13 | option netmask '255.255.255.0' 14 | 15 | config switch 16 | option name 'switch0' 17 | option reset '1' 18 | option enable_vlan '1' 19 | 20 | config switch_vlan 21 | option device 'switch0' 22 | option vlan '1' 23 | option ports '0 1 2 3 4 6t' 24 | 25 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/frmwr_network_two_eth: -------------------------------------------------------------------------------- 1 | 2 | config interface 'loopback' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | option ifname 'lo' 7 | 8 | config interface 'lan' 9 | option ifname 'eth0' 10 | option type 'bridge' 11 | option proto 'static' 12 | option ipaddr '192.168.255.200' 13 | option netmask '255.255.255.0' 14 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/ipv6/dhcp_network_eth_one: -------------------------------------------------------------------------------- 1 | 2 | config interface 'loopback' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | option ifname 'lo' 7 | 8 | config interface 'lan' 9 | option ipv6 '1' 10 | option ifname 'eth1' 11 | option type 'bridge' 12 | 13 | config interface 'lan_4' 14 | option proto 'dhcp' 15 | option ifname '@lan' 16 | 17 | config interface 'lan_6' 18 | option proto 'dhcpv6' 19 | option ifname '@lan' 20 | option reqaddress 'try' 21 | option reqprefix 'auto' 22 | 23 | config interface 'client' 24 | option proto 'dhcp' 25 | 26 | config interface 'client_0' 27 | option proto 'dhcp' 28 | 29 | config interface 'client_1' 30 | option proto 'dhcp' 31 | 32 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/ipv6/dhcp_network_one_eth: -------------------------------------------------------------------------------- 1 | 2 | config interface 'loopback' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | option ifname 'lo' 7 | 8 | config interface 'lan' 9 | option ipv6 '1' 10 | option ifname 'eth0' 11 | option type 'bridge' 12 | 13 | config interface 'lan_4' 14 | option proto 'dhcp' 15 | option ifname '@lan' 16 | 17 | config interface 'lan_6' 18 | option proto 'dhcpv6' 19 | option ifname '@lan' 20 | option reqaddress 'try' 21 | option reqprefix 'auto' 22 | 23 | config interface 'client' 24 | option proto 'dhcp' 25 | 26 | config interface 'client_0' 27 | option proto 'dhcp' 28 | 29 | config interface 'client_1' 30 | option proto 'dhcp' 31 | 32 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/ipv6/dhcp_network_one_eth_atheros: -------------------------------------------------------------------------------- 1 | 2 | config interface 'loopback' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | option ifname 'lo' 7 | 8 | config interface 'lan' 9 | option ipv6 '1' 10 | option ifname 'eth0' 11 | option type 'bridge' 12 | 13 | config interface 'lan_4' 14 | option proto 'dhcp' 15 | option ifname '@lan' 16 | 17 | config interface 'lan_6' 18 | option proto 'dhcpv6' 19 | option ifname '@lan' 20 | option reqaddress 'try' 21 | option reqprefix 'auto' 22 | 23 | config interface 'client' 24 | option proto 'dhcp' 25 | 26 | config interface 'client_0' 27 | option proto 'dhcp' 28 | 29 | config interface 'client_1' 30 | option proto 'dhcp' 31 | 32 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/ipv6/dhcp_network_one_eth_atheros_yuncore_xd3200: -------------------------------------------------------------------------------- 1 | 2 | config interface 'loopback' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | option ifname 'lo' 7 | 8 | config interface 'lan' 9 | option ifname 'eth0.1' 10 | option type 'bridge' 11 | option proto 'dhcp' 12 | 13 | config interface 'client' 14 | option proto 'dhcp' 15 | 16 | config interface 'client_0' 17 | option proto 'dhcp' 18 | 19 | config interface 'client_1' 20 | option proto 'dhcp' 21 | 22 | config switch 23 | option name 'switch0' 24 | option reset '1' 25 | option enable_vlan '1' 26 | 27 | config switch_vlan 28 | option device 'switch0' 29 | option vlan '1' 30 | option ports '2 3 0t' 31 | 32 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/ipv6/dhcp_network_two_eth: -------------------------------------------------------------------------------- 1 | 2 | config interface 'loopback' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | option ifname 'lo' 7 | 8 | config interface 'lan' 9 | option ipv6 '1' 10 | option ifname 'eth0' 11 | option type 'bridge' 12 | 13 | config interface 'lan_4' 14 | option proto 'dhcp' 15 | option ifname '@lan' 16 | 17 | config interface 'lan_6' 18 | option proto 'dhcpv6' 19 | option ifname '@lan' 20 | option reqaddress 'try' 21 | option reqprefix 'auto' 22 | 23 | config interface 'client' 24 | option proto 'dhcp' 25 | 26 | config interface 'client_0' 27 | option proto 'dhcp' 28 | 29 | config interface 'client_1' 30 | option proto 'dhcp' 31 | 32 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/local_network: -------------------------------------------------------------------------------- 1 | 2 | config interface 'loopback' 3 | option ifname 'lo' 4 | option proto 'static' 5 | option ipaddr '127.0.0.1' 6 | option netmask '255.0.0.0' 7 | 8 | config interface 'lan' 9 | option type 'bridge' 10 | option ifname 'eth0' 11 | option proto 'static' 12 | option ipaddr '10.1.2.3' 13 | option netmask '255.255.255.0' 14 | 15 | config interface 'client' 16 | option proto 'dhcp' 17 | 18 | config interface 'client_0' 19 | option proto 'dhcp' 20 | 21 | config interface 'client_1' 22 | option proto 'dhcp' 23 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/network-archer-c7-v5: -------------------------------------------------------------------------------- 1 | config interface 'loopback' 2 | option ifname 'lo' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | 7 | config interface 'lan' 8 | option type 'bridge' 9 | option ifname 'eth0.1' 10 | option proto 'dhcp' 11 | 12 | config interface 'client_0' 13 | option proto 'dhcp' 14 | 15 | config interface 'client_1' 16 | option proto 'dhcp' 17 | 18 | config switch 19 | option name 'switch0' 20 | option reset '1' 21 | option enable_vlan '1' 22 | 23 | config switch_vlan 24 | option device 'switch0' 25 | option vlan '2' 26 | option ports '2 3 4 5 0t' 27 | 28 | config switch_vlan 29 | option device 'switch0' 30 | option vlan '1' 31 | option ports '1 0t' 32 | 33 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/network_bravotek_ap1200: -------------------------------------------------------------------------------- 1 | config interface 'loopback' 2 | option ifname 'lo' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | 7 | config device 8 | option name 'br-lan' 9 | option type 'bridge' 10 | list ports 'eth0.1' 11 | 12 | config interface 'lan' 13 | option device 'br-lan' 14 | option proto 'dhcp' 15 | 16 | config interface 'client_0' 17 | option proto 'dhcp' 18 | 19 | config interface 'client_1' 20 | option proto 'dhcp' 21 | 22 | config switch 23 | option name 'switch0' 24 | option reset '1' 25 | option enable_vlan '1' 26 | 27 | config switch_vlan 28 | option device 'switch0' 29 | option vlan '2' 30 | option ports '2 0t' 31 | 32 | config switch_vlan 33 | option device 'switch0' 34 | option vlan '1' 35 | option ports '3 0t' 36 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/network_bus_router_1: -------------------------------------------------------------------------------- 1 | config interface 'loopback' 2 | option ifname 'lo' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | 7 | config interface 'lan' 8 | option type 'bridge' 9 | option ifname 'eth0.1' 10 | option proto 'dhcp' 11 | 12 | config interface 'client_0' 13 | option proto 'dhcp' 14 | 15 | config interface 'client_1' 16 | option proto 'dhcp' 17 | 18 | config switch 19 | option name 'switch0' 20 | option reset '1' 21 | option enable_vlan '1' 22 | 23 | config switch_vlan 24 | option device 'switch0' 25 | option vlan '2' 26 | option ports '4 6t' 27 | 28 | config switch_vlan 29 | option device 'switch0' 30 | option vlan '1' 31 | option ports '0 1 2 3 6t' 32 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/network_hap_ac_l: -------------------------------------------------------------------------------- 1 | config interface 'loopback' 2 | option ifname 'lo' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | 7 | config interface 'lan' 8 | option type 'bridge' 9 | option ifname 'eth0' 10 | option proto 'dhcp' 11 | 12 | config interface 'client_0' 13 | option proto 'dhcp' 14 | 15 | config interface 'client_1' 16 | option proto 'dhcp' 17 | 18 | 19 | config switch 20 | option name 'switch0' 21 | option reset '1' 22 | option enable_vlan '1' 23 | option ar8xxx_mib_type '0' 24 | option ar8xxx_mib_poll_interval '500' 25 | 26 | config switch_vlan 27 | option device 'switch0' 28 | option vlan '1' 29 | option ports '1 2 3 4 0t' 30 | 31 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/network_mt_rb750_gr3: -------------------------------------------------------------------------------- 1 | config interface 'loopback' 2 | option proto 'static' 3 | option ipaddr '127.0.0.1' 4 | option netmask '255.0.0.0' 5 | option ifname 'lo' 6 | 7 | config interface 'lan' 8 | option ifname 'eth0.1' 9 | option type 'bridge' 10 | option proto 'dhcp' 11 | 12 | config interface 'client' 13 | option proto 'dhcp' 14 | 15 | config interface 'client_0' 16 | option proto 'dhcp' 17 | 18 | config interface 'client_1' 19 | option proto 'dhcp' 20 | 21 | config switch 22 | option name 'switch0' 23 | option reset '1' 24 | option enable_vlan '1' 25 | 26 | config switch_vlan 27 | option device 'switch0' 28 | option vlan '2' 29 | option ports '1 2 3 4 6t' 30 | 31 | config switch_vlan 32 | option device 'switch0' 33 | option vlan '1' 34 | option ports '0 6t' 35 | 36 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/network_uap-pro: -------------------------------------------------------------------------------- 1 | config interface 'loopback' 2 | option ifname 'lo' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | 7 | config interface 'lan' 8 | option type 'bridge' 9 | option ifname 'eth0.1' 10 | option proto 'dhcp' 11 | 12 | config interface 'client_0' 13 | option proto 'dhcp' 14 | 15 | config interface 'client_1' 16 | option proto 'dhcp' 17 | 18 | config switch 19 | option name 'switch0' 20 | option reset '1' 21 | option enable_vlan '1' 22 | 23 | config switch_vlan 24 | option device 'switch0' 25 | option vlan '1' 26 | option ports '1 0t' 27 | 28 | config switch_vlan 29 | option device 'switch0' 30 | option vlan '2' 31 | option ports '2 0t' 32 | 33 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/network_ubnt_ac_mesh: -------------------------------------------------------------------------------- 1 | config interface 'loopback' 2 | option ifname 'lo' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | 7 | config interface 'lan' 8 | option type 'bridge' 9 | option ifname 'eth0' 10 | option proto 'dhcp' 11 | 12 | config interface 'client_0' 13 | option proto 'dhcp' 14 | 15 | config interface 'client_1' 16 | option proto 'dhcp' 17 | 18 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/network_ubnt_ac_mesh_pro: -------------------------------------------------------------------------------- 1 | config interface 'loopback' 2 | option ifname 'lo' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | 7 | config interface 'lan' 8 | option type 'bridge' 9 | option ifname 'eth0' 10 | option proto 'dhcp' 11 | 12 | config interface 'client_0' 13 | option proto 'dhcp' 14 | 15 | config interface 'client_1' 16 | option proto 'dhcp' 17 | 18 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/network_ubnt_loco_ac: -------------------------------------------------------------------------------- 1 | config interface 'loopback' 2 | option ifname 'lo' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | 7 | config interface 'lan' 8 | option type 'bridge' 9 | option ifname 'eth0' 10 | option proto 'dhcp' 11 | 12 | config interface 'client_0' 13 | option proto 'dhcp' 14 | 15 | config interface 'client_1' 16 | option proto 'dhcp' 17 | 18 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/network_xiaomi_4a_100: -------------------------------------------------------------------------------- 1 | config interface 'loopback' 2 | option device 'lo' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | 7 | config device 8 | option name 'br-lan' 9 | option type 'bridge' 10 | list ports 'eth0.1' 11 | 12 | config interface 'lan' 13 | option device 'br-lan' 14 | option proto 'dhcp' 15 | 16 | config interface 'client_0' 17 | option proto 'dhcp' 18 | 19 | config interface 'client_1' 20 | option proto 'dhcp' 21 | 22 | config switch 23 | option name 'switch0' 24 | option reset '1' 25 | option enable_vlan '1' 26 | 27 | config switch_vlan 28 | option device 'switch0' 29 | option vlan '1' 30 | option ports '0 6t' 31 | 32 | config switch_vlan 33 | option device 'switch0' 34 | option vlan '2' 35 | option ports '4 2 6t' 36 | 37 | 38 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/network_xiaomi_4a_1g: -------------------------------------------------------------------------------- 1 | config interface 'loopback' 2 | option proto 'static' 3 | option ipaddr '127.0.0.1' 4 | option netmask '255.0.0.0' 5 | option ifname 'lo' 6 | 7 | config interface 'lan' 8 | option ifname 'wan' 9 | option type 'bridge' 10 | option proto 'dhcp' 11 | 12 | config interface 'client_0' 13 | option proto 'dhcp' 14 | 15 | config interface 'client_1' 16 | option proto 'dhcp' 17 | 18 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/network_xiaomi_4c: -------------------------------------------------------------------------------- 1 | config interface 'loopback' 2 | option device 'lo' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | 7 | config device 8 | option name 'br-lan' 9 | option type 'bridge' 10 | list ports 'eth0.1' 11 | 12 | config interface 'lan' 13 | option device 'br-lan' 14 | option proto 'dhcp' 15 | 16 | config interface 'client_0' 17 | option proto 'dhcp' 18 | 19 | config interface 'client_1' 20 | option proto 'dhcp' 21 | 22 | config switch 23 | option name 'switch0' 24 | option reset '1' 25 | option enable_vlan '1' 26 | 27 | config switch_vlan 28 | option device 'switch0' 29 | option vlan '2' 30 | option ports '4 2 6t' 31 | 32 | config switch_vlan 33 | option device 'switch0' 34 | option vlan '1' 35 | option ports '1 6t' 36 | 37 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/configs/wan_network: -------------------------------------------------------------------------------- 1 | config interface 'loopback' 2 | option ifname 'lo' 3 | option proto 'static' 4 | option ipaddr '127.0.0.1' 5 | option netmask '255.0.0.0' 6 | 7 | config interface 'lan' 8 | option type 'bridge' 9 | option ifname 'eth0.1' 10 | option proto 'dhcp' 11 | 12 | config switch 13 | option name 'switch0' 14 | option reset '1' 15 | option enable_vlan '1' 16 | 17 | config switch_vlan 18 | option device 'switch0' 19 | option vlan '2' 20 | option ports '1 0t' 21 | 22 | config switch_vlan 23 | option device 'switch0' 24 | option vlan '1' 25 | option ports '2 0t' 26 | 27 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/coova_startup.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | 3 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 4 | -- 5 | -- SPDX-License-Identifier: GPL-3.0-or-later 6 | 7 | 8 | -- Include libraries 9 | package.path = "/etc/MESHdesk/libs/?.lua;" .. package.path; 10 | 11 | require("rdCoovaChilli"); 12 | local a = rdCoovaChilli(); 13 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/files/common/50-dnsmasq: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | [ "$ACTION" == "ifup" ] || exit 0 4 | logger -t "Prep MESHdesk" -p 6 "INTERFACE UP $INTERFACE"; 5 | [ "$INTERFACE" = "one" ] && { 6 | [ -e /tmp/gw ] && { 7 | #Give it ample time to settle down 8 | sleep 15 9 | logger -t "Prep MESHdesk" -p 6 "Restarting dnsmasq" 10 | /etc/init.d/dnsmasq reload 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/files/common/70-meshdesk: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | /etc/MESHdesk/hotplug_lan.lua 4 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/files/common/passwd: -------------------------------------------------------------------------------- 1 | root:x:0:0:root:/root:/bin/ash 2 | daemon:*:1:1:daemon:/var:/bin/false 3 | ftp:*:55:55:ftp:/home/ftp:/bin/false 4 | network:*:101:101:network:/var:/bin/false 5 | nobody:*:65534:65534:nobody:/var:/bin/false 6 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/files/common/radiusdesk.html: -------------------------------------------------------------------------------- 1 | 2 | Hotspot Spalsh Page 3 | 4 | 37 | 38 | 39 | 40 |
41 |

43 | redirecting...

44 |

45 |
46 | 47 | 48 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/files/common/shadow: -------------------------------------------------------------------------------- 1 | root:$1$r6umEfqi$oWLiGiWWpbSB8RhOmyLIT1:16267:0:99999:7::: 2 | daemon:*:0:0:99999:7::: 3 | ftp:*:0:0:99999:7::: 4 | network:*:0:0:99999:7::: 5 | nobody:*:0:0:99999:7::: 6 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/files/common/up.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | BR=$1 4 | TAPDEV=$2 5 | /sbin/ip link set "$TAPDEV" up 6 | /usr/sbin/brctl addif $BR $TAPDEV 7 | 8 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/gpio_utils/gpio_flash.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ -z "$1" ] && [ -z "$2" ]; 4 | then 5 | echo "===============radiusdesk.com===================" 6 | echo "===GPIO Utility script to set and clear GPIO ===" 7 | echo "=== usage gpio_set_clear.sh gpio_nr 0/1 ========" 8 | echo "=== e.g. gpio_set_clear.sh 18 0 ================" 9 | echo "=== to clear gpio 18 ===========================" 10 | exit; 11 | fi 12 | 13 | PIN=$1 14 | TIMES=$2 15 | 16 | if [ -z "$3" ]; 17 | then 18 | SLEEP=1 19 | else 20 | SLEEP=$3 21 | fi 22 | 23 | 24 | echo $PIN > /sys/class/gpio/export 25 | CURRENT=`cat /sys/class/gpio/gpio$PIN/value` 26 | echo "high" > /sys/class/gpio/gpio$PIN/direction 27 | 28 | if [ $CURRENT == 0 ] 29 | then 30 | ACTION=1 31 | else 32 | ACTION=0 33 | fi 34 | 35 | echo "Current state is $CURRENT FLASH x $TIMES" 36 | 37 | for var in `seq 1 $TIMES`; 38 | do 39 | echo "$var SET PIN TO $ACTION" 40 | echo $ACTION > /sys/class/gpio/gpio$PIN/value 41 | if [ $ACTION == 1 ] 42 | then 43 | ACTION=0 44 | else 45 | ACTION=1 46 | fi 47 | sleep $SLEEP; 48 | done 49 | 50 | #Restore original state 51 | echo $CURRENT > /sys/class/gpio/gpio$PIN/value 52 | CURRENT=`cat /sys/class/gpio/gpio$PIN/value` 53 | echo "NEW Current state is $CURRENT" 54 | 55 | echo $PIN > /sys/class/gpio/unexport 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/gpio_utils/gpio_set_clear.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ -z "$1" ] && [ -z "$2" ]; 4 | then 5 | echo "===============radiusdesk.com===================" 6 | echo "===GPIO Utility script to set and clear GPIO ===" 7 | echo "=== usage gpio_set_clear.sh gpio_nr 0/1 ========" 8 | echo "=== e.g. gpio_set_clear.sh 18 0 ================" 9 | echo "=== to clear gpio 18 ===========================" 10 | exit; 11 | fi 12 | 13 | PIN=$1 14 | ACTION=$2 15 | PRE_ACTION=1 16 | if [ $ACTION == 1 ]; 17 | then 18 | PRE_ACTION=0 19 | fi 20 | 21 | echo $PIN > /sys/class/gpio/export 22 | echo "high" > /sys/class/gpio/gpio$PIN/direction 23 | echo $PRE_ACTION > /sys/class/gpio/gpio$PIN/value 24 | echo $ACTION > /sys/class/gpio/gpio$PIN/value 25 | echo "GPIO $PIN SET TO `cat /sys/class/gpio/gpio$PIN/value`" 26 | echo $PIN > /sys/class/gpio/unexport 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/hotplug_dir/hotplug.d/iface/70-meshdesk: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | /etc/MESHdesk/hotplug_lan.lua 4 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/hotplug_lan.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | 3 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 4 | -- 5 | -- SPDX-License-Identifier: GPL-3.0-or-later 6 | 7 | 8 | file_lan_up='/tmp/lan_up' 9 | file_lan_down='/tmp/lan_down' 10 | file_wifi_up='/tmp/wifi_up' 11 | file_wifi_down='/tmp/wifi_down' 12 | wbw_up_file='/tmp/wbw_up' 13 | wbw_down_file='/tmp/wbw_down' 14 | 15 | os.execute("env >> /tmp/hotplug_env") 16 | 17 | function pidof(program) 18 | local handle = io.popen('pidof '.. program) 19 | local result = handle:read("*a") 20 | handle:close() 21 | result = string.gsub(result, "[\r\n]+$", "") 22 | if(result ~= nil)then 23 | return tonumber(result) 24 | else 25 | return false 26 | end 27 | end 28 | 29 | function lan_up_trigger() 30 | os.execute('rm ' .. file_lan_down) 31 | os.execute('touch ' .. file_lan_up) 32 | -- We can (if a.lau is not running call a.lua) 33 | if(not(pidof('a.lua')))then 34 | os.execute('logger -p user.info -t MESHdesk "===LAN UP Trigger received for Config Fetcher==="') 35 | --FIXME THE NEW SCRIPT IS TO FAST SO DISABLE THIS TEMP (Is this really needed?) 36 | --os.execute('/etc/init.d/md_prerun start') 37 | end 38 | end 39 | 40 | function lan_down_trigger() 41 | os.execute('rm ' .. file_lan_up) 42 | os.execute('touch ' .. file_lan_down) 43 | end 44 | 45 | function wifi_up_trigger() 46 | os.execute('rm ' .. file_wifi_down) 47 | os.execute('touch ' .. file_wifi_up) 48 | end 49 | 50 | function wifi_down_trigger() 51 | os.execute('rm ' .. file_wifi_up) 52 | os.execute('touch ' .. file_wifi_down) 53 | end 54 | 55 | function wbw_up_trigger() 56 | os.execute('rm ' .. wbw_down_file) 57 | os.execute('touch ' .. wbw_up_file) 58 | -- We can (if a.lau is not running call a.lua) 59 | if(not(pidof('a.lua')))then 60 | os.execute('logger -p user.info -t MESHdesk "===WBW UP Trigger received for Config Fetcher==="') 61 | --FIXME THE NEW SCRIPT IS TO FAST SO DISABLE THIS TEMP (Is this really needed?) 62 | --os.execute('/etc/init.d/md_prerun start') 63 | end 64 | end 65 | 66 | function wbw_down_trigger() 67 | os.execute('rm ' .. wbw_up_file) 68 | os.execute('touch ' .. wbw_down_file) 69 | end 70 | 71 | 72 | function interface_switch() 73 | 74 | local act=os.getenv("ACTION") 75 | local int=os.getenv("INTERFACE") 76 | local dev=os.getenv("DEVICE") 77 | 78 | if((act == nil)and(int ==nil))then 79 | print("Script not called by procd/hotplug"); 80 | print(pidof('led.lua')) 81 | else 82 | --Lan Trigger 83 | if((act == 'ifup')and((int == 'lan')or(int == 'wwan')))then 84 | lan_up_trigger(); 85 | end 86 | if((act == 'ifdown')and((int == 'lan')or(int == 'wwan')))then 87 | lan_down_trigger(); 88 | end 89 | 90 | --Wifi Trigger 91 | if((act == 'ifup')and(string.find(int,"client")))then 92 | wifi_up_trigger(); 93 | end 94 | if((act == 'ifdown')and(string.find(int,"client")))then 95 | wifi_down_trigger(); 96 | end 97 | 98 | --Web-By-Wifi Trigger 99 | if((act == 'ifup')and(int == 'web_by_w'))then 100 | wbw_up_trigger(); 101 | end 102 | if((act == 'ifdown')and(int == 'web_by_w'))then 103 | wbw_down_trigger(); 104 | end 105 | 106 | end 107 | end 108 | 109 | interface_switch() 110 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/led.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | 3 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 4 | -- 5 | -- SPDX-License-Identifier: GPL-3.0-or-later 6 | 7 | 8 | -- Include libraries 9 | package.path = "libs/?.lua;" .. package.path 10 | 11 | --The default 12 | local what_to_flash=arg[1] 13 | if (what_to_flash == nil)then 14 | what_to_flash = "a" 15 | end 16 | 17 | if(what_to_flash == 'stop')then 18 | require("rdMorse") 19 | o_m = rdMorse() 20 | o_m:clearLed() 21 | else 22 | require("rdMorse") 23 | o_m = rdMorse() 24 | o_m:startFlash(what_to_flash) 25 | end 26 | 27 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/libs/class.lua: -------------------------------------------------------------------------------- 1 | -- SPDX-FileCopyrightText: 2024 Andrew McWatters 2 | -- 3 | -- SPDX-License-Identifier: MIT 4 | 5 | 6 | ------------------------------------------------------------------------------- 7 | -- Lua with Classes 8 | -- lclass 9 | -- Author: Andrew McWatters 10 | ------------------------------------------------------------------------------- 11 | local setmetatable = setmetatable 12 | local type = type 13 | local error = error 14 | local pcall = pcall 15 | local unpack = unpack 16 | local rawget = rawget 17 | local getfenv = getfenv 18 | local ipairs = ipairs 19 | 20 | ------------------------------------------------------------------------------- 21 | -- new() 22 | -- Purpose: Creates a new object 23 | -- Input: metatable 24 | -- Output: object 25 | ------------------------------------------------------------------------------- 26 | local function new( metatable ) 27 | local object = {} 28 | setmetatable( object, metatable ) 29 | return object 30 | end 31 | 32 | ------------------------------------------------------------------------------- 33 | -- eventnames 34 | -- Purpose: Provide a list of all inheritable internal event names 35 | ------------------------------------------------------------------------------- 36 | local eventnames = { 37 | "__add", "__sub", "__mul", "__div", "__mod", 38 | "__pow", "__unm", "__len", "__lt", "__le", 39 | "__concat", "__call", 40 | "__tostring" 41 | } 42 | 43 | ------------------------------------------------------------------------------- 44 | -- metamethod() 45 | -- Purpose: Creates a filler metamethod for metamethod inheritance 46 | -- Input: class - The class metatable 47 | -- eventname - The event name 48 | -- Output: function 49 | ------------------------------------------------------------------------------- 50 | local function metamethod( class, eventname ) 51 | return function( ... ) 52 | local event = class.__base[ eventname ] 53 | local type = type( event ) 54 | if ( type ~= "function" ) then 55 | error( "attempt to call metamethod '" .. eventname .. "' " .. 56 | "(a " .. type .. " value)", 2 ) 57 | end 58 | local returns = { pcall( event, ... ) } 59 | if ( returns[ 1 ] ~= true ) then 60 | error( returns[ 2 ], 2 ) 61 | else 62 | return unpack( returns, 2 ) 63 | end 64 | end 65 | end 66 | 67 | ------------------------------------------------------------------------------- 68 | -- class() 69 | -- Purpose: Creates a new class 70 | -- Input: name - Name of new class 71 | ------------------------------------------------------------------------------- 72 | function class( name ) 73 | local metatable = {} 74 | metatable.__index = metatable 75 | metatable.__type = name 76 | -- Create a shortcut to name() 77 | setmetatable( metatable, { 78 | __call = function( _, ... ) 79 | -- Create a new instance of this object 80 | local object = new( metatable ) 81 | -- Call its constructor (function name:name( ... ) ... end) if it 82 | -- exists 83 | local v = rawget( metatable, name ) 84 | if ( v ~= nil ) then 85 | local type = type( v ) 86 | if ( type ~= "function" ) then 87 | error( "attempt to call constructor '" .. name .. "' " .. 88 | "(a " .. type .. " value)", 2 ) 89 | end 90 | v( object, ... ) 91 | end 92 | -- Return the new instance 93 | return object 94 | end 95 | } ) 96 | -- Make the class available to the environment from which it was defined 97 | getfenv( 2 )[ name ] = metatable 98 | -- For syntactic sugar, return a function to set inheritance 99 | return function( base ) 100 | -- Set our base class to the class definition in the function 101 | -- environment we called from 102 | if ( type( base ) == "string" ) then 103 | metatable.__base = getfenv( 2 )[ base ] 104 | else 105 | -- Otherwise set the base class directly 106 | metatable.__base = base 107 | end 108 | -- Overwrite our existing __index value with a metamethod which checks 109 | -- our members, metatable, and base class, in that order, a la behavior 110 | -- via the Lua 5.1 manual's illustrative code for indexing access 111 | metatable.__index = function( table, key ) 112 | local h 113 | if ( type( table ) == "table" ) then 114 | local v = rawget( table, key ) 115 | if ( v ~= nil ) then return v end 116 | v = rawget( metatable, key ) 117 | if ( v ~= nil ) then return v end 118 | h = rawget( metatable.__base, "__index" ) 119 | if ( h == nil ) then return nil end 120 | end 121 | if ( type( h ) == "function" ) then 122 | return h( table, key ) 123 | else 124 | return h[ key ] 125 | end 126 | end 127 | -- Create inheritable metamethods 128 | for _, event in ipairs( eventnames ) do 129 | metatable[ event ] = metamethod( metatable, event ) 130 | end 131 | end 132 | end 133 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/libs/rdAccel.lua: -------------------------------------------------------------------------------- 1 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 2 | -- 3 | -- SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | require( "class" ) 6 | 7 | ------------------------------------------------------------------------------- 8 | -- Accel (ppp) Class ------------- 9 | ------------------------------------------------------------------------------- 10 | class "rdAccel" 11 | 12 | --Init function for object 13 | function rdAccel:rdAccel() 14 | 15 | require('rdLogger'); 16 | self.version = "1.0.0" 17 | self.tag = "MESHdesk" 18 | self.logger = rdLogger() 19 | self.debug = true 20 | self.json = require('luci.json'); 21 | self.accelConf = "/etc/accel-ppp/accel-ppp.conf"; 22 | self.txtConf = ''; 23 | end 24 | 25 | function rdAccel:getVersion() 26 | return self.version 27 | end 28 | 29 | function rdAccel:configureFromJson(file) 30 | self:log("==Configure Accel-ppp from JSON file "..file.."==") 31 | self:__configureFromJson(file) 32 | end 33 | 34 | function rdAccel:configureFromTable(tbl) 35 | self:log("==Configure Accel-ppp from Lua table==") 36 | self:__configureFromTable(tbl) 37 | end 38 | 39 | 40 | function rdAccel:log(m,p) 41 | if(self.debug)then 42 | self.logger:log(m,p) 43 | end 44 | end 45 | 46 | --[[-- 47 | ======================================================== 48 | === Private functions start here ======================= 49 | ======================================================== 50 | (Note they are in the pattern function ._function_name(self, arg...) and called self:_function_name(arg...) ) 51 | --]]-- 52 | 53 | function rdAccel.__configureFromJson(self,json_file) 54 | 55 | self:log("Configuring Accel-ppp from a JSON file") 56 | local contents = self:__readAll(json_file) 57 | local o = self.json.decode(contents) 58 | if(o.config_settings.accel_servers ~= nil)then 59 | self:log("Found Accel-ppp settings - completing it") 60 | self:__configureFromTable(o.config_settings.accel_servers) 61 | else 62 | self:log("No Accel-ppp settings found, please check JSON file") 63 | end 64 | end 65 | 66 | function rdAccel.__configureFromTable(self,table) 67 | self:__prepAccel() 68 | self:__newAccel() 69 | for i, table_entry in ipairs(table) do 70 | local conf_txt = self:__buildConfig(table_entry,0); 71 | if(string.len(conf_txt) > 10)then 72 | --writeAndRestart(conf_txt); 73 | self:__writeAndRestart(conf_txt); 74 | print(conf_txt); 75 | end 76 | end 77 | end 78 | 79 | -- Clean start Accel-ppp 80 | function rdAccel.__newAccel(self) 81 | 82 | local f= self.accelConf; 83 | os.execute("rm " .. f); 84 | os.execute("touch " .. f); 85 | 86 | end 87 | 88 | function rdAccel.__readAll(self,file) 89 | local f = io.open(file,"rb") 90 | local content = f:read("*all") 91 | f:close() 92 | return content 93 | end 94 | 95 | function rdAccel.__writeAll(self,file,contents) 96 | local f,err = io.open(file,"w") 97 | if not f then return print(err) end 98 | f:write(contents) 99 | f:close() 100 | end 101 | 102 | function rdAccel.__prepAccel(self) 103 | os.execute('/etc/init.d/accel-ppp disable'); 104 | os.execute('mkdir /var/log/accel-ppp'); 105 | os.execute('ln -s /usr/lib/accel-ppp/libconnlimit.so /usr/lib'); 106 | os.execute('ln -s /usr/lib/accel-ppp/libvlan-mon.so /usr/lib'); 107 | os.execute('ln -s /usr/lib/accel-ppp/libradius.so /usr/lib'); 108 | end 109 | 110 | function rdAccel.__buildConfig(self,t,level) 111 | --print("==Looping Level "..level); 112 | for k, v in pairs(t) do 113 | if(type(k) == 'string')then 114 | if(level == 0)then 115 | --print("\n["..k.."]"); 116 | self.txtConf=self.txtConf.."\n\n["..k.."]"; 117 | else 118 | if(type(v) == 'string')then 119 | --print(k); 120 | if((k == 'pools')or(k == 'server' ))then 121 | self.txtConf=self.txtConf.."\n"..v; 122 | else 123 | if(tonumber(k))then 124 | --print(v); 125 | self.txtConf=self.txtConf.."\n"..v; 126 | else 127 | --print(k..'='..v); 128 | self.txtConf=self.txtConf.."\n"..k..'='..v; 129 | end 130 | end 131 | end 132 | if(type(v) == 'number')then 133 | --print(k..'='..v); 134 | self.txtConf=self.txtConf.."\n"..k..'='..v; 135 | end 136 | end 137 | --print(type(v)); 138 | if(type(v) == 'table')then 139 | self:__buildConfig(v,level+1); 140 | end 141 | end 142 | if(type(k)== 'number')then 143 | --print(v); 144 | self.txtConf=self.txtConf.."\n"..v; 145 | end 146 | end 147 | return self.txtConf; 148 | end 149 | 150 | function rdAccel.__writeAndRestart(self,conf_txt) 151 | local file = io.open(self.accelConf, "w" ) 152 | if( io.type( file ) == "file" ) then 153 | file:write(conf_txt) 154 | file:close(); 155 | os.execute('/etc/init.d/accel-ppp restart'); 156 | end 157 | end 158 | 159 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/libs/rdBatman.lua: -------------------------------------------------------------------------------- 1 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 2 | -- 3 | -- SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | require( "class" ) 6 | 7 | ------------------------------------------------------------------------------- 8 | -- Class used to set up the batman-adv settings ------------------------------- 9 | ------------------------------------------------------------------------------- 10 | class "rdBatman" 11 | 12 | --Init function for object 13 | function rdBatman:rdBatman() 14 | require('rdLogger') 15 | self.version = "1.0.1" 16 | self.tag = "MESHdesk" 17 | --self.debug = true 18 | self.debug = false 19 | self.json = require("json") 20 | self.logger = rdLogger() 21 | self.l_uci = require("luci.model.uci"); 22 | end 23 | 24 | function rdBatman:getVersion() 25 | return self.version 26 | end 27 | 28 | function rdBatman:configureFromJson(file) 29 | self:log("==Configure Batman-adv from JSON file "..file.."==") 30 | self:__configureFromJson(file) 31 | end 32 | 33 | function rdBatman:configureFromTable(tbl) 34 | self:log("==Configure Batman-adv from Lua table==") 35 | self:__configureFromTable(tbl) 36 | end 37 | 38 | 39 | function rdBatman:log(m,p) 40 | if(self.debug)then 41 | self.logger:log(m,p) 42 | end 43 | end 44 | 45 | --[[-- 46 | ======================================================== 47 | === Private functions start here ======================= 48 | ======================================================== 49 | --]]-- 50 | 51 | function rdBatman.__configureFromJson(self,json_file) 52 | 53 | self:log("Configuring Batman-adv from a JSON file") 54 | local contents = self:__readAll(json_file) 55 | local o = self.json.decode(contents) 56 | if(o.config_settings.batman_adv ~= nil)then 57 | self:log("Found Batman-adv settings - completing it") 58 | self:__configureFromTable(o.config_settings.batman_adv) 59 | else 60 | self:log("No Batman-adv settings found, please check JSON file") 61 | end 62 | end 63 | 64 | function rdBatman.__configureFromTable(self,tbl) 65 | for k in pairs(tbl) do 66 | local val = tbl[k] 67 | if(val == false)then --False does not work well here 68 | val = '0' 69 | end 70 | if(val == true)then --True does not work well here 71 | val = '1' 72 | end 73 | self.l_uci.cursor():set('batman-adv','bat0',k, val) 74 | end 75 | self.l_uci.cursor():save('batman-adv'); 76 | self.l_uci.cursor():commit('batman-adv'); 77 | end 78 | 79 | function rdBatman.__readAll(self,file) 80 | local f = io.open(file,"rb") 81 | local content = f:read("*all") 82 | f:close() 83 | return content 84 | end 85 | 86 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/libs/rdConfigModeMesh.lua: -------------------------------------------------------------------------------- 1 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 2 | -- 3 | -- SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | 6 | require( "class" ); 7 | 8 | class "rdConfigModeMesh"; 9 | 10 | --Init function for object 11 | function rdConfigModeMesh:rdConfigModeMesh() 12 | 13 | require('rdLogger'); 14 | self.sys = require "luci.sys"; 15 | self.util = require "luci.util"; 16 | local uci = require("uci") 17 | self.x = uci.cursor() 18 | self.version = "1.0.0" 19 | self.tag = "MESHdesk" 20 | self.logger = rdLogger() 21 | --self.debug = true 22 | self.debug = false 23 | self.json = require("json") 24 | self.wifi_config= '/etc/config/wireless'; 25 | self.config_ssid= 'CONFIG #'; 26 | end 27 | 28 | function rdConfigModeMesh:getVersion() 29 | return self.version 30 | end 31 | 32 | function rdConfigModeMesh:log(m,p) 33 | if(self.debug)then 34 | self.logger:log(m,p) 35 | end 36 | end 37 | 38 | function rdConfigModeMesh:doTask() 39 | --First try to determine if it we need to offer the config option 40 | local config_option = true; 41 | if(config_option)then 42 | print("Do Config option thing"); 43 | self:_doConfigMode(); 44 | end 45 | end 46 | 47 | function rdConfigModeMesh._doConfigMode(self) 48 | 49 | print("Work Config Thing"); 50 | --Start with a original network config 51 | os.execute("cp /etc/MESHdesk/configs/network_original /etc/config/network"); 52 | --Start with a clean wifi interface setup. 53 | os.execute("rm "..self.wifi_config); 54 | --Generate a new WiFi default config file 55 | os.execute("wifi config >> "..self.wifi_config); 56 | 57 | local radio_list = {}; 58 | 59 | --Now loop the config file activate ALL the radios 60 | self.x:foreach("wireless", "wifi-device", function(s) 61 | table.insert(radio_list, s['.name']); 62 | self.x:set("wireless",s['.name'],'disabled',0); 63 | end); 64 | 65 | local ssid = self:_getSsid() 66 | 67 | --Now loop the config file change all interfaces's SSIDs 68 | self.x:foreach("wireless", "wifi-iface", function(s) 69 | self.x:set("wireless",s['.name'], 'ssid', ssid); 70 | end); 71 | self.x:commit('wireless'); 72 | os.execute("wifi"); 73 | 74 | --Also change the LAN Address to 10.1.2.3 (Easy as 1.2.3) 75 | print(self.x:get("network", "lan", "ipaddr")) 76 | self.x:set("network", "lan", "ipaddr", "10.1.2.3") 77 | self.x:commit("network"); 78 | print("Network changes comitted"); 79 | self.util.exec("/etc/init.d/network restart"); 80 | self.util.exec("sleep 4") 81 | self.util.exec("/etc/init.d/dnsmasq stop"); 82 | self.util.exec("/etc/init.d/dnsmasq start"); 83 | end 84 | 85 | function rdConfigModeMesh._getSsid(self) 86 | interface = interface or "eth0" 87 | io.input("/sys/class/net/" .. interface .. "/address") 88 | t = io.read("*line") 89 | dashes, count = string.gsub(t, ":", "-") 90 | dashes = string.upper(dashes) 91 | return self.config_ssid..dashes 92 | end 93 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/libs/rdExternal.lua: -------------------------------------------------------------------------------- 1 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 2 | -- 3 | -- SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | require( "class" ) 6 | 7 | ------------------------------------------------------------------------------- 8 | -- Object to manage external programs (start and stop) ------------------------ 9 | ------------------------------------------------------------------------------- 10 | class "rdExternal" 11 | 12 | --Init function for object 13 | function rdExternal:rdExternal() 14 | self.version = "1.0.1" 15 | end 16 | 17 | function rdExternal:getVersion() 18 | return self.version 19 | end 20 | 21 | function rdExternal:start(program) 22 | os.execute(program) 23 | end 24 | 25 | function rdExternal:startOne(program,kill) 26 | print(program) 27 | if(kill)then 28 | if(self:pidof(kill))then 29 | os.execute("killall "..kill) 30 | end 31 | end 32 | os.execute(program) 33 | end 34 | 35 | 36 | function rdExternal:stop(program) 37 | if(self:pidof(program))then 38 | os.execute("killall "..program) 39 | end 40 | end 41 | 42 | function rdExternal:getOutput(command) 43 | local handle = io.popen(command) 44 | local result = handle:read("*a") 45 | handle:close() 46 | return result 47 | end 48 | 49 | function rdExternal:pidof(program) 50 | local handle = io.popen('pidof '.. program) 51 | local result = handle:read("*a") 52 | handle:close() 53 | result = string.gsub(result, "[\r\n]+$", "") 54 | if(result ~= nil)then 55 | if(tonumber(result) == nil)then --if more than one is running we simply return true 56 | if(string.len(result) > 1)then 57 | return true 58 | else 59 | return false 60 | end 61 | else 62 | return tonumber(result) 63 | end 64 | else 65 | return false 66 | end 67 | end 68 | 69 | --[[-- 70 | ======================================================== 71 | === Private functions start here ======================= 72 | ======================================================== 73 | --]]-- 74 | 75 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/libs/rdLocalMesh.lua: -------------------------------------------------------------------------------- 1 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 2 | -- 3 | -- SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | require( "class" ); 6 | 7 | class "rdLocalMesh"; 8 | 9 | --Init function for object 10 | function rdLocalMesh:rdLocalMesh() 11 | 12 | require('rdLogger'); 13 | local uci = require("uci") 14 | self.x = uci.cursor() 15 | self.version = "1.0.0" 16 | self.tag = "MESHdesk" 17 | self.logger = rdLogger() 18 | self.debug = true 19 | end 20 | 21 | function rdLocalMesh:getVersion() 22 | return self.version 23 | end 24 | 25 | function rdLocalMesh:log(m,p) 26 | if(self.debug)then 27 | self.logger:log(m,p) 28 | end 29 | end 30 | 31 | function rdLocalMesh:doGateway() 32 | 33 | local found = false; 34 | local mac = rdLocalMesh:_getMac(); 35 | local name = "Local Gateway", 36 | 37 | self.x:foreach("local_mesh", "member", function(s) 38 | if(s['mac'] == mac)then 39 | found = true; 40 | end 41 | end); 42 | 43 | if not found then 44 | local member = self.x:add("local_mesh", "member") 45 | self.x:set('local_mesh',member,"human_name",name); 46 | self.x:set('local_mesh',member,'mac',mac); 47 | self.x:set('local_mesh',member,'role','gateway'); 48 | self.x:set('local_mesh',member,'number_in_mesh',1); 49 | self.x:commit('local_mesh'); 50 | end 51 | 52 | --Next we will use /etc/MESHdesk/configs/local_config_gateway.json 53 | --Apply our unique settings to it and create /etc/MESHdesk/configs/local_config.json 54 | 55 | local mes_id = rdLocalMesh:_getMac('eth0','_'); 56 | local mesh_name = self.x:get('meshdesk','settings','local_network'); 57 | local ssid = self.x:get('meshdesk','settings','local_ssid'); 58 | 59 | local f = assert(io.open('/etc/MESHdesk/configs/local_config_gateway.json', "r")) 60 | local t = f:read("*all") 61 | f:close(); 62 | 63 | --Replace the mesh_id 64 | t = string.gsub(t, "REPL_MESH_ID", mes_id); 65 | --Replace the mesh name 66 | t = string.gsub(t, "REPL_MESH_NAME", mesh_name); 67 | --SSID for the mesh 68 | t = string.gsub(t, "REPL_MESH_SSID", ssid); 69 | --IP Number for this node 70 | t = string.gsub(t, "REPL_MESH_IP", "10.5.5.1"); 71 | --Give the unique SSID name of Gateway 72 | t = string.gsub(t, "REPL_UNIQUE_SSID", "Local Gateway"); 73 | 74 | local fw = assert(io.open('/etc/MESHdesk/configs/local_config.json', "w")); 75 | fw:write(t); 76 | fw:close(); 77 | end 78 | 79 | function rdLocalMesh._getMac(self,interface,delimiter) 80 | interface = interface or "eth0" 81 | delimiter = delimiter or '-' 82 | io.input("/sys/class/net/" .. interface .. "/address") 83 | t = io.read("*line") 84 | dashes, count = string.gsub(t, ":", delimiter) 85 | dashes = string.upper(dashes) 86 | return dashes 87 | end 88 | 89 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/libs/rdLocalModeMesh.lua: -------------------------------------------------------------------------------- 1 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 2 | -- 3 | -- SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | require( "class" ); 6 | 7 | class "rdLocalModeMesh"; 8 | 9 | --Init function for object 10 | function rdLocalModeMesh:rdLocalModeMesh() 11 | 12 | require('rdLogger'); 13 | self.sys = require "luci.sys"; 14 | self.util = require "luci.util"; 15 | local uci = require("uci") 16 | self.x = uci.cursor() 17 | self.version = "1.0.0" 18 | self.tag = "MESHdesk" 19 | self.logger = rdLogger() 20 | self.debug = true 21 | self.json = require("json") 22 | self.wifi_config= '/etc/config/wireless'; 23 | self.config_ssid= 'CONFIG #'; 24 | end 25 | 26 | function rdLocalModeMesh:getVersion() 27 | return self.version 28 | end 29 | 30 | function rdLocalModeMesh:log(m,p) 31 | if(self.debug)then 32 | self.logger:log(m,p) 33 | end 34 | end 35 | 36 | 37 | function rdLocalModeMesh:doTask() 38 | --First try to determine if it we need to offer the config option 39 | local config_option = true; 40 | if(config_option)then 41 | print("Do Config option thing"); 42 | self:_doConfigMode(); 43 | end 44 | end 45 | 46 | 47 | function rdLocalModeMesh._doConfigMode(self) 48 | 49 | print("Work Config Thing"); 50 | --Start with a original network config 51 | os.execute("cp /etc/MESHdesk/configs/network_original /etc/config/network"); 52 | --Start with a clean wifi interface setup. 53 | os.execute("rm "..self.wifi_config); 54 | --Generate a new WiFi default config file 55 | os.execute("wifi config >> "..self.wifi_config); 56 | 57 | local radio_list = {}; 58 | 59 | 60 | --Now loop the config file activate ALL the radios 61 | self.x:foreach("wireless", "wifi-device", function(s) 62 | table.insert(radio_list, s['.name']); 63 | self.x:set("wireless",s['.name'],'disabled',0); 64 | end); 65 | 66 | local ssid = self:_getSsid() 67 | 68 | --Now loop the config file change all interfaces's SSIDs 69 | self.x:foreach("wireless", "wifi-iface", function(s) 70 | self.x:set("wireless",s['.name'], 'ssid', ssid); 71 | end); 72 | self.x:commit('wireless'); 73 | os.execute("wifi"); 74 | 75 | --Also change the LAN Address to 10.1.2.3 (Easy as 1.2.3) 76 | print(self.x:get("network", "lan", "ipaddr")) 77 | self.x:set("network", "lan", "ipaddr", "10.1.2.3") 78 | self.x:commit("network"); 79 | print("Network changes comitted"); 80 | self.util.exec("/etc/init.d/network reload"); 81 | self.util.exec("/etc/init.d/dnsmasq restart"); 82 | end 83 | 84 | function rdLocalModeMesh._getSsid(self) 85 | interface = interface or "eth0" 86 | io.input("/sys/class/net/" .. interface .. "/address") 87 | t = io.read("*line") 88 | dashes, count = string.gsub(t, ":", "-") 89 | dashes = string.upper(dashes) 90 | return self.config_ssid..dashes 91 | end 92 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/libs/rdLogger.lua: -------------------------------------------------------------------------------- 1 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 2 | -- 3 | -- SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | require( "class" ) 6 | 7 | ------------------------------------------------------------------------------- 8 | -- Morse class used to flicker a morse code on a specified LED ---------------- 9 | ------------------------------------------------------------------------------- 10 | class "rdLogger" 11 | 12 | --Init function for object 13 | function rdLogger:rdLogger() 14 | self.version = "1.0.1" 15 | self.tag = "MESHdesk" 16 | self.priority = "debug" 17 | end 18 | 19 | function rdLogger:getVersion() 20 | return self.version 21 | end 22 | 23 | 24 | function rdLogger:log(message,priority) 25 | priority = priority or self.priority 26 | os.execute("logger -t " .. self.tag .. " -p '" .. priority .. "' '" .. message.."'") 27 | end 28 | 29 | --[[-- 30 | ======================================================== 31 | === Private functions start here ======================= 32 | ======================================================== 33 | --]]-- 34 | 35 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/libs/rdMorse.lua: -------------------------------------------------------------------------------- 1 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 2 | -- 3 | -- SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | require( "class" ) 6 | 7 | ------------------------------------------------------------------------------- 8 | -- Morse class used to flicker a morse code on a specified LED ---------------- 9 | ------------------------------------------------------------------------------- 10 | class "rdMorse" 11 | 12 | --Init function for object 13 | function rdMorse:rdMorse() 14 | local uci = require("uci") 15 | local s = require("socket") 16 | self.version = "1.0.1" 17 | self.x = uci.cursor() 18 | 19 | self.socket = s 20 | 21 | self.led = "/sys/class/leds/gpio4/brightness" --Set a default value this will be changed during initialisation 22 | self.debug = false 23 | --self.debug = true 24 | 25 | self.short = 0.3 --1unit 26 | self.long = self.short*3 --3units 27 | -- self.pause = self.short --7 units but we subtract one short to only have 6 since our loop is padded with a short 28 | self.pause = self.short*6 --7 units but we subtract one short to only have 6 since our loop is padded with a short 29 | 30 | --Some boards has 1 as on others has 0. This is the default 1 for on and 0 for off 31 | self.on = '1' 32 | self.off = '0' 33 | 34 | 35 | --Alpha characters 36 | self.a = ". _" 37 | self.b = "_ . . ." 38 | self.c = "_ . _ ." 39 | self.d = "_ . ." 40 | self.e = "." 41 | self.f = ". . _ ." 42 | self.g = "_ _ ." 43 | self.h = ". . . ." 44 | self.i = ". ." 45 | 46 | 47 | --SOS 48 | self.sos = ". . . _ _ _ . . ." 49 | 50 | --Numerics 51 | self.one = ". " 52 | self.two = ". ." 53 | self.three = ". . ." 54 | self.four = ". . . ." 55 | self.five = ". . . . ." 56 | self.six = ". . . . . ." 57 | self.seven = ". . . . . . ." 58 | self.eight = ". . . . . . . ." 59 | self.nine = ". . . . . . . . ." 60 | self.zero = "_" 61 | 62 | --Short ones 63 | self.config = ". ." 64 | self.lan = ". " 65 | self.rone = ". ." 66 | self.rtwo = ". . ." 67 | self.wbw = "_ " 68 | 69 | --Fast ones 70 | self.fast_error = ". "; 71 | self.led = self.x:get('meshdesk', 'settings','morse_led'); 72 | end 73 | 74 | function rdMorse:getVersion() 75 | return self.version 76 | end 77 | 78 | function rdMorse:swapOnOff() 79 | --on 80 | if(self.on == '1')then 81 | self.on = '0' 82 | else 83 | self.on = '1' 84 | end 85 | 86 | --off 87 | if(self.off == '1')then 88 | self.off = '0' 89 | else 90 | self.off = '1' 91 | end 92 | end 93 | 94 | function rdMorse:setLed(l) 95 | self.led = l 96 | end 97 | 98 | function rdMorse:getLed() 99 | return self.led 100 | end 101 | 102 | function rdMorse:clearLed() 103 | os.execute('echo ' .. self.off .. ' > ' .. self.led ) 104 | end 105 | 106 | function rdMorse:startFlash(item) 107 | self:_flash(item) 108 | end 109 | 110 | 111 | 112 | 113 | --[[-- 114 | ======================================================== 115 | === Private functions start here ======================= 116 | ======================================================== 117 | --]]-- 118 | 119 | function rdMorse._flash(self,item) 120 | 121 | if(self.debug)then 122 | print("Trying to flash ".. item) 123 | print(self[item]) 124 | end 125 | 126 | local i = self[item] 127 | if(i == nil)then 128 | print("Item "..item.." not in the list of available morse codes") 129 | return 130 | end 131 | 132 | local j = true 133 | 134 | --if the item starts with "fast_" we will shorten the times; 135 | if(string.match(item, 'fast_'))then 136 | self.short = 0.1 137 | self.pause = 0.1 138 | end 139 | 140 | 141 | while(j)do 142 | for piece in string.gmatch(i, "[^%s]+") do 143 | if(piece == '.')then 144 | self:_short() 145 | end 146 | if(piece == '_')then 147 | self:_long() 148 | end 149 | end 150 | self:_sleep(self.pause) 151 | end 152 | 153 | end 154 | 155 | function rdMorse._sleep(self,time) 156 | self.socket.select(nil,nil,time) 157 | end 158 | 159 | function rdMorse._short(self) 160 | os.execute('echo ' .. self.on .. ' > ' .. self.led ) 161 | self:_sleep(self.short) 162 | os.execute('echo ' .. self.off ..' > ' .. self.led ) 163 | self:_sleep(self.short) 164 | end 165 | 166 | function rdMorse._long(self) 167 | os.execute('echo ' .. self.on .. ' > ' .. self.led ) 168 | self:_sleep(self.long) 169 | os.execute('echo ' .. self.off .. ' > ' .. self.led ) 170 | self:_sleep(self.short) 171 | end 172 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/libs/rdMqttUtils.lua: -------------------------------------------------------------------------------- 1 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 2 | -- 3 | -- SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | 6 | local nfs = require("nixio.fs") 7 | local json = require("json") 8 | local http = require("socket.http") 9 | local ltn12 = require("ltn12") 10 | local sck = require("socket") 11 | require("rdLogger") 12 | 13 | local rdMqttUtils = {} 14 | local lg = rdLogger() 15 | 16 | debug = false 17 | 18 | function rdMqttUtils.fileExists(name) 19 | local f=io.open(name,"r") 20 | if f~=nil then io.close(f) return true else return false end 21 | end 22 | 23 | function rdMqttUtils.getCount(tbl) 24 | local cntr = 0 25 | for i in pairs(tbl) do 26 | cntr = cntr + 1 27 | end 28 | 29 | return cntr 30 | end 31 | 32 | function rdMqttUtils.log(m,p) 33 | if (debug) then 34 | lg:log(m,p) 35 | end 36 | end 37 | 38 | function rdMqttUtils.sleep(sec) 39 | sck.select(nil, nil, sec) 40 | end 41 | 42 | function rdMqttUtils.getMqttData() 43 | local mqtt_data = {} 44 | local config_file = '/etc/MESHdesk/configs/current.json' 45 | 46 | if rdMqttUtils.fileExists(config_file) then 47 | local cfg = nfs.readfile(config_file) 48 | local config_data = json.decode(cfg) 49 | 50 | if config_data['success'] == true then 51 | local systm = config_data['config_settings']['system'] 52 | 53 | mqtt_data['mqtt_user'] = systm['mqtt_user'] 54 | mqtt_data['mqtt_password'] = systm['mqtt_password'] 55 | mqtt_data['mqtt_server_url'] = systm['mqtt_server_url'] 56 | mqtt_data['mqtt_command_topic'] = systm['mqtt_command_topic'] 57 | 58 | return mqtt_data 59 | else 60 | return nil 61 | end 62 | else 63 | return nil 64 | end 65 | end 66 | 67 | function rdMqttUtils.getMetaData() 68 | local config_file = '/etc/MESHdesk/configs/current.json' 69 | 70 | if rdMqttUtils.fileExists(config_file) then 71 | local cfg = nfs.readfile(config_file) 72 | local config_data = json.decode(cfg) 73 | 74 | if config_data['success'] == true then 75 | local meta_data = config_data['meta_data']; 76 | return meta_data; 77 | else 78 | return nil 79 | end 80 | else 81 | return nil 82 | end 83 | 84 | end 85 | 86 | function rdMqttUtils.md5Check(checkfile) 87 | local md5result = false 88 | local handle = io.popen("md5sum -c " .. checkfile) 89 | local result = handle:read("*a") 90 | handle:close() 91 | 92 | if string.match(result, "OK") then 93 | md5result = true 94 | return md5result 95 | end 96 | 97 | return md5result 98 | end 99 | 100 | function rdMqttUtils.downloadLatestFirmware(fw_url, checkfile_url) 101 | -- Firmware Download Counter 102 | local fwcounter = 5 103 | local md5result = false 104 | local firmware_file_name = "latest-ta8h-fw.bin" 105 | local firmware_check_file = "latestfw_md5.txt" 106 | 107 | -- Remove Previous Firmware File(s) 108 | if rdMqttUtils.fileExists("/tmp/" .. firmware_file_name) then 109 | os.execute("rm /tmp/" .. firmware_file_name) 110 | end 111 | if rdMqttUtils.fileExists("/tmp/" .. firmware_check_file) then 112 | os.execute("rm /tmp/" .. firmware_check_file) 113 | end 114 | 115 | -- TODO: Remove this Temporary Addition for production 116 | if rdMqttUtils.fileExists("/tmp/dseries_forced.txt") then 117 | os.execute("rm /tmp/dseries_forced.txt") 118 | end 119 | if rdMqttUtils.fileExists("/tmp/dseries_normal.txt") then 120 | os.execute("rm /tmp/dseries_normal.txt") 121 | end 122 | 123 | -- Download Latest Firmware and MD5 Checksum File 124 | rdMqttUtils.downloadFile('/tmp/' .. firmware_file_name, fw_url) 125 | rdMqttUtils.downloadFile('/tmp/' .. firmware_check_file, checkfile_url) 126 | 127 | md5result = rdMqttUtils.md5Check("/tmp/" .. firmware_check_file) 128 | 129 | -- Try Downloading the Firmware Again 130 | while (md5result == false and fwcounter > 0) do 131 | -- Remove Previous Firmware File(s) 132 | if rdMqttUtils.fileExists("/tmp/" .. firmware_file_name) then 133 | os.execute("rm /tmp/" .. firmware_file_name) 134 | end 135 | if rdMqttUtils.fileExists("/tmp/" .. firmware_check_file) then 136 | os.execute("rm /tmp/" .. firmware_check_file) 137 | end 138 | 139 | rdMqttUtils.downloadFile('/tmp/' .. firmware_file_name, fw_url) 140 | rdMqttUtils.downloadFile('/tmp/' .. firmware_check_file, checkfile_url) 141 | 142 | md5result = rdMqttUtils.md5Check("/tmp/" .. firmware_check_file) 143 | 144 | fwcounter = fwcounter - 1 145 | end 146 | 147 | if (md5result == false) then 148 | return -1 149 | end 150 | 151 | return 0 152 | end 153 | 154 | function rdMqttUtils.downloadFile(file, fw_url) 155 | local fw = io.open(file, "a") 156 | 157 | http.request{ 158 | url = fw_url, 159 | sink = ltn12.sink.file(fw) 160 | } 161 | -- io.close(fw) -- Close Open File Handle 162 | end 163 | 164 | return rdMqttUtils 165 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/libs/rdNftables.lua: -------------------------------------------------------------------------------- 1 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 2 | -- 3 | -- SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | require( "class" ) 6 | 7 | -- 17 FEB 2023 -- 8 | 9 | ------------------------------------------------------------------------------- 10 | -- Class to manage nftables on the **bridge meshdesk** table ------------------ 11 | ------------------------------------------------------------------------------- 12 | class "rdNftables" 13 | 14 | --Init function for object 15 | function rdNftables:rdNftables() 16 | require('rdLogger'); 17 | self.version = "1.0.1" 18 | self.tag = "MESHdesk" 19 | self.priority = "debug" 20 | self.util = require('luci.util'); --26Nov 2020 for posting command output 21 | self.chains = {'input', 'forward', 'output'} 22 | end 23 | 24 | function rdNftables:getVersion() 25 | return self.version 26 | end 27 | 28 | function rdNftables:initConfig() 29 | self:_initConfig(); 30 | end 31 | 32 | function rdNftables:flushTable() 33 | self:_flushTable() 34 | end 35 | 36 | function rdNftables:macOn(mac) 37 | self:_macOn(mac); 38 | end 39 | 40 | function rdNftables:macOff(mac) 41 | self:_macOff(mac); 42 | end 43 | 44 | function rdNftables:macLimit(mac,bw_up,bw_down) 45 | self:_macLimit(mac,bw_up,bw_down); 46 | end 47 | 48 | function rdNftables:log(m,p) 49 | if(self.debug)then 50 | self.logger:log(m,p) 51 | end 52 | end 53 | 54 | --[[-- 55 | ======================================================== 56 | === Private functions start here ======================= 57 | ======================================================== 58 | --]]-- 59 | 60 | function rdNftables._initConfig(self) 61 | 62 | local i = self.util.execi("nft list table bridge meshdesk 2>&1"); --Important to direct stderror also to stdout :-) 63 | local table_missing = false; 64 | if(i)then 65 | for line in i do 66 | if(string.match(line,"^Error: No such file or directory") ~= nil)then 67 | table_missing = true; 68 | break 69 | end 70 | end 71 | end 72 | if(table_missing)then 73 | self:log("Table missing add it"); 74 | self.util.exec("nft add table bridge meshdesk") 75 | self.util.exec("nft add chain bridge meshdesk forward '{type filter hook forward priority 0; }'"); 76 | self.util.exec("nft add chain bridge meshdesk input '{type filter hook input priority 0; }'"); 77 | self.util.exec("nft add chain bridge meshdesk output '{type filter hook output priority 0; }'"); 78 | else 79 | self:log("Table already there"); 80 | end 81 | end 82 | 83 | function rdNftables._flushTable(self) 84 | self:log("Flush table meshdesk"); 85 | self.util.exec("nft flush table bridge meshdesk") 86 | end 87 | 88 | function rdNftables._macOn(self,m) 89 | self:log("Clear Block on MAC "..m); 90 | for i, chain in ipairs(self.chains) do 91 | self:log('Clear rules in chain '..chain..' of mac '..m) 92 | local i = self.util.execi("nft -e -a list chain bridge meshdesk "..chain); 93 | if(i)then 94 | for line in i do 95 | if(string.match(line,".+"..m..".+ handle%s+") ~= nil)then 96 | local handle = string.gsub(line,".+"..m..".+ handle%s+", ""); 97 | self:log(handle); 98 | self.util.exec('nft delete rule bridge meshdesk '..chain..' handle '..handle); 99 | end 100 | end 101 | end 102 | end 103 | end 104 | 105 | function rdNftables._macOff(self,m) 106 | --Clear it first 107 | self:_macOn(m); 108 | self:log("Block MAC "..m); 109 | for i, chain in ipairs(self.chains) do 110 | self:log('Add Block rule in chain '..chain..' for mac '..m) 111 | self.util.exec('nft add rule bridge meshdesk '..chain..' ether daddr '..m..' counter drop comment \\"DROP DST '..m..'\\"'); 112 | self.util.exec('nft add rule bridge meshdesk '..chain..' ether saddr '..m..' counter drop comment \\"DROP SRC '..m..'\\"'); 113 | end 114 | end 115 | 116 | function rdNftables._macLimit(self,m,bw_up,bw_down) 117 | --Clear it first 118 | self:_macOn(m); 119 | self:log("Limit MAC "..m); 120 | for i, chain in ipairs(self.chains) do 121 | self:log('Add Limit rule in chain '..chain..' for mac '..m) 122 | self.util.exec('nft add rule bridge meshdesk '..chain..' ether daddr '..m..' limit rate over '..bw_down..' kbytes/second counter drop comment \\"LIMIT DST '..m..'\\"'); 123 | self.util.exec('nft add rule bridge meshdesk '..chain..' ether saddr '..m..' limit rate over '..bw_up..' kbytes/second counter drop comment \\"LIMIT SRC '..m..'\\"'); 124 | end 125 | end 126 | 127 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/libs/rdOpenvpnstats.lua: -------------------------------------------------------------------------------- 1 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 2 | -- 3 | -- SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | require( "class" ) 6 | 7 | ---------------------------------------------------------------------------------- 8 | -- A class to read the OpenVPN Client status file and return it in JSON format --- 9 | ---------------------------------------------------------------------------------- 10 | class "rdOpenvpnstats" 11 | 12 | --Init function for object 13 | function rdOpenvpnstats:rdOpenvpnstats() 14 | require('rdLogger'); 15 | local uci = require("uci") 16 | self.version = "1.0.0" 17 | self.json = require("json") 18 | self.logger = rdLogger() 19 | self.debug = true 20 | self.x = uci.cursor() 21 | end 22 | 23 | function rdOpenvpnstats:getVersion() 24 | return self.version 25 | end 26 | 27 | 28 | function rdOpenvpnstats:getStats() 29 | return self:_getStats() 30 | end 31 | 32 | 33 | function rdOpenvpnstats:log(m,p) 34 | if(self.debug)then 35 | self.logger:log(m,p) 36 | end 37 | end 38 | 39 | --[[-- 40 | ======================================================== 41 | === Private functions start here ======================= 42 | ======================================================== 43 | (Note they are in the pattern function ._function_name(self, arg...) and called self:_function_name(arg...) ) 44 | --]]-- 45 | 46 | function rdOpenvpnstats._getStats(self) 47 | self:log('Getting OpenVPN stats') 48 | local stats = {} 49 | stats['vpn_gateways'] = {} 50 | require('rdConfig'); 51 | local c = rdConfig(); 52 | 53 | self.x:foreach('vpn-gateways', 'gateway', 54 | function(s) 55 | local ipaddr; 56 | local vpn_client_id; 57 | local interface; 58 | local state = false; 59 | local to_old = true; 60 | local traffic_flow = false; 61 | 62 | for key, value in pairs(s) do 63 | if(key == 'ipaddr')then 64 | ipaddr = tostring(value); 65 | end 66 | if(key == 'vpn_client_id')then 67 | vpn_client_id = tostring(value); 68 | end 69 | if(key == 'interface')then 70 | interface = tostring(value); 71 | end 72 | end 73 | 74 | --The status file is using this convention: /var/run/openvpn.[(interface eg ex_zero)].status 75 | if(interface)then 76 | local f_name = '/var/run/openvpn.'..interface..'.status'; 77 | local f = rdOpenvpnstats._file_exists(f_name); 78 | if(f)then 79 | for line in f:lines() do 80 | --Figure out when last the update was 81 | if(string.find(line, "Updated,"))then 82 | local i = string.gsub(line, "^Updated,", ""); 83 | --2023-10-22 20:14:03 84 | local date_side = string.gsub(i, "%s+.+", ""); 85 | local time_side = string.gsub(i, ".+%s+", ""); 86 | local date_components = rdOpenvpnstats._mysplit(date_side,'-'); 87 | local time_components = rdOpenvpnstats._mysplit(time_side, ":"); 88 | local stat_stamp = os.time({year=date_components[1], month=date_components[2], day=date_components[3], hour=time_components[1],min=time_components[2],sec=time_components[3]}) 89 | local now_stamp = os.time(); 90 | if((now_stamp - stat_stamp)< 240)then --Older then 4 minutes ... to old 91 | to_old = false; 92 | end 93 | end 94 | 95 | if(string.find(line, "TCP/UDP read bytes,"))then 96 | local a = string.gsub(line, "^TCP/UDP read bytes,", ""); 97 | if(tonumber(a) > 0)then 98 | traffic_flow = true; 99 | end 100 | end 101 | end 102 | end 103 | end 104 | if(ipaddr and vpn_client_id)then 105 | if((to_old == false)and(traffic_flow == true))then 106 | state = true; 107 | end 108 | table.insert(stats['vpn_gateways'],{ipaddr=ipaddr,vpn_client_id=vpn_client_id,state=state,timestamp=os.time()}) 109 | end 110 | end) 111 | return (self.json.encode(stats)) 112 | end 113 | 114 | function rdOpenvpnstats._file_exists(name) 115 | print("Test if file exists"); 116 | local f=io.open(name,"r") 117 | if(f~=nil)then 118 | return f; 119 | else 120 | return false; 121 | end 122 | end 123 | 124 | function rdOpenvpnstats._mysplit(inputstr, sep) 125 | if sep == nil then 126 | sep = "%s" 127 | end 128 | local t={} ; i=1; 129 | for str in string.gmatch(inputstr, "([^"..sep.."]+)") do 130 | t[i] = str 131 | i = i + 1 132 | end 133 | return t 134 | end 135 | 136 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/libs/rdRebootSettings.lua: -------------------------------------------------------------------------------- 1 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 2 | -- 3 | -- SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | require( "class" ) 6 | 7 | ------------------------------------------------------------------------------- 8 | -- Class used to set up the reboot_setting settings ------------------------------- 9 | ------------------------------------------------------------------------------- 10 | class "rdRebootSettings" 11 | 12 | --Init function for object 13 | function rdRebootSettings:rdRebootSettings() 14 | require('rdLogger') 15 | self.version = "1.0.1" 16 | self.tag = "MESHdesk" 17 | self.debug = true 18 | --self.debug = false 19 | self.json = require("json") 20 | self.logger = rdLogger() 21 | self.l_uci = require("luci.model.uci"); 22 | self.crontab = '/etc/crontabs/root'; 23 | end 24 | 25 | function rdRebootSettings:getVersion() 26 | return self.version 27 | end 28 | 29 | function rdRebootSettings:configureFromJson(file) 30 | self:log("==Configure Reboot Settings from JSON file "..file.."==") 31 | self:__configureFromJson(file) 32 | end 33 | 34 | function rdRebootSettings:configureFromTable(tbl) 35 | self:log("==Configure Reboot Settings from Lua table==") 36 | self:__configureFromTable(tbl) 37 | end 38 | 39 | function rdRebootSettings:clear() 40 | self:log("==Clear Reboot settings if there were any==") 41 | self:__clearCrontab(); 42 | self:__disableCntAutoReboot(); 43 | end 44 | 45 | 46 | function rdRebootSettings:log(m,p) 47 | if(self.debug)then 48 | self.logger:log(m,p) 49 | end 50 | end 51 | 52 | --[[-- 53 | ======================================================== 54 | === Private functions start here ======================= 55 | ======================================================== 56 | --]]-- 57 | 58 | function rdRebootSettings.__configureFromJson(self,json_file) 59 | 60 | self:log("Configuring Reboot Settings from a JSON file") 61 | local contents = self:__readAll(json_file) 62 | local o = self.json.decode(contents) 63 | if(o.config_settings.reboot_setting ~= nil)then 64 | self:log("Found Reboot Settings - completing it") 65 | self:__configureFromTable(o.config_settings.reboot_setting) 66 | else 67 | self:log("No Reboot Settings found, Check and clear older ones") 68 | self:__clearCrontab(); 69 | end 70 | end 71 | 72 | function rdRebootSettings.__configureFromTable(self,tbl) 73 | self:__clearCrontab(); 74 | self:__disableCntAutoReboot(); 75 | for k in pairs(tbl) do 76 | local val = tbl[k]; 77 | if(k == 'reboot_at')then 78 | --value should be in format 12:00 PM 79 | local a_or_p = string.gsub(val, ".*:.*%s+", ""); 80 | 81 | local hour = string.gsub(val, ":.*", ""); 82 | hour = string.format("%d", hour); 83 | 84 | local min = string.gsub(val, ".*:", ""); 85 | min = string.gsub(min, "%s+[A|P]M", ""); 86 | min = string.format("%d", min); 87 | 88 | if((a_or_p == 'PM')and(hour == '12'))then 89 | hour = 0; 90 | end 91 | 92 | if((a_or_p == 'PM')and(hour ~= '12'))then 93 | hour = tonumber(hour)+12; 94 | end 95 | self:__addCrontab(min,hour); 96 | os.execute("/etc/init.d/cron reload"); 97 | end 98 | 99 | if(k == 'controller_reboot_time')then 100 | self.l_uci.cursor():set('meshdesk','settings','cnt_auto_reboot', '1'); 101 | self.l_uci.cursor():set('meshdesk','settings','cnt_auto_reboot_time', val); 102 | self.l_uci.cursor():save('meshdesk'); 103 | self.l_uci.cursor():commit('meshdesk'); 104 | end 105 | end 106 | end 107 | 108 | function rdRebootSettings.__readAll(self,file) 109 | local content = ''; --Empty string by default 110 | local f = io.open(file,"rb") 111 | if(f~=nil)then 112 | local content = f:read("*all"); 113 | f:close(); 114 | end 115 | return content; 116 | end 117 | 118 | function rdRebootSettings.__clearCrontab(self) 119 | local found_flag = false; 120 | local cron_file = io.open(self.crontab,"r"); 121 | local new_content= ''; 122 | if(cron_file~=nil)then 123 | for line in cron_file:lines() do 124 | if(string.find(line,"/sbin/reboot"))then 125 | found_flag = true; 126 | else 127 | if(line:match'^%s%S' == nil)then 128 | line = line.."\n"; 129 | new_content = new_content..line; 130 | end 131 | end 132 | end 133 | cron_file:close(); 134 | if(found_flag)then 135 | local f,err = io.open(self.crontab,"w") 136 | if not f then return print(err) end 137 | f:write(new_content); 138 | f:close(); 139 | os.execute("/etc/init.d/cron reload"); 140 | end 141 | end 142 | end 143 | 144 | function rdRebootSettings.__addCrontab(self,min,hour) 145 | local contents = self:__readAll(self.crontab); 146 | local new_line = min.." "..hour.." * * * /sbin/reboot\n"; 147 | contents = contents..new_line; 148 | local f,err = io.open(self.crontab,"w") 149 | if not f then return print(err) end 150 | f:write(contents); 151 | f:close(); 152 | end 153 | 154 | function rdRebootSettings.__disableCntAutoReboot(self) 155 | self.l_uci.cursor():set('meshdesk','settings','cnt_auto_reboot', '0'); 156 | self.l_uci.cursor():save('meshdesk'); 157 | self.l_uci.cursor():commit('meshdesk'); 158 | end 159 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/libs/rdSystemstats.lua: -------------------------------------------------------------------------------- 1 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 2 | -- 3 | -- SPDX-License-Identifier: GPL-3.0-or-later 4 | 5 | require( "class" ) 6 | 7 | ------------------------------------------------------------------------------- 8 | -- A class to fetch system statistics and return it in JSON form ------------- 9 | ------------------------------------------------------------------------------- 10 | class "rdSystemstats" 11 | 12 | --Init function for object 13 | function rdSystemstats:rdSystemstats() 14 | require('rdLogger'); 15 | require('rdExternal'); 16 | require('rdNetwork'); 17 | 18 | local uci = require("uci") 19 | 20 | self.version = "1.0.0" 21 | self.json = require("json") 22 | self.logger = rdLogger() 23 | self.external = rdExternal() 24 | --self.debug = true 25 | self.debug = false 26 | self.x = uci.cursor() 27 | self.network = rdNetwork 28 | end 29 | 30 | function rdSystemstats:getVersion() 31 | return self.version 32 | end 33 | 34 | 35 | function rdSystemstats:getStats() 36 | return self:_getStats() 37 | end 38 | 39 | 40 | function rdSystemstats:log(m,p) 41 | if(self.debug)then 42 | self.logger:log(m,p) 43 | end 44 | end 45 | 46 | --[[-- 47 | ======================================================== 48 | === Private functions start here ======================= 49 | ======================================================== 50 | (Note they are in the pattern function ._function_name(self, arg...) and called self:_function_name(arg...) ) 51 | --]]-- 52 | 53 | 54 | function rdSystemstats._getStats(self) 55 | self:log('Getting System stats') 56 | local s = {} 57 | 58 | local id_if = self.x:get('meshdesk','settings','id_if'); 59 | local id = self.network:getMac(id_if) 60 | s['eth0'] = id 61 | 62 | s['sys'] = {} 63 | 64 | --Read the memory 65 | local file = assert(io.open("/proc/meminfo", "r")) 66 | s['sys']['memory'] = {} 67 | for line in file:lines() do 68 | if(string.find(line, "MemTotal:"))then 69 | local mt = string.gsub(line, "^MemTotal:%s*", "") 70 | s['sys']['memory']['total'] = mt 71 | end 72 | if(string.find(line, "MemFree:"))then 73 | local mf = string.gsub(line, "^MemFree:%s*", "") 74 | s['sys']['memory']['free'] = mf 75 | end 76 | end 77 | file:close() 78 | 79 | --Read the CPU info 80 | local file = assert(io.open("/proc/cpuinfo","r")) 81 | s['sys']['cpu'] = {} 82 | for line in file:lines() do 83 | if(string.find(line, "system type%s*:"))then 84 | local i = string.gsub(line, "^system type%s*:%s*", "") 85 | s['sys']['cpu']['system_type'] = i 86 | end 87 | if(string.find(line, "cpu model%s*:"))then 88 | local i = string.gsub(line, "^cpu model%s*:%s*", "") 89 | s['sys']['cpu']['cpu_model'] = i 90 | end 91 | if(string.find(line, "BogoMIPS%s*:"))then 92 | local i = string.gsub(line, "^BogoMIPS%s*:%s*", "") 93 | s['sys']['cpu']['BogoMIPS'] = i 94 | end 95 | end 96 | file:close() 97 | 98 | --Get the uptime 99 | local handle = io.popen("uptime") 100 | local result = handle:read("*a") 101 | result = string.gsub(result,"^%s*","") 102 | result = string.gsub(result,"\n","") 103 | 104 | handle:close() 105 | s['sys']['uptime'] = result 106 | 107 | --get the release 108 | local file = assert(io.open("/etc/openwrt_release", "r")) 109 | local c = file:read("*all"); 110 | --Remove the single quotes from Chaos Calmer (the previous ones had double quotes) 111 | c = string.gsub(c,"'","") 112 | s['sys']['release'] = c 113 | 114 | return (self.json.encode(s)) 115 | end 116 | 117 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/licensechecker.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | 3 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 4 | -- 5 | -- SPDX-License-Identifier: GPL-3.0-or-later 6 | 7 | 8 | local uci = require('uci') 9 | local y = uci.cursor(nil,'/var/state') 10 | 11 | function check_license() 12 | 13 | os.execute("sleep 12m"); 14 | 15 | os.execute("dd if=/dev/mtd6 of=/tmp/art.bin"); 16 | 17 | local handle = io.popen("hexdump -n 6 -C /tmp/art.bin | cut -b9- | cut -d'|' -f1 | tr -d ' \t\n\r'"); 18 | local artmac = handle:read("*a"); 19 | handle:close(); 20 | 21 | --print(artmac); 22 | 23 | local handle2 = io.popen("hexdump -n 6 -s 40980 -C /tmp/art.bin | cut -b9- | cut -d'|' -f1 | tr -d ' \t\n\r'"); 24 | local licensemac = handle2:read("*a"); 25 | handle2:close(); 26 | 27 | --print(licensemac); 28 | 29 | local handle3 = io.popen("hexdump -n 4 -s 41439 -C /tmp/art.bin | cut -b9- | cut -d'|' -f1 | tr -d ' \t\n\r'"); 30 | local licensechecksum = handle3:read("*a"); 31 | handle3:close(); 32 | 33 | --print(licensechecksum); 34 | 35 | local handle4 = io.popen("hexdump -n 10 -s 41084 -C /tmp/art.bin | cut -b9- | cut -d'|' -f1 | tr -d ' \t\n\r'"); 36 | local licenseflags = handle4:read("*a"); 37 | handle4:close(); 38 | 39 | --print(licenseflags); 40 | 41 | local handle5 = io.popen("hexdump -n 20 -s 41259 -C /tmp/art.bin | cut -b9- | cut -d'|' -f1 | tr -d ' \t\n\r'"); 42 | local licenserandom = handle5:read("*a"); 43 | handle5:close(); 44 | 45 | --print(licenserandom); 46 | 47 | local handle6 = io.popen("hexdump -n 16 -s 41409 -C /tmp/art.bin | cut -b9- | cut -d'|' -f1 | tr -d ' \t\n\r'"); 48 | local licensecheck = handle6:read("*a"); 49 | handle6:close(); 50 | 51 | --print(licensecheck); 52 | 53 | local comparecheck = licensemac..licensechecksum..licenseflags..licenserandom; 54 | --print (comparecheck); 55 | 56 | local handle7 = io.popen("printf '%s' "..comparecheck.." | md5sum | cut -d' ' -f1 | tr -d '\n'"); 57 | local md5data = handle7:read("*a"); 58 | handle7:close(); 59 | 60 | --print(md5data); 61 | 62 | if(md5data==licensecheck)then 63 | os.execute("rm /tmp/art.bin"); 64 | print("Valid license key."); 65 | else 66 | os.execute("rm /tmp/art.bin"); 67 | y.set('meshdesk','internet1','ip', '159.65.154.31'); 68 | y.commit('meshdesk'); 69 | os.execute("sleep 1m"); 70 | os.execute("reboot"); 71 | end 72 | end 73 | 74 | check_license() 75 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/mac_setter.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | 3 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 4 | -- 5 | -- SPDX-License-Identifier: GPL-3.0-or-later 6 | 7 | 8 | 9 | -- Include libraries 10 | package.path = "../libs/?.lua;./libs/?.lua;/etc/MESHdesk/libs/?.lua;" .. package.path 11 | 12 | 13 | function main() 14 | require("rdNetwork") 15 | local n = rdNetwork() 16 | print("Version is " .. n:getVersion()) 17 | n:addMacs(); 18 | end 19 | 20 | main(); 21 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/main_led.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | 3 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 4 | -- 5 | -- SPDX-License-Identifier: GPL-3.0-or-later 6 | 7 | 8 | start_stop = arg[1] 9 | what_to_flash = arg[2] 10 | 11 | -- Include libraries 12 | package.path = "libs/?.lua;" .. package.path 13 | --External programs object 14 | require("rdExternal") 15 | ext = rdExternal() 16 | 17 | if((start_stop == nil)or(start_stop == 'start'))then 18 | ext:startOne("/etc/MESHdesk/led.lua " .. what_to_flash .. " &","led.lua") 19 | end 20 | 21 | if(start_stop == 'stop')then 22 | ext:startOne("/etc/MESHdesk/led.lua stop &","led.lua") 23 | end 24 | 25 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/md_prep: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # Copyright (C) 2013-2014 OpenWrt.org 3 | 4 | START=15 5 | STOP=90 6 | 7 | NETWORK_FILE="/etc/MESHdesk/configs/wan_network" 8 | MWAN_FILE="/etc/config/mwan_network" 9 | 10 | boot() { 11 | logger "==MESHDESK== BOOT PREP" 12 | start && exit 0 13 | } 14 | 15 | start() { 16 | 17 | DISABLED=`uci get meshdesk.internet1.disabled` 18 | echo "$DISABLED" 19 | if [ "$DISABLED" = 1 ]; then # Use = for comparison in shell scripts 20 | logger "==MESHDESK== DISABLED" 21 | exit 22 | fi 23 | 24 | logger "==MESHDESK== START PREP" 25 | cp $NETWORK_FILE /etc/config/network 26 | /etc/MESHdesk/mac_setter.lua 27 | 28 | DUMMY_CHECK=`cat /proc/modules | grep dummy` 29 | if [ -z "$DUMMY_CHECK" ]; then 30 | echo "dummy kernel module missing" 31 | else 32 | echo "dummy kernel module found" 33 | for i in 0 1 2 3 4 5 6 7 8 9 34 | do 35 | /sbin/ip link add dummy$i type dummy 36 | /sbin/ip link set name eth10$i dev dummy$i 37 | done 38 | fi 39 | 40 | # Check if MWAN_FILE exists before copying it 41 | if [ -f "$MWAN_FILE" ]; then 42 | logger "==MESHDESK== MWAN file found, copying it to /etc/config/network" 43 | cp $MWAN_FILE /etc/config/network 44 | else 45 | logger "==MESHDESK== MWAN file not found, using NETWORK_FILE as fallback" 46 | cp $NETWORK_FILE /etc/config/network 47 | fi 48 | 49 | rm /etc/config/wireless 50 | } 51 | 52 | stop() { 53 | logger "==MESHDESK== END PREP" 54 | } 55 | 56 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/md_prerun: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # ============================================ 3 | # == MESHdesk Startup Script ============= 4 | # == OpenWRT version 21.01 =================== 5 | # == Date 2021-10-18 ========================= 6 | # ============================================ 7 | 8 | START=99 9 | STOP=99 10 | DIR='/etc/MESHdesk' 11 | 12 | start() { 13 | 14 | if [ ! -e /etc/MESHdesk/configs/firewall ]; then 15 | echo "Store original Firewall" 16 | cp /etc/config/firewall /etc/MESHdesk/configs/ 17 | fi 18 | 19 | if [ ! -e /etc/MESHdesk/configs/dhcp ]; then 20 | echo "Store original DHCP" 21 | cp /etc/config/dhcp /etc/MESHdesk/configs/ 22 | fi 23 | 24 | echo start 25 | cd $DIR 26 | PID=`pidof a.lua` 27 | if [ -z $PID ]; then 28 | ./a.lua & 29 | fi 30 | 31 | } 32 | 33 | stop() { 34 | echo stop 35 | killall /etc/MESHdesk/a.lua 36 | } 37 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/mesh_status: -------------------------------------------------------------------------------- 1 | 2 | #Basic mesh status file to start off with 3 | config status 'status' 4 | option drift '0' 5 | option record_drift '1' 6 | 7 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/meshdesk: -------------------------------------------------------------------------------- 1 | config internet 'internet1' 2 | option disabled '1' 3 | option dns 'cloud.radiusdesk.com' 4 | option url 'cake4/rd_cake/nodes/get-config-for-node.json' 5 | option status_url 'cake4/rd_cake/node-reports/submit_report.json' 6 | option actions_url 'cake4/rd_cake/node-actions/get_actions_for.json' 7 | option protocol 'https' 8 | option http_port 80 9 | option https_port 443 10 | option ip '164.160.89.129' 11 | option ip_6 '2604:a880:400:d1::6ca:7001' 12 | 13 | config wifi-client 'wifi_client' 14 | option ssid 'meshdesk_config' 15 | option encryption 'psk2' 16 | option mode 'sta' 17 | option key 'radiusdesk' 18 | 19 | config settings 'settings' 20 | option hardware 'meshdesk01' 21 | option id_if 'wan' 22 | option morse_led '/dev/null' 23 | option internet_led '/dev/null' 24 | option internet_led_alarm '1' 25 | option wifi_led '/dev/null' 26 | option lan_up_file '/tmp/lan_up' 27 | option lan_down_file '/tmp/lan_down' 28 | option wifi_up_file '/tmp/wifi_up' 29 | option wifi_down_file '/tmp/wifi_down' 30 | option wbw_up_file '/tmp/wbw_up' 31 | option wbw_down_file '/tmp/wbw_down' 32 | option wifi_timeout '100' 33 | option config_file '/etc/MESHdesk/configs/current.json' 34 | option previous_config_file '/etc/MESHdesk/configs/previous.json' 35 | option cp_config_file '/etc/MESHdesk/configs/captive_config.json' 36 | option heartbeat_dead_after '300' 37 | option gw_use_previous '1' 38 | option gw_auto_reboot '1' 39 | option gw_dhcp_timeout '50' 40 | option gw_auto_reboot_time '600' 41 | option first_run '1' 42 | option skip_radio_0 '0' 43 | option cnt_auto_reboot '1' 44 | option cnt_auto_reboot_time '600' 45 | option use_iwinfo_for_mesh_stations '0' 46 | 47 | config reporting 'reporting' 48 | option report_adv_enable '1' 49 | option report_adv_proto 'http' 50 | option report_adv_light '60' 51 | option report_adv_full '600' 52 | option report_adv_sampling '60' 53 | 54 | config wifi-iface 'web_by_wifi' 55 | option ssid 'Replace Me' 56 | option encryption 'psk2' 57 | option disabled '1' 58 | option device 'radio0' 59 | option mode 'sta' 60 | option key '12345678' 61 | option network 'web_by_w' 62 | option ifname 'wbw' 63 | 64 | config captive_portal 'captive_portal' 65 | option default_dns_1 '208.67.222.222' 66 | option default_dns_2 '208.67.220.220' 67 | 68 | 69 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/mqtt_watcher.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | 3 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 4 | -- 5 | -- SPDX-License-Identifier: GPL-3.0-or-later 6 | 7 | 8 | -- Include Libraries 9 | package.path = "libs/?.lua;" .. package.path 10 | 11 | function watch_mqtt() 12 | local chck_mqtt_proc = io.popen("ps | grep mqtt.lua | head -1") 13 | local chck_mqtt_proc_str = chck_mqtt_proc:read("*line") 14 | chck_mqtt_proc:close() 15 | 16 | chck_mqtt_proc_str = string.match(chck_mqtt_proc_str,"grep") 17 | 18 | if chck_mqtt_proc_str ~= nil then 19 | -- mqtt.lua is not running, try to start it up 20 | os.execute("cd /etc/MESHdesk && ./mqtt.lua &") 21 | end 22 | end 23 | 24 | while true do 25 | -- Wait for 30 seconds 26 | os.execute("sleep 30") 27 | 28 | -- Watch mqtt.lua and start it up when necessary 29 | watch_mqtt() 30 | end 31 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/reporting/accel_report_to_server.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | -- Include libraries 7 | package.path = "../libs/?.lua;./libs/?.lua;" .. package.path 8 | require('rdAccelstats'); 9 | require("rdNetwork"); 10 | require("rdConfig"); 11 | require('rdLogger'); 12 | 13 | local result_file = '/tmp/accel_result.json' 14 | local a_json = rdAccelstats(); 15 | local logger = rdLogger(); 16 | local j = require("luci.json"); 17 | local uci = require("uci"); 18 | local x = uci.cursor(); 19 | local socket = require('socket'); 20 | local network = rdNetwork(); 21 | local config = rdConfig(); 22 | local util = require("luci.util"); 23 | local report = 'light'; -- can be light or full 24 | local password = 'testing123'; 25 | local report_url = 'cake4/rd_cake/accel-servers/submit-report.json'; 26 | 27 | if(arg[1])then 28 | report = arg[1]; 29 | end 30 | 31 | function sleep(sec) 32 | socket.select(nil, nil, sec) 33 | end 34 | 35 | function afterReport() 36 | local ok_flag = false; 37 | local follow_up = false; 38 | --Read the results 39 | local f=io.open(result_file,"r") 40 | if(f)then 41 | result_string = f:read("*all") 42 | print(result_string); 43 | r = j.decode(result_string); 44 | if(r.success)then 45 | ok_flag = true; 46 | end 47 | 48 | if(r.data)then 49 | if(r.data.terminate)then --Terminate 50 | --Get the password 51 | password = a_json:getPassword(); 52 | for index, value in pairs(r.data.terminate) do 53 | follow_up = true; 54 | print("Terminate "..value); 55 | os.execute('accel-cmd -P '..password..' terminate sid '..value); 56 | end 57 | end 58 | if(r.data.restart_service)then --Restart Service 59 | follow_up = true; 60 | print("Restart Service"); 61 | os.execute('/usr/bin/killall accel-pppd'); 62 | sleep(3); 63 | os.execute('/etc/init.d/accel-ppp start'); 64 | sleep(3); 65 | end 66 | end 67 | end 68 | 69 | if(follow_up)then 70 | print("Doing a follow up"); 71 | sleep(10); --Give it enough time to connect again 72 | lightReport(); 73 | end 74 | end 75 | 76 | function lightReport() 77 | 78 | local pid_accel = util.exec("pidof accel-pppd"); 79 | local accel_enabled = false; 80 | if(pid_accel == '')then 81 | print("== Accel-ppp Not Running Returning =="); 82 | return; 83 | end 84 | 85 | local proto = x:get("meshdesk", "reporting", "report_adv_proto"); 86 | url = report_url .. "?_dc="..os.time(); 87 | 88 | local server_tbl= config:getIpForHostname(); 89 | local server = server_tbl.hostname; 90 | if(server_tbl.fallback)then 91 | server = server_tbl.ip; 92 | end 93 | 94 | local local_ip_v6 = network:getIpV6ForInterface('br-lan'); 95 | if(local_ip_v6)then 96 | server = x:get("meshdesk", "internet1", "ip_6"); 97 | server = '['..server..']'; 98 | end 99 | 100 | local http_port = x:get('meshdesk','internet1','http_port'); 101 | local https_port = x:get('meshdesk','internet1','https_port'); 102 | local port_string = '/'; 103 | 104 | if(proto == 'http')then 105 | if(http_port ~= '80')then 106 | port_string = ":"..http_port.."/"; 107 | end 108 | end 109 | 110 | if(proto == 'https')then 111 | if(https_port ~= '443')then 112 | port_string = ":"..https_port.."/"; 113 | end 114 | end 115 | 116 | local query = proto .. "://" .. server .. port_string .. url; 117 | --print(query); 118 | 119 | local id_if = x:get('meshdesk','settings','id_if'); 120 | local id = network:getMac(id_if); 121 | local mode = network:getMode(); 122 | 123 | local stat = a_json:showStat(); 124 | local j_stat= j.encode(stat); 125 | local sess = a_json:showSessions(); 126 | local j_sess= j.encode(sess); 127 | local curl_data= '{"report_type":"light","mac":"'..id..'","stat":'..j_stat..',"sessions":'..j_sess..',"mode":"'..mode..'"}'; 128 | os.remove(result_file) 129 | os.execute('curl -k -o '..result_file..' -X POST -H "Content-Type: application/json" -d \''..curl_data..'\' '..query); 130 | afterReport(); 131 | 132 | end 133 | 134 | if(report == 'light')then 135 | lightReport(); 136 | end 137 | 138 | 139 | print("Doing the *"..report.."* report"); 140 | 141 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/reporting/check_for_actions.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | -- Include libraries 7 | package.path = "../libs/?.lua;./libs/?.lua;" .. package.path 8 | function main() 9 | require("rdActions") 10 | local a = rdActions() 11 | a:check() 12 | end 13 | main() 14 | 15 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/reporting/check_for_coa.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- Include libraries 3 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 4 | -- 5 | -- SPDX-License-Identifier: GPL-3.0-or-later 6 | 7 | package.path = "/etc/MESHdesk/libs/?.lua;../libs/?.lua;./libs/?.lua;" .. package.path 8 | function main() 9 | require("rdCoa") 10 | local coa = rdCoa() 11 | coa:check() 12 | end 13 | main() 14 | 15 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/reporting/report_sampling.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | -- Include libraries 7 | package.path = "../libs/?.lua;./libs/?.lua;" .. package.path 8 | function main() 9 | require("rdJsonReports") 10 | local j = rdJsonReports(); 11 | j:runCollect(); 12 | end 13 | main(); 14 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/reporting/report_sampling_wani.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | -- Include libraries 7 | package.path = "../libs/?.lua;./libs/?.lua;" .. package.path 8 | function main() 9 | require("rdJsonReports") 10 | local j = rdJsonReports(); 11 | j:runCollect(); 12 | end 13 | main(); 14 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/rogue_scan.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | 3 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 4 | -- 5 | -- SPDX-License-Identifier: GPL-3.0-or-later 6 | 7 | 8 | -- Include libraries 9 | package.path = "/etc/MESHdesk/libs/?.lua;" .. package.path; 10 | 11 | local fs = require('nixio.fs'); 12 | local json = require("json"); 13 | local uci = require('uci'); 14 | local uci_cursor = uci.cursor(); 15 | local sys = require("luci.sys") 16 | 17 | require("rdLogger"); 18 | require("rdConfig"); 19 | require("rdNetwork"); 20 | 21 | local l = rdLogger(); 22 | local url = 'cake4/rd_cake/node-reports/submit_rogue_report.json'; 23 | local url = url.."?_dc="..os.time(); 24 | local radio = 'radio0'; 25 | local res_file = '/tmp/rogue_report_result.json'; 26 | 27 | local j = require("json") 28 | local proto = uci_cursor:get("meshdesk", "internet1", "protocol"); 29 | local server = uci_cursor:get("meshdesk", "internet1", "ip"); 30 | 31 | local id_if = uci_cursor:get("meshdesk", "settings", "id_if"); 32 | local mode = uci_cursor:get("meshdesk", "settings", "mode"); 33 | 34 | local conf = rdConfig(); 35 | local mac = conf:getMac(id_if); 36 | 37 | local n = rdNetwork(); 38 | local local_ip_v6 = n:getIpV6ForInterface('br-lan'); 39 | 40 | if(local_ip_v6)then 41 | server = uci_cursor:get("meshdesk", "internet1", "ip_6"); 42 | server = '['..server..']'; 43 | end 44 | 45 | local http_port = uci_cursor:get('meshdesk','internet1','http_port'); 46 | local https_port = uci_cursor:get('meshdesk','internet1','https_port'); 47 | local port_string = '/'; 48 | 49 | if(proto == 'http')then 50 | if(http_port ~= '80')then 51 | port_string = ":"..http_port.."/"; 52 | end 53 | end 54 | 55 | if(proto == 'https')then 56 | if(https_port ~= '443')then 57 | port_string = ":"..https_port.."/"; 58 | end 59 | end 60 | 61 | local query = proto .. "://" .. server .. port_string .. url; 62 | 63 | local iw = sys.wifi.getiwinfo(radio); 64 | local tblRogues = iw.scanlist 65 | local strRogues = json.encode(tblRogues); 66 | 67 | local s_scanData = '"scan_data":' .. strRogues; 68 | local s_mac = '"mac": "' .. mac..'"'; 69 | local s_mode = '"mode": "'.. mode..'"'; 70 | 71 | local curl_data = '{'..s_scanData..','..s_mac..','..s_mode..'}'; 72 | print(curl_data); 73 | 74 | --Remove old results 75 | os.remove(res_file) 76 | os.execute('curl -k -o '..res_file..' -X POST -H "Content-Type: application/json" -d \''..curl_data..'\' '..query) 77 | 78 | 79 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/test_ping.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | 3 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 4 | -- 5 | -- SPDX-License-Identifier: GPL-3.0-or-later 6 | 7 | 8 | --[[-- 9 | 10 | Startup script to get the config of the device from the config server 11 | 12 | --]]-- 13 | 14 | -- Include libraries 15 | package.path = "libs/?.lua;" .. package.path 16 | 17 | --Configure object 18 | require("rdConfig"); 19 | 20 | local n = require "nixio"; 21 | local a = n.getaddrinfo('cloud.mesh-manager.com'); 22 | 23 | local util = require "luci.util"; 24 | 25 | if(a)then 26 | print(util.dumptable(a)); 27 | print(a[1]['address']); 28 | 29 | local c = rdConfig(); 30 | local server = "192.168.1.1"; 31 | end 32 | 33 | --[[-- 34 | if(c:pingTest(server))then 35 | print("I could ping "..server); 36 | else 37 | print("No ping for "..server); 38 | end 39 | --]]-- 40 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/tests/json_parse.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | local luci_json = require('luci.jsonc'); 7 | local luci_util = require('luci.util'); --26Nov 2020 for posting command output 8 | 9 | local reply = luci_util.exec("cat /etc/config/system"); 10 | 11 | json = luci_json.stringify({ item = reply, values = { 1, 2, 3 } }) 12 | print(json) -- '{"item":true,"values":[1,2,3]}' 13 | 14 | --local s_reply = json.encode(reply); 15 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/tests/report_softflow_logs.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | -- Include libraries 7 | package.path = "../libs/?.lua;./libs/?.lua;/etc/MESHdesk/libs/?.lua;" .. package.path 8 | 9 | require('luci.util'); 10 | require('nixio.fs'); 11 | require('luci.json'); 12 | 13 | --SOME DEFAULT VALUES-- 14 | local nasid = "TEST_NASID"; 15 | local report_to = "cloud.radiusdesk.com"; 16 | local cfg_file = "/etc/chilli/config"; 17 | 18 | local result_file = '/tmp/fresult.json'; 19 | 20 | function getInfo() 21 | local file = io.open(cfg_file); 22 | if file then 23 | for line in file:lines() do 24 | if(string.match(line, '^%s*HS_NASID%s*=%s*'))then 25 | nasid = string.gsub(line, '^%s*HS_NASID%s*=%s*', ""); 26 | print("Found NASID "..line.."I"); 27 | end 28 | if(string.match(line, '^%s*HS_RADIUS%s*=%s*'))then 29 | report_to = string.gsub(line, '^%s*HS_RADIUS%s*=%s*', ""); 30 | print("Found RADIUS "..line.."H"); 31 | end 32 | end 33 | file:close(); 34 | else 35 | error(config_file..' not found'); 36 | end 37 | end 38 | 39 | 40 | function main() 41 | require("rdSoftflowLogs") 42 | local s = rdSoftflowLogs() 43 | print("Version is " .. s:getVersion()) 44 | --s:chilliInfo(); 45 | local flows = s:doDumpFlows(); 46 | local curl_data = '{"report_type":"softflow","nasid":"'..nasid..'","flows":'..luci.json.encode(flows)..'}'; 47 | local query = "http://" .. report_to .. "/cake4/rd_cake/softflows/report.json"; 48 | --local query = "http://cloud.radiusdesk.com/cake4/rd_cake/softflows/report.json"; 49 | 50 | os.remove(result_file) 51 | os.execute('curl -k -o '..result_file..' -X POST -H "Content-Type: application/json" -d \''..curl_data..'\' '..query); 52 | end 53 | 54 | getInfo(); 55 | main(); 56 | 57 | 58 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/tests/sample_config.json: -------------------------------------------------------------------------------- 1 | {"config_settings":{"wireless":[{"wifi-device":"radio0","options":{"channel":"11","hwmode":"11gn","disabled":0},"lists":[{"name":"ht_capab","value":"SHORT-GI-20"},{"name":"ht_capab","value":"SHORT-GI-40"},{"name":"ht_capab","value":"RX-STBC1"},{"name":"ht_capab","value":"DSSS_CCK-40"}]},{"wifi-iface":"zero","options":{"device":"radio0","ifname":"mesh0","network":"mesh","mode":"adhoc","ssid":"02_CA_FE_CA_00_02","bssid":"02:CA:FE:CA:00:02"}},{"wifi-iface":"one","options":{"device":"radio0","ifname":"one0","mode":"ap","encryption":"psk-mixed","network":"one","ssid":"meshdesk_config","key":"radiusdesk","hidden":"1"}},{"wifi-iface":"two","options":{"device":"radio0","ifname":"two0","mode":"ap","network":"lan","encryption":"psk2","ssid":"Dragino Secure","key":"vathomdawie","hidden":false,"isolate":false,"auth_server":"","auth_secret":""}},{"wifi-iface":"three","options":{"device":"radio0","ifname":"three0","mode":"ap","network":"lan","encryption":"none","ssid":"Saul Pimon","key":"","hidden":false,"isolate":false,"auth_server":"","auth_secret":""}}],"network":[{"interface":"loopback","options":{"ifname":"lo","type":"bridge","proto":"static","ipaddr":"127.0.0.1","netmask":"255.0.0.0"}},{"interface":"lan","options":{"ifname":"eth0 eth1 bat0.2","type":"bridge","proto":"dhcp"}},{"interface":"mesh","options":{"ifname":"mesh0","mtu":"1560","proto":"batadv","mesh":"bat0"}},{"interface":"one","options":{"ifname":"bat0.1","proto":"static","ipaddr":"10.5.5.3","netmask":"255.255.255.0","type":"bridge"}}],"gateways":[],"captive_portals":[],"system":{"password_hash":"$1$clAff1Lb$ZK9oo8GX8qHs56gtClwDn0","hostname":"vt-01"}},"success":true,"timestamp":1} 2 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/tests/sample_config_batman_adv.json: -------------------------------------------------------------------------------- 1 | {"config_settings":{"wireless":[{"wifi-device":"radio0","options":{"channel":"12","disabled":0,"hwmode":"11ng","txpower":18},"lists":[]},{"wifi-iface":"zero","options":{"device":"radio0","ifname":"mesh0","network":"mesh","mode":"adhoc","ssid":"02_CA_FE_CA_00_01","bssid":"02:CA:FE:CA:00:01"}},{"wifi-iface":"one","options":{"device":"radio0","ifname":"one0","mode":"ap","encryption":"psk-mixed","network":"one","ssid":"meshdesk_config","key":"radiusdesk","hidden":"1"}},{"wifi-iface":"two","options":{"device":"radio0","ifname":"two0","mode":"ap","network":"lan","encryption":"none","ssid":"Meerkat Wifi","key":"","hidden":false,"isolate":false,"auth_server":"","auth_secret":""}}],"network":[{"interface":"loopback","options":{"ifname":"lo","type":"bridge","proto":"static","ipaddr":"127.0.0.1","netmask":"255.0.0.0"}},{"interface":"lan","options":{"ifname":"eth0 eth1 bat0.2","type":"bridge","proto":"dhcp"}},{"interface":"mesh","options":{"ifname":"mesh0","mtu":"1560","proto":"batadv","mesh":"bat0"}},{"interface":"one","options":{"ifname":"bat0.1","proto":"static","ipaddr":"10.5.5.5","netmask":"255.255.255.0","type":"bridge"}}],"system":{"password_hash":"$1$vNSzDtxr$5gx1cm954F8qeiXIUKdS81","heartbeat_interval":"60","heartbeat_dead_after":"300","hostname":"VT-3"},"gateways":[],"captive_portals":[],"batman_adv":{"aggregated_ogms":true,"ap_isolation":false,"bonding":false,"bridge_loop_avoidance":false,"fragmentation":true,"distributed_arp_table":true,"orig_interval":"1000","gw_sel_class":"20"}},"success":true,"timestamp":1} -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/tests/test_accel_config.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | --[[-- 7 | 8 | This test script will test the rdAccel object class's various methods 9 | 10 | --]]-- 11 | 12 | -- Include libraries 13 | package.path = "../libs/?.lua;" .. package.path 14 | 15 | function main() 16 | require("rdAccel"); 17 | local a = rdAccel(); 18 | print("Version is " .. a:getVersion()); 19 | print("Configure Accel-ppp from JSON file"); 20 | local f = '/etc/MESHdesk/tests/sample_config_accel.json'; 21 | a:configureFromJson(f); 22 | --w:configureFromTable() 23 | end 24 | 25 | main(); 26 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/tests/test_accel_stats.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | --[[-- 7 | 8 | This test script will test the rdAccel object class's various methods 9 | 10 | --]]-- 11 | 12 | -- Include libraries 13 | package.path = "../libs/?.lua;" .. package.path 14 | 15 | function main() 16 | local json = require('luci.json'); 17 | require("rdAccelstats"); 18 | local a = rdAccelstats(); 19 | print("Version is " .. a:getVersion()); 20 | print("Configure Accel-ppp from JSON file"); 21 | 22 | local pwd = a:getPassword(); 23 | print(pwd); 24 | 25 | 26 | --local stat = a:showStat(); 27 | --local j_stat= json.encode(stat); 28 | --print(j_stat); 29 | --local sess = a:showSessions(); 30 | --local j_sess= json.encode(sess); 31 | --print(j_sess); 32 | 33 | --print(accel_stats); 34 | end 35 | 36 | main(); 37 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/tests/test_actions.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | --[[-- 7 | 8 | This test script will test the rdActions object's methods 9 | 10 | --]]-- 11 | 12 | -- Include libraries 13 | package.path = "../libs/?.lua;" .. package.path 14 | 15 | function main() 16 | require("rdActions") 17 | local a = rdActions() 18 | print("Version is " .. a:getVersion()) 19 | a:check() 20 | end 21 | 22 | main() 23 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/tests/test_batman_config.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | --[[-- 7 | 8 | This test script will test the rdBatman object class's various methods 9 | 10 | --]]-- 11 | 12 | -- Include libraries 13 | package.path = "../libs/?.lua;" .. package.path 14 | 15 | function main() 16 | require("rdBatman") 17 | local b = rdBatman() 18 | print("Version is " .. b:getVersion()) 19 | print("Configure Batman adv from JSON file") 20 | local f = '/etc/MESHdesk/tests/sample_config_batman_adv.json' 21 | b:configureFromJson(f) 22 | --w:configureFromTable() 23 | end 24 | 25 | main() 26 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/tests/test_firmware_config.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | --[[-- 7 | 8 | This test script will test the rdFirmwareConfig object class's various methods 9 | 10 | --]]-- 11 | 12 | -- Include libraries 13 | package.path = "../libs/?.lua;" .. package.path 14 | 15 | function main() 16 | require("rdFirmwareConfig") 17 | local f = rdFirmwareConfig() 18 | print("Version is " .. f:getVersion()) 19 | f:runConfig() 20 | end 21 | 22 | main() 23 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/tests/test_netstats_wan.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 FIXME REPLACE WITH YOUR INFO ... format: Mathis Arthur Boumaza 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | --[[-- 7 | 8 | This test script will test the rdActions object's methods 9 | 10 | --]]-- 11 | 12 | -- Include libraries 13 | package.path = "../libs/?.lua;" .. package.path 14 | 15 | function main() 16 | require("rdNetstatsWan") 17 | local nsw = rdNetstatsWan() 18 | print("Version is " .. nsw:getVersion()) 19 | printWanStats(nsw:getWanStats()) 20 | end 21 | 22 | function printWanStats(wanStats) 23 | -- Loop through each item in the wanStats table 24 | for _, stat in ipairs(wanStats) do 25 | -- Print interface and status information 26 | print("Interface: " .. stat.interface) 27 | print("Up: " .. tostring(stat.up)) 28 | 29 | -- Print statistics for the interface 30 | print("Statistics:") 31 | 32 | local stats = stat.statistics 33 | if stats then 34 | -- Print individual statistics fields 35 | for key, value in pairs(stats) do 36 | -- If the value is a table, we print it recursively 37 | if type(value) == "table" then 38 | print(" " .. key .. ":") 39 | for subkey, subvalue in pairs(value) do 40 | print(" " .. subkey .. ": " .. tostring(subvalue)) 41 | end 42 | else 43 | print(" " .. key .. ": " .. tostring(value)) 44 | end 45 | end 46 | else 47 | print(" No statistics available") 48 | end 49 | 50 | print("\n") -- Adding a newline for readability between interfaces 51 | end 52 | end 53 | 54 | main() 55 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/tests/test_network.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | --[[-- 7 | 8 | This test script will test the rdVis object's methods 9 | 10 | --]]-- 11 | 12 | -- Include libraries 13 | package.path = "../libs/?.lua;" .. package.path 14 | 15 | function main() 16 | require("rdNetwork") 17 | local n = rdNetwork() 18 | print("Version is " .. n:getVersion()) 19 | n:doWanSynch(); 20 | end 21 | 22 | main() 23 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/tests/test_network_add_macs.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | --[[-- 7 | 8 | This test script will test the rdVis object's methods 9 | 10 | --]]-- 11 | 12 | -- Include libraries 13 | package.path = "../libs/?.lua;" .. package.path 14 | 15 | function main() 16 | require("rdNetwork") 17 | local n = rdNetwork() 18 | print("Version is " .. n:getVersion()) 19 | n:addMacs(); 20 | end 21 | 22 | main() 23 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/tests/test_openvpn_config.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | --[[-- 7 | 8 | This test script will test the rrdOpenvpn object class's various methods 9 | 10 | --]]-- 11 | 12 | -- Include libraries 13 | package.path = "../libs/?.lua;" .. package.path 14 | 15 | function main() 16 | require("rdOpenvpn") 17 | local o = rdOpenvpn() 18 | print("Version is " .. o:getVersion()) 19 | print("Configure OpenVPN from JSON file") 20 | local f = '/etc/MESHdesk/tests/sample_config_openvpn.json' 21 | o:configureFromJson(f) 22 | --w:configureFromTable() 23 | end 24 | 25 | main() 26 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/tests/test_proxy_logs.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | --[[-- 7 | 8 | This test script will test the rdProxyLogs object's methods 9 | 10 | --]]-- 11 | 12 | -- Include libraries 13 | package.path = "../libs/?.lua;./libs/?.lua;" .. package.path 14 | 15 | function main() 16 | require("rdProxyLogs") 17 | local p = rdProxyLogs() 18 | print("Version is " .. p:getVersion()) 19 | --p:chilliInfo(); 20 | p:doPrivoxy(); 21 | --p:truncLog(); 22 | end 23 | 24 | main() 25 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/tests/test_rd_config.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | --[[-- 7 | 8 | This test script will test the rdConfig object's methods 9 | 10 | --]]-- 11 | 12 | -- Include libraries 13 | package.path = "../libs/?.lua;./libs/?.lua;" .. package.path 14 | 15 | function main() 16 | require("rdConfig") 17 | local c = rdConfig(); 18 | print("Version is " .. c:getVersion()) 19 | local ret_table = c:tryForConfigServer('lan'); 20 | end 21 | 22 | main() 23 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/tests/test_reboot_settings.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | --[[-- 7 | 8 | This test script will test the rdRebootSettings object class's various methods 9 | 10 | --]]-- 11 | 12 | -- Include libraries 13 | package.path = "../libs/?.lua;" .. package.path 14 | 15 | function main() 16 | require("rdRebootSettings") 17 | local r = rdRebootSettings() 18 | print("Version is " .. r:getVersion()) 19 | print("Configure Reboot Settings from JSON file") 20 | --local f = '/etc/MESHdesk/tests/sample_config_batman_adv.json' 21 | local f = '/etc/MESHdesk/configs/current.json' 22 | --r:configureFromJson(f) 23 | --r:configureFromTable() 24 | r:clear(); 25 | end 26 | 27 | main() 28 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/tests/test_softflow_logs.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | --[[-- 7 | 8 | This test script will test the rdSoftflowLogs object's methods 9 | 10 | --]]-- 11 | 12 | -- Include libraries 13 | package.path = "../libs/?.lua;./libs/?.lua;" .. package.path 14 | 15 | function main() 16 | require("rdSoftflowLogs") 17 | local s = rdSoftflowLogs() 18 | print("Version is " .. s:getVersion()) 19 | s:chilliInfo(); 20 | s:doDumpFlows(); 21 | --s:doDeleteAll(); 22 | end 23 | 24 | main() 25 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/tests/test_sqlite_reports.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | --[[-- 6 | 7 | This test script will test the rdSqliteReports object class's various methods 8 | 9 | --]]-- 10 | 11 | -- Include libraries 12 | --package.path = "../libs/?.lua;" .. package.path 13 | 14 | -- Include libraries 15 | package.path = "../libs/?.lua;./libs/?.lua;" .. package.path 16 | 17 | function main() 18 | require("rdSqliteReports") 19 | local s = rdSqliteReports() 20 | print("Version is " .. s:getVersion()) 21 | --print("Soft Init the DB") 22 | --s:initDb(); 23 | --print("Run the Report"); 24 | --s:runCollect(); 25 | print(s:runReport()); 26 | end 27 | 28 | main() 29 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/tests/test_system_config.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | --[[-- 7 | 8 | This test script will test the rdSystem object class's various methods 9 | 10 | --]]-- 11 | 12 | -- Include libraries 13 | package.path = "../libs/?.lua;" .. package.path 14 | 15 | function main() 16 | require("rdSystem") 17 | local s = rdSystem() 18 | print("Version is " .. s:getVersion()) 19 | print('Configure System from JSON file') 20 | local f = '/etc/MESHdesk/tests/sample_config.json' 21 | s:configureFromJson(f) 22 | end 23 | 24 | main() 25 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/tests/test_uci_write.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | --[[-- 7 | 8 | This test is used to troubleshoot uci write lockups 9 | 10 | --]]-- 11 | 12 | -- Include libraries 13 | package.path = "../libs/?.lua;" .. package.path 14 | 15 | local uci = require("uci") 16 | local x = uci.cursor() 17 | local utl = require "luci.util"; 18 | 19 | local socket = require("socket"); 20 | 21 | function main() 22 | 23 | local c = 0; 24 | while (c < 500) do 25 | counter = x.get("mesh_status", "status", "counter"); 26 | print("Reading Counter and it is "..counter); 27 | --sleep(1); 28 | if(counter)then 29 | --utl.exec("touch /etc/config/mesh_status") 30 | x.set('mesh_status', 'status', 'counter', c) 31 | x.commit('mesh_status') 32 | print("We se counter to "..c) 33 | else 34 | --utl.exec("touch /etc/config/mesh_status") 35 | x.set('mesh_status','status','counter') 36 | x.set('mesh_status', 'status', 'counter', c) 37 | x.commit('mesh_status') 38 | end 39 | c = c +1; 40 | end 41 | end 42 | 43 | function sleep(sec) 44 | socket.select(nil, nil, sec) 45 | end 46 | 47 | main() 48 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/tests/test_vis.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | --[[-- 7 | 8 | This test script will test the rdVis object's methods 9 | 10 | --]]-- 11 | 12 | -- Include libraries 13 | package.path = "../libs/?.lua;" .. package.path 14 | 15 | function main() 16 | require("rdVis") 17 | local v = rdVis() 18 | print("Version is " .. v:getVersion()) 19 | print(v:getVisNoAlfred()); 20 | end 21 | 22 | main() 23 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/tests/test_wifi_config.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | --[[-- 7 | 8 | This test script will test the rdWireless object class's various methods 9 | 10 | --]]-- 11 | 12 | -- Include libraries 13 | package.path = "../libs/?.lua;" .. package.path 14 | 15 | function main() 16 | require("rdWireless") 17 | local w = rdWireless() 18 | print("Version is " .. w:getVersion()) 19 | print("Running newWireless") 20 | w:newWireless() 21 | --print("Connect client") 22 | --w:connectClient() 23 | --print('Configure WiFi from JSON file') 24 | --local f = '/etc/MESHdesk/tests/sample_config.json' 25 | --w:configureFromJson(f) 26 | --w:configureFromTable() 27 | end 28 | 29 | main() 30 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/tests/ubus_lua.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | -- Include libraries 7 | package.path = "../libs/?.lua;./libs/?.lua;/etc/MESHdesk/libs/?.lua;" .. package.path 8 | 9 | require('rdNetstats'); 10 | local json = require('luci.json'); 11 | local netstats = rdNetstats(); 12 | local n_stats = netstats:getWifiUbus(); 13 | print(n_stats); 14 | local radio_structure = json.decode(n_stats); 15 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/utils/fetch_adv_firewall.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | -- Include libraries 7 | package.path = "../libs/?.lua;./libs/?.lua;" .. package.path 8 | 9 | require("rdAdvNftables"); 10 | local adv_nft = rdAdvNftables(); 11 | local util = require('luci.util'); 12 | 13 | function getMac(interface) 14 | interface = interface or "eth0" 15 | io.input("/sys/class/net/" .. interface .. "/address") 16 | t = io.read("*line") 17 | dashes, count = string.gsub(t, ":", "-") 18 | dashes = string.upper(dashes) 19 | return dashes 20 | end 21 | 22 | require('luci.http'); 23 | local uci = require("uci"); 24 | local x = uci.cursor(); 25 | local id_if = x.get('meshdesk','settings','id_if'); 26 | local id = getMac(id_if); 27 | local proto = x.get('meshdesk','internet1','protocol'); 28 | local url = 'cake4/rd_cake/firewalls/get-adv-config-for-node.json' 29 | local server= x.get('meshdesk','internet1','ip'); 30 | local http_port = x.get('meshdesk','internet1','http_port'); 31 | local https_port = x.get('meshdesk','internet1','https_port'); 32 | local port_string = '/'; 33 | 34 | if(proto == 'http')then 35 | if(http_port ~= '80')then 36 | port_string = ":"..http_port.."/"; 37 | end 38 | end 39 | 40 | if(proto == 'https')then 41 | if(https_port ~= '443')then 42 | port_string = ":"..https_port.."/"; 43 | end 44 | end 45 | 46 | local query = proto .. "://" .. server .. port_string .. url; 47 | 48 | local q_s = {} 49 | q_s['mac'] = id; 50 | q_s['version'] = '22.03'; 51 | local enc_string= luci.http.build_querystring(q_s); 52 | url = query..enc_string; 53 | 54 | adv_nft:initConfig(); 55 | adv_nft:flushTable(); 56 | adv_nft:clearSets(); 57 | 58 | --local url = 'http://192.168.8.165/cake4/rd_cake/firewalls/get-adv-config-for-node.json?gateway=true&_dc=1651070922&version=22.03&mac=64-64-4A-DD-07-FC' 59 | local retval = util.exec("curl -k '" .. url .."'"); 60 | local json = require("json"); 61 | local tblConfig = json.decode(retval); 62 | 63 | if(tblConfig.config_settings ~= nil)then 64 | 65 | if(tblConfig.config_settings.adv_firewall ~= nil)then 66 | --add the sets 67 | if(tblConfig.config_settings.adv_firewall.sets)then 68 | for k in pairs(tblConfig.config_settings.adv_firewall.sets) do 69 | local set = tblConfig.config_settings.adv_firewall.sets[k]; 70 | adv_nft:addSet(set); 71 | end 72 | end 73 | 74 | --add the macs 75 | if(tblConfig.config_settings.adv_firewall.macs)then 76 | for b, mac in ipairs(tblConfig.config_settings.adv_firewall.macs) do 77 | adv_nft:addMac(mac); 78 | end 79 | end 80 | 81 | --add the entries 82 | if(tblConfig.config_settings.adv_firewall.entries)then 83 | for a, entry in ipairs(tblConfig.config_settings.adv_firewall.entries) do 84 | adv_nft:addEntry(entry); 85 | end 86 | end 87 | end 88 | 89 | end 90 | 91 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/utils/fetch_firewall.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | -- Include libraries 7 | package.path = "../libs/?.lua;./libs/?.lua;" .. package.path 8 | 9 | require("rdNftables"); 10 | local nft = rdNftables(); 11 | local util = require('luci.util'); --26Nov 2020 for posting command output 12 | 13 | function getMac(interface) 14 | interface = interface or "eth0" 15 | io.input("/sys/class/net/" .. interface .. "/address") 16 | t = io.read("*line") 17 | dashes, count = string.gsub(t, ":", "-") 18 | dashes = string.upper(dashes) 19 | return dashes 20 | end 21 | 22 | require('luci.http'); 23 | local uci = require("uci"); 24 | local x = uci.cursor(); 25 | local id_if = x.get('meshdesk','settings','id_if'); 26 | local id = getMac(id_if); 27 | local proto = x.get('meshdesk','internet1','protocol'); 28 | local url = 'cake4/rd_cake/firewalls/get-config-for-node.json' 29 | local server= x.get('meshdesk','internet1','ip'); 30 | local http_port = x.get('meshdesk','internet1','http_port'); 31 | local https_port = x.get('meshdesk','internet1','https_port'); 32 | local port_string = '/'; 33 | 34 | if(proto == 'http')then 35 | if(http_port ~= '80')then 36 | port_string = ":"..http_port.."/"; 37 | end 38 | end 39 | 40 | if(proto == 'https')then 41 | if(https_port ~= '443')then 42 | port_string = ":"..https_port.."/"; 43 | end 44 | end 45 | 46 | local query = proto .. "://" .. server .. port_string .. url; 47 | 48 | local q_s = {} 49 | q_s['mac'] = id; 50 | q_s['version'] = '22.03'; 51 | local enc_string= luci.http.build_querystring(q_s); 52 | url = query..enc_string; 53 | 54 | nft:initConfig(); 55 | nft:flushTable(); 56 | 57 | --local url = 'http://192.168.8.165/cake4/rd_cake/firewalls/get-config-for-node.json?gateway=true&_dc=1651070922&version=22.03&mac=64-64-4A-DD-07-FC' 58 | local retval = util.exec("curl -k '" .. url .."'"); 59 | local json = require("json"); 60 | local tblConfig = json.decode(retval); 61 | 62 | if(tblConfig.config_settings ~= nil)then 63 | if(tblConfig.config_settings.firewall ~= nil)then 64 | for a, rule in ipairs(tblConfig.config_settings.firewall) do 65 | local mac = rule.mac 66 | print(mac); 67 | if(rule.action == 'block')then 68 | nft:macOff(mac); 69 | end 70 | if(rule.action == 'limit')then 71 | nft:macLimit(mac,rule.bw_up,rule.bw_down) 72 | end 73 | end 74 | end 75 | end 76 | 77 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/utils/fetch_sqm.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | -- Include libraries 7 | package.path = "../libs/?.lua;./libs/?.lua;" .. package.path 8 | 9 | require("rdSqm"); 10 | local luci_util = require("luci.util") 11 | local uci = require("uci") 12 | local json = require("json") 13 | local http = require("luci.http") 14 | 15 | -- Function to get MAC address 16 | local function getMac(interface) 17 | interface = interface or "eth0" 18 | local file = io.open("/sys/class/net/" .. interface .. "/address", "r") 19 | local mac = file:read("*line") 20 | file:close() 21 | mac = string.upper(string.gsub(mac, ":", "-")) 22 | return mac 23 | end 24 | 25 | -- UCI configuration 26 | local x = uci.cursor() 27 | local id_if = x:get("meshdesk", "settings", "id_if") 28 | local id = getMac(id_if) 29 | local proto = x:get("meshdesk", "internet1", "protocol") 30 | local server = x:get("meshdesk", "internet1", "ip") 31 | local http_port = x:get("meshdesk", "internet1", "http_port") 32 | local https_port = x:get("meshdesk", "internet1", "https_port") 33 | 34 | -- Build URL 35 | local port_string = "/" 36 | if proto == "http" and http_port ~= "80" then 37 | port_string = ":" .. http_port .. "/" 38 | end 39 | if proto == "https" and https_port ~= "443" then 40 | port_string = ":" .. https_port .. "/" 41 | end 42 | local query = proto .. "://" .. server .. port_string .. "cake4/rd_cake/sqm-profiles/get-config-for-node.json" 43 | local q_s = { mac = id, version = "22.03" } 44 | local enc_string = http.build_querystring(q_s) 45 | local url = query .. enc_string 46 | 47 | -- Initialize sqm 48 | local sqm = rdSqm(); 49 | 50 | -- Fetch and parse JSON data 51 | local retval = luci_util.exec("curl -k '" .. url .. "'") 52 | local tblConfig = json.decode(retval) 53 | 54 | -- Apply SQM items 55 | if tblConfig.config_settings and tblConfig.config_settings.sqm then 56 | sqm:configureFromTable(tblConfig.config_settings.sqm); 57 | end 58 | 59 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/utils/hostapd_disconnect.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | -- Include libraries 7 | package.path = "../libs/?.lua;./libs/?.lua;/etc/MESHdesk/libs/" .. package.path 8 | 9 | local json = require("json"); 10 | local utils = require("rdMqttUtils"); 11 | local l_u = require('luci.util'); 12 | local mac; 13 | local entry_id; 14 | 15 | 16 | function printUsage() 17 | print("--- Utility Script by MESHdesk used to disconnect a station connected to hostapd ----"); 18 | print("Usage -> /etc/MESHdesk/utils/hostapd_disconnect.lua '0C-C6-FD-7B-8B-AA' 'm_hosta_40_57_0_146'"); 19 | os.exit(); 20 | end 21 | 22 | 23 | function mainPart() 24 | local meta_data = utils.getMetaData(); 25 | if meta_data == nil then 26 | print("This node does not have any Meta Data in its config") 27 | else 28 | for key, value in pairs(meta_data)do 29 | if(tonumber(value) == tonumber(entry_id))then 30 | mac = string.lower(string.gsub(mac,'-',':')); 31 | --ubus call hostapd.two0 del_client "{'addr':'0c:c6:fd:7b:8b:aa', 'reason':5, 'deauth':true, 'ban_time':0}" 32 | 33 | local command = "ubus call hostapd."..key.." del_client \"{'addr':'"..mac.."', 'reason':5, 'deauth':true, 'ban_time':0}\""; 34 | l_u.exec(command); 35 | --print(command); 36 | end 37 | end 38 | end 39 | end 40 | 41 | if(arg[1])then 42 | mac = arg[1]; 43 | end 44 | 45 | if(arg[2])then 46 | entry_id = arg[2]; 47 | else 48 | printUsage(); 49 | end 50 | 51 | 52 | mainPart(); 53 | 54 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/utils/nft_setter.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | -- Include libraries 7 | package.path = "../libs/?.lua;./libs/?.lua;" .. package.path 8 | 9 | require("rdNftables"); 10 | 11 | local nft = rdNftables(); 12 | local mac; 13 | local action = 'off'; --default is to block 14 | local util = require('luci.util'); --26Nov 2020 for posting command output 15 | local chains = {'input', 'forward', 'output'} 16 | local bw_up; 17 | local bw_down; 18 | 19 | function printUsage() 20 | print("--- Utility Script by MESHdesk used to manage MAC Addresses on the **bridge meshdesk** table ----"); 21 | print("Usage -> /etc/MESHdesk/utils/nft_setter.lua '' ['clear'|'on'|'off'|'bw' (bw in kBps)]"); 22 | os.exit(); 23 | end 24 | 25 | function initialConfig() 26 | nft:initConfig(); 27 | end 28 | 29 | function macOn(m) 30 | nft:macOn(m); 31 | end 32 | 33 | function macOff(m) 34 | nft:macOff(m); 35 | end 36 | 37 | function macLimit(m) 38 | nft:macLimit(m,bw_up,bw_down); 39 | end 40 | 41 | function mainPart() 42 | initialConfig(); 43 | if(action == 'clear')then 44 | nft:flushTable(); 45 | end 46 | 47 | if(action == 'on')then 48 | macOn(mac) 49 | end 50 | 51 | if(action == 'off')then 52 | macOn(mac);--Clear rules first 53 | macOff(mac); 54 | end 55 | 56 | if(action == 'bw')then 57 | macOn(mac) 58 | macLimit(mac) 59 | end 60 | 61 | end 62 | 63 | 64 | --Get the MAC Address 65 | if(arg[1])then 66 | mac = arg[1]; 67 | end 68 | 69 | if(arg[2])then 70 | action = arg[2]; 71 | if((action ~= 'clear')and(action ~= 'on')and(action ~= 'off')and(action ~= 'bw'))then 72 | printUsage(); 73 | end 74 | if(action == 'bw')then 75 | if((not (arg[3]))or(not (arg[4])))then 76 | printUsage(); 77 | else 78 | bw_up = arg[3]; 79 | bw_down = arg[4]; 80 | end 81 | end 82 | else 83 | printUsage(); 84 | end 85 | 86 | 87 | print("Setting "..mac.." to "..action ); 88 | nft:initConfig(); 89 | nft:flushTable(); 90 | 91 | local url = 'http://192.168.8.165/cake4/rd_cake/firewalls/get-config-for-node.json?gateway=true&_dc=1651070922&version=22.03&mac=64-64-4A-DD-07-FC' 92 | local retval = util.exec("curl -k '" .. url .."'"); 93 | local json = require("json"); 94 | local tblConfig = json.decode(retval); 95 | 96 | if(tblConfig.config_settings ~= nil)then 97 | if(tblConfig.config_settings.firewall ~= nil)then 98 | for a, rule in ipairs(tblConfig.config_settings.firewall) do 99 | local mac = rule.mac 100 | print(mac); 101 | if(rule.action == 'block')then 102 | nft:macOff(mac); 103 | end 104 | if(rule.action == 'limit')then 105 | nft:macLimit(mac,rule.bw_up,rule.bw_down) 106 | end 107 | end 108 | end 109 | end 110 | 111 | --print("Output Start"); 112 | --print(retval); 113 | --print("Output END"); 114 | --mainPart(); 115 | 116 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/utils/sqm_report_wip.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | -- Include libraries 7 | package.path = "../libs/?.lua;./libs/?.lua;/etc/MESHdesk/libs/" .. package.path 8 | 9 | require("rdSqm"); 10 | local sqm = rdSqm(); 11 | print(sqm:getStatsJson()); 12 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/utils/ssid_on_off.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 3 | -- 4 | -- SPDX-License-Identifier: GPL-3.0-or-later 5 | 6 | 7 | -- Include libraries 8 | package.path = "../libs/?.lua;./libs/?.lua;" .. package.path 9 | 10 | local uci = require("uci"); 11 | local x = uci.cursor(); 12 | local ssid; 13 | local action = 'off'; 14 | 15 | function printUsage() 16 | print("--- Utility Script by MESHdesk used to turn a WiFi SSID on or off ----"); 17 | print("Usage -> /etc/MESHdesk/utils/ssid_on_off.lua '' ['on'|'off']"); 18 | os.exit(); 19 | end 20 | 21 | 22 | function MainPart() 23 | local set_disabled_state = 0; 24 | if(action == 'off')then 25 | set_disabled_state = 1; 26 | end 27 | local state_changed = false; 28 | 29 | x:foreach("wireless", "wifi-iface", function(s) 30 | local ssid_match = false; 31 | local disabled = 0; 32 | 33 | if(s.ssid == ssid)then 34 | if(tostring(s.disabled) ~= tostring(set_disabled_state))then 35 | state_changed = true 36 | print("Turning "..ssid.." to "..action); 37 | print(s[".name"]); 38 | x.set("wireless",s[".name"],"disabled",set_disabled_state) 39 | end 40 | end 41 | 42 | end) 43 | 44 | if(state_changed)then 45 | print("Reloading WiFi"); 46 | x.commit('wireless'); 47 | os.execute("/sbin/wifi"); 48 | end 49 | 50 | end 51 | 52 | if(arg[1])then 53 | ssid = arg[1]; 54 | end 55 | 56 | if(arg[2])then 57 | action = arg[2]; 58 | if((action ~= 'on')and(action ~= 'off'))then 59 | printUsage(); 60 | end 61 | else 62 | printUsage(); 63 | end 64 | 65 | 66 | print("Setting "..ssid.." to "..action ); 67 | mainPart(); 68 | 69 | 70 | -------------------------------------------------------------------------------- /MESHdesk/files/MESHdesk/watchdog.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/lua 2 | 3 | -- SPDX-FileCopyrightText: 2024 Dirk van der Walt 4 | -- 5 | -- SPDX-License-Identifier: GPL-3.0-or-later 6 | 7 | 8 | -- Include libraries 9 | package.path = "libs/?.lua;" .. package.path 10 | require("rdLogger"); 11 | local socket = require("socket"); 12 | 13 | local must_run = { 14 | "heartbeat.lua", 15 | --"actions_checker.lua", --We do not need this any more wit the new reporting mechanism 16 | --FIXME Wee need to have a check to bring this back in case the new reporting is not used 17 | "batman_neighbours.lua" 18 | } 19 | 20 | local debug = true; 21 | local l = rdLogger(); 22 | local util = require("luci.util"); 23 | local zzz = 60; 24 | 25 | function log(m,p) 26 | if(debug)then 27 | l:log(m,p) 28 | end 29 | end 30 | 31 | function sleep(sec) 32 | socket.select(nil, nil, sec) 33 | end 34 | 35 | function check_watchdog() 36 | sleep(600); 37 | local ok_file = "/tmp/startup_ok"; 38 | local pass_file = "/tmp/startup_pass"; 39 | if (file_exists(ok_file)) then 40 | os.execute("rm " .. ok_file); 41 | os.execute("touch " .. pass_file); 42 | check_programs(); --Check the important programs... 43 | else 44 | os.execute("sleep 60"); 45 | os.execute("reboot"); 46 | end 47 | end 48 | 49 | function check_programs() 50 | local loop = true; 51 | while(loop)do 52 | for index,value in ipairs(must_run)do 53 | --log(index..".) Is "..value.." running?"); 54 | local pid = util.exec("pidof "..value); 55 | if(pid == '')then 56 | log(value.." is not running starting it again"); 57 | os.execute("cd /etc/MESHdesk && ./"..value.." &"); 58 | end 59 | end 60 | sleep(zzz); 61 | end 62 | end 63 | 64 | function file_exists(name) 65 | local f=io.open(name,"r") 66 | if f~=nil then io.close(f) return true else return false end 67 | end 68 | 69 | check_watchdog() 70 | 71 | --check_programs(); 72 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Building the Firmware 2 | 3 | ### Building the MESHdesk firmware using OpenWRT 23.05.x 4 | * [MESHdesk on OpenWrt 23.05.x](https://www.radiusdesk.com/wiki24/network/firmware/home) 5 | 6 | # Licensing 7 | * All the code is published under the **GNU General Public License v3.0**.
8 | * This means that you may make modifications and changes. 9 | 10 | # Funding 11 | 12 | This project also received funding through [NGI0 Entrust](https://nlnet.nl/entrust), a fund established by [NLnet](https://nlnet.nl) with financial support from the European Commission's [Next Generation Internet](https://ngi.eu) program.
13 | Learn more at the [NLnet project page](https://nlnet.nl/project/RADIUSdesk-Multiwan).
14 |
15 | [NLnet foundation logo](https://nlnet.nl)
16 | [NGI Zero Logo](https://nlnet.nl/entrust)
17 | -------------------------------------------------------------------------------- /files/etc/banner: -------------------------------------------------------------------------------- 1 | _____ _____ _____ _ _ _____ _ _ 2 | | __ \ /\ | __ \_ _| | | |/ ____| | | | | 3 | | |__) | / \ | | | || | | | | | (___ __| | ___ ___| | __ 4 | | _ / / /\ \ | | | || | | | | |\___ \ / _` |/ _ \/ __| |/ / 5 | | | \ \ / ____ \| |__| || |_| |__| |____) | (_| | __/\__ \ < 6 | |_| \_\/_/ \_\_____/_____|\____/|_____/ \__,_|\___||___/_|\_\ 7 | 8 | ---------------------------------------------------------------------- 9 | ------------- MESHdesk-22-03-0-SEPT-2022-1.bin ----------------------- 10 | ---------------------------------------------------------------------- 11 | -------------------------------------------------------------------------------- /files/etc/chilli/up.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | TUNTAP=$(basename $DEV) 4 | UNDO_FILE=/var/run/chilli.$TUNTAP.sh 5 | 6 | . /etc/chilli/functions 7 | 8 | [ -e "$UNDO_FILE" ] && sh $UNDO_FILE 2>/dev/null 9 | rm -f $UNDO_FILE 2>/dev/null 10 | 11 | ipt() { 12 | opt=$1; shift 13 | echo "iptables -D $*" >> $UNDO_FILE 14 | iptables $opt $* 15 | } 16 | 17 | ipt_in() { 18 | ipt -I INPUT -i $TUNTAP $* 19 | } 20 | 21 | run_up() { 22 | if [ -n "$TUNTAP" ] 23 | then 24 | # ifconfig $TUNTAP mtu $MTU 25 | if [ "$KNAME" != "" ] 26 | then 27 | ipt -I FORWARD -i $DHCPIF -m coova --name $KNAME -j ACCEPT 28 | ipt -I FORWARD -o $DHCPIF -m coova --name $KNAME --dest -j ACCEPT 29 | ipt -I FORWARD -i $TUNTAP -j ACCEPT 30 | ipt -I FORWARD -o $TUNTAP -j ACCEPT 31 | [ -n "$DHCPLISTEN" ] && ifconfig $DHCPIF $DHCPLISTEN 32 | else 33 | if [ "$LAYER3" != "1" ] 34 | then 35 | ipt_in --dst $ADDR -j DROP 36 | 37 | [ -n "$UAMPORT" -a "$UAMPORT" != "0" ] && \ 38 | ipt_in -p tcp -m tcp --dport $UAMPORT --dst $ADDR -j ACCEPT 39 | 40 | [ -n "$UAMUIPORT" -a "$UAMUIPORT" != "0" ] && \ 41 | ipt_in -p tcp -m tcp --dport $UAMUIPORT --dst $ADDR -j ACCEPT 42 | 43 | [ -n "$HS_TCP_PORTS" ] && { 44 | for port in $HS_TCP_PORTS; do 45 | ipt_in -p tcp -m tcp --dport $port --dst $ADDR -j ACCEPT 46 | done 47 | } 48 | 49 | [ -n "$HS_UDP_PORTS" ] && { 50 | for port in $HS_UDP_PORTS; do 51 | ipt_in -p udp -m udp --dport $port --dst $ADDR -j ACCEPT 52 | done 53 | } 54 | 55 | ipt_in -p udp -d 255.255.255.255 --destination-port 67:68 -j ACCEPT 56 | ipt_in -p udp -d $ADDR --destination-port 67:68 -j ACCEPT 57 | ipt_in -p udp --dst $ADDR --dport 53 -j ACCEPT 58 | ipt_in -p icmp --dst $ADDR -j ACCEPT 59 | 60 | if [ "$ONLY8021Q" != "1" ] 61 | then 62 | ipt -I INPUT -i $DHCPIF -j DROP 63 | fi 64 | fi 65 | 66 | if [ "$ONLY8021Q" != "1" ] 67 | then 68 | ipt -I FORWARD -i $DHCPIF -j DROP 69 | ipt -I FORWARD -o $DHCPIF -j DROP 70 | fi 71 | 72 | ipt -I FORWARD -i $TUNTAP -j ACCEPT 73 | ipt -I FORWARD -o $TUNTAP -j ACCEPT 74 | 75 | # Help out conntrack to not get confused 76 | # (stops masquerading from working) 77 | #ipt -I PREROUTING -t raw -j NOTRACK -i $DHCPIF 78 | #ipt -I OUTPUT -t raw -j NOTRACK -o $DHCPIF 79 | 80 | # Help out MTU issues with PPPoE or Mesh 81 | ipt -I FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu 82 | #### ipt -I FORWARD -t mangle -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu 83 | 84 | [ "$HS_LAN_ACCESS" != "on" -a "$HS_LAN_ACCESS" != "allow" ] && \ 85 | ipt -I FORWARD -i $TUNTAP \! -o $HS_WANIF -j DROP 86 | 87 | ipt -I FORWARD -i $TUNTAP -o $HS_WANIF -j ACCEPT 88 | 89 | [ "$HS_LOCAL_DNS" = "on" ] && \ 90 | ipt -I PREROUTING -t nat -i $TUNTAP -p udp --dport 53 -j DNAT --to-destination $ADDR 91 | fi 92 | fi 93 | 94 | # site specific stuff optional 95 | [ -e /etc/chilli/ipup.sh ] && . /etc/chilli/ipup.sh 96 | } 97 | 98 | 99 | FLOCK=$(which flock) 100 | if [ -n "$FLOCK" ] && [ -z "$LOCKED_FILE" ] 101 | then 102 | export LOCKED_FILE=/tmp/.chilli-flock 103 | flock -x $LOCKED_FILE -c "$0 $@" 104 | else 105 | run_up 106 | fi 107 | -------------------------------------------------------------------------------- /files/etc/config/system: -------------------------------------------------------------------------------- 1 | config system 2 | option ttylogin '0' 3 | option log_size '64' 4 | option urandom_seed '0' 5 | option hostname 'M-1' 6 | option timezone 'EST5EDT,M3.2.0,M11.1.0' 7 | 8 | config timeserver 'ntp' 9 | option enabled '1' 10 | option enable_server '0' 11 | list server '0.openwrt.pool.ntp.org' 12 | list server '1.openwrt.pool.ntp.org' 13 | list server '2.openwrt.pool.ntp.org' 14 | list server '3.openwrt.pool.ntp.org' 15 | 16 | config led 'wifi_led' 17 | option name 'wifi' 18 | option trigger 'netdev' 19 | option dev 'bat0' 20 | option mode 'link tx rx' 21 | option sysfs 'replace_me' 22 | 23 | -------------------------------------------------------------------------------- /files/etc/hostapd.vlan: -------------------------------------------------------------------------------- 1 | # VLAN ID to network interface mapping 2 | #1 vlan1 3 | #2 vlan2 4 | #3 vlan3 5 | #4 vlan4 6 | #100 guest 7 | # Optional wildcard entry matching all VLAN IDs. The first # in the interface 8 | # name will be replaced with the VLAN ID. The network interfaces are created 9 | # (and removed) dynamically based on the use. 10 | * vlan# 11 | 12 | -------------------------------------------------------------------------------- /files/etc/openvpn.user: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # This file is interpreted as shell script. 4 | # Put your custom openvpn action here, they will 5 | # be executed with each opevnp event. 6 | # 7 | # $ACTION 8 | # down action is generated after the TUN/TAP device is closed 9 | # up action is generated after the TUN/TAP device is opened 10 | # $INSTANCE Name of the openvpn instance which went up or down 11 | 12 | A=$1 13 | shift 14 | B=$1 15 | shift 16 | C=$1 17 | 18 | 19 | if [ "$ACTION" = "up" ]; then 20 | BR="br-$INSTANCE" 21 | TAPDEV=$B 22 | logger -s -t "MESHdesk" "OpenVPN up -> Add interface $TAPDEV to bridge $BR" 23 | /sbin/ip link set "$TAPDEV" up 24 | /usr/sbin/brctl addif $BR $TAPDEV 25 | fi 26 | -------------------------------------------------------------------------------- /files/etc/passwd: -------------------------------------------------------------------------------- 1 | root:x:0:0:root:/root:/bin/ash 2 | daemon:*:1:1:daemon:/var:/bin/false 3 | ftp:*:55:55:ftp:/home/ftp:/bin/false 4 | network:*:101:101:network:/var:/bin/false 5 | nobody:*:65534:65534:nobody:/var:/bin/false 6 | -------------------------------------------------------------------------------- /files/etc/rc.local: -------------------------------------------------------------------------------- 1 | # Put your custom commands here that should be executed once 2 | # the system init finished. By default this file does nothing. 3 | 4 | cd /etc/MESHdesk && ./mqtt.lua & 5 | cd /etc/MESHdesk && ./mqtt_watcher.lua & 6 | exit 0 7 | -------------------------------------------------------------------------------- /files/etc/shadow: -------------------------------------------------------------------------------- 1 | root:$1$r6umEfqi$oWLiGiWWpbSB8RhOmyLIT1:16267:0:99999:7::: 2 | daemon:*:0:0:99999:7::: 3 | ftp:*:0:0:99999:7::: 4 | network:*:0:0:99999:7::: 5 | nobody:*:0:0:99999:7::: 6 | -------------------------------------------------------------------------------- /files/usr/share/ucode/luci/template/themes/material/footer.ut: -------------------------------------------------------------------------------- 1 | {# 2 | Material is a clean HTML5 theme for LuCI. It is based on luci-theme-bootstrap and MUI 3 | 4 | luci-theme-material 5 | Copyright 2015 Lutty Yang 6 | 7 | Have a bug? Please create an issue here on GitHub! 8 | https://github.com/LuttyYang/luci-theme-material/issues 9 | 10 | luci-theme-bootstrap: 11 | Copyright 2008 Steven Barth 12 | Copyright 2008 Jo-Philipp Wich 13 | Copyright 2012 David Menting 14 | 15 | MUI: 16 | https://github.com/muicss/mui 17 | 18 | Licensed to the public under the Apache License 2.0 19 | -#} 20 | 21 | 22 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /files/www/luci-static/material/brand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RADIUSdesk/openwrt-meshdesk/1d81affcb5a0e59a309794a48125f25063294afe/files/www/luci-static/material/brand.png -------------------------------------------------------------------------------- /files/www/luci-static/material/custom.css: -------------------------------------------------------------------------------- 1 | /** 2 | The CSS variables in this file should be treated as a public API. The 3 | colors have been put in a separate file to allow end users to 4 | override the color variables with their own values by creating their 5 | own custom.css file, which mean we can't delete/rename defined 6 | variables which is already used in cascade.css. 7 | */ 8 | :root { 9 | /** General colors */ 10 | --white-color: #ffffff; 11 | --white-color-low: #f9f9f9; 12 | --black-color: #000000; 13 | --black-color-low: #202124; 14 | --yellow-color: #f0ad4e; 15 | --yellow-color-high: #eea236; 16 | --on-yellow-color: var(--white-color); 17 | --red-color: #d9534f; 18 | --red-color-high: #d43f3a; 19 | --on-red-color: var(--white-color); 20 | --green-color: #5cb85c; 21 | --green-color-high: #4cae4c; 22 | --on-green-color: var(--white-color); 23 | --dark-blue-color: #337ab7; 24 | --dark-blue-color-high: #2e6da4; 25 | --on-dark-blue-color: var(--white-color); 26 | --gray-color: #d4d4d4; 27 | --gray-color-high: #bfbfbf; 28 | --light-blue-color: #5bc0de; 29 | --light-blue-color-high: #46b8da; 30 | --on-light-blue-color: var(--white-color); 31 | 32 | --secondary-color: #0099cc; 33 | 34 | --notice-color: #002B49; 35 | --on-notice-color: var(--white-color); 36 | 37 | --danger-color: var(--red-color); 38 | --on-danger-color: var(--on-red-color); 39 | 40 | --warning-color: #f0e68c; 41 | --on-warning-color: var(--black-color); 42 | 43 | --success-color: var(--green-color); 44 | --on-success-color: var(--on-green-color); 45 | 46 | --error-color: #ff0000; 47 | --on-error-color: var(--white-color); 48 | 49 | --font-body: "Microsoft Yahei", "WenQuanYi Micro Hei", "sans-serif", "Helvetica Neue", "Helvetica", "Hiragino Sans GB"; 50 | 51 | --main-color:#09c; 52 | --header-bg:#fff; 53 | --header-color:#005691; 54 | --bar-bg:#5bc0de; 55 | --menu-bg-color:#fff; 56 | --menu-color:#5f6368; 57 | --menu-color-hover:#202124; 58 | --main-menu-color:#202124; 59 | --submenu-bg-hover:#d4d4d4; 60 | --submenu-bg-hover-active:#09c; 61 | 62 | } 63 | 64 | footer > a { 65 | color: #005691 !important; 66 | letter-spacing: 5px; 67 | font-size:larger; 68 | } 69 | -------------------------------------------------------------------------------- /files/www/luci-static/material/icons/menu.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /files/www/luci-static/material/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 9 | 19 | 21 | 22 | -------------------------------------------------------------------------------- /files/www/luci-static/material/logo_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RADIUSdesk/openwrt-meshdesk/1d81affcb5a0e59a309794a48125f25063294afe/files/www/luci-static/material/logo_48.png -------------------------------------------------------------------------------- /luci-app-meshdesk/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008-2015 The LuCI Team 3 | # 4 | # This is free software, licensed under the Apache License, Version 2.0 . 5 | # 6 | 7 | include $(TOPDIR)/rules.mk 8 | 9 | PKG_NAME:=luci-app-meshdesk 10 | 11 | # Version == major.minor.patch 12 | # increase "minor" on new functionality and "patch" on patches/optimization 13 | PKG_VERSION:=8.0.0 14 | 15 | # Release == build 16 | # increase on changes of translation files 17 | PKG_RELEASE:=1 18 | 19 | PKG_LICENSE:=Apache-2.0 20 | PKG_MAINTAINER:=Dirk van der Walt 21 | 22 | # LuCI specific settings 23 | LUCI_TITLE:=LuCI Support for MESHdesk firmware 24 | LUCI_DEPENDS:=+luci-mod-admin-full 25 | LUCI_PKGARCH:=all 26 | 27 | define Package/$(PKG_NAME)/config 28 | # shown in make menuconfig 29 | help 30 | $(LUCI_TITLE) 31 | . 32 | Version: $(PKG_VERSION)-$(PKG_RELEASE) 33 | $(PKG_MAINTAINER) 34 | endef 35 | 36 | include ../../luci.mk 37 | 38 | # call BuildPackage - OpenWrt buildroot signature 39 | 40 | -------------------------------------------------------------------------------- /luci-app-meshdesk/luasrc/controller/meshdesk/meshdesk.lua: -------------------------------------------------------------------------------- 1 | module("luci.controller.meshdesk.meshdesk", package.seeall) 2 | 3 | function index() 4 | entry( {"admin", "services", "meshdesk"}, cbi("meshdesk/meshdesk"), _("MESHdesk Settings"), 59).acl_depends = { "luci-app-meshdesk" } 5 | -- entry( {"admin", "services", "meshdesk"}, template("meshdesk/index"), _("MESHdesk Settings"), 59).acl_depends = { "luci-app-meshdesk" } 6 | -- entry( {"admin", "services", "meshdesk"}, call("action_tryme"), _("MESHdesk Settings"), 59).acl_depends = { "luci-app-meshdesk" } 7 | entry({"click", "here", "now"}, call("action_tryme"), "Click here", 10).dependent=false 8 | 9 | end 10 | 11 | function action_tryme() 12 | luci.http.prepare_content("text/plain") 13 | luci.http.write("Haha, rebooting now...") 14 | -- luci.sys.reboot() 15 | end 16 | 17 | -------------------------------------------------------------------------------- /luci-app-meshdesk/luasrc/model/cbi/meshdesk/meshdesk.lua: -------------------------------------------------------------------------------- 1 | local NX = require "nixio"; 2 | local SYS = require "luci.sys"; 3 | local uci = require("uci"); 4 | local x = uci.cursor(nil,'/var/state'); 5 | 6 | m = Map("meshdesk", "MESHdesk") -- We want to edit the uci config file /etc/config/network 7 | 8 | 9 | s = m:section(NamedSection, "internet1",'internet', "Controller Details") 10 | 11 | 12 | function s.validate(self, sectionid) 13 | local field, obj 14 | local values = { } 15 | for field, obj in pairs(self.fields) do 16 | local fieldval = obj:formvalue(sectionid) 17 | if not values[fieldval] then 18 | values[fieldval] = true 19 | else 20 | return nil -- raise error 21 | end 22 | end 23 | 24 | return sectionid -- signal success 25 | end 26 | 27 | 28 | f1 = s:option(ListValue, "disabled", "Central Management") -- Creates an element list (select box) 29 | f1.widget="radio" 30 | f1:value("1", "Disabled") -- Key and value pairs 31 | f1:value("0", "Enabled") 32 | f1.default = "disable" 33 | function f1.write(self, section, value) 34 | return Flag.write(self, section, value) 35 | end 36 | 37 | 38 | function f1.validate(self, value) 39 | if (value == "0")then 40 | f2.optional = false; 41 | end 42 | 43 | if (value == "1")then 44 | f2.optional = true; 45 | f2.rmempty = false; 46 | end 47 | 48 | return value 49 | end 50 | 51 | 52 | local protocol = s:option(ListValue,"protocol", "Protocol"); 53 | protocol:value("http","HTTP"); 54 | protocol:value("https","HTTPS"); 55 | protocol:depends("disabled","0"); 56 | 57 | function protocol.cfgvalue(self,section) 58 | local val = self.map:get(section,"protocol"); 59 | return val 60 | end 61 | 62 | 63 | f2=s:option(Value,"dns",'FQDN','Supply Dummy Value If Not Using DNS System') 64 | f2:depends("disabled","0") 65 | 66 | 67 | --function f2.validate(self, value) 68 | -- return nil 69 | --end 70 | 71 | function f2.cfgvalue(self,section) 72 | local val = self.map:get(section, "dns")--Value.cfgvalue(self, section) 73 | return val 74 | end 75 | 76 | f3=s:option(Value,"ip",'IP Address','Optional If FQDN Fails / Not Used') 77 | f3:depends("disabled","0") 78 | 79 | 80 | function f3.cfgvalue(self,section) 81 | local val = self.map:get(section, "ip")--Value.cfgvalue(self, section) 82 | return val 83 | end 84 | 85 | 86 | 87 | m.on_after_commit = function(self) 88 | local new_disabled = luci.http.formvalue("cbid.meshdesk.internet1.disabled") 89 | local current_disabled = x:get("meshdesk", "internet1", "disabled"); 90 | if(current_disabled ~= new_disabled)then --Did the mode change? 91 | if(new_disabled == '1')then 92 | SYS.exec("touch /etc/config/network"); 93 | SYS.exec("rm /etc/config/network"); 94 | SYS.exec("touch /etc/config/wireless"); 95 | SYS.exec("rm /etc/config/wireless"); 96 | NX.nanosleep(1) -- sleep a second 97 | SYS.exec("/bin/config_generate"); 98 | SYS.exec("/sbin/wifi config"); 99 | SYS.exec("cp /etc/MESHdesk/configs/firewall /etc/config/firewall");--Restore the firewall which was backed up on first boot 100 | SYS.exec("cp /etc/MESHdesk/configs/dhcp /etc/config/dhcp");--Restore the dhcp which was backed up on first boot 101 | return true; 102 | end 103 | end 104 | end 105 | 106 | 107 | return m -- Returns the map 108 | -------------------------------------------------------------------------------- /luci-app-meshdesk/root/usr/share/rpcd/acl.d/luci-app-meshdesk.json: -------------------------------------------------------------------------------- 1 | { 2 | "luci-app-meshdesk": { 3 | "description": "Grant UCI access for luci-app-meshdesk", 4 | "read": { 5 | "uci": [ "meshdesk" ] 6 | }, 7 | "write": { 8 | "uci": [ "meshdesk" ] 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /openwrt-accel-ppp/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2013-2023 OpenWrt.org 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | 8 | include $(TOPDIR)/rules.mk 9 | 10 | PKG_NAME:=accel-ppp 11 | PKG_RELEASE:=14 12 | PKG_VERSION:=main 13 | 14 | PKG_SOURCE_PROTO:=git 15 | PKG_SOURCE_URL=https://github.com/RADIUSdesk/accel-ppp.git 16 | PKG_SOURCE_VERSION:=115358c07ac58440b2e9e4e98a1416e416e0a82b 17 | 18 | PKG_LICENSE:=GPL-2.0 19 | 20 | PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) 21 | 22 | #PKG_INSTALL:=1 23 | #PKG_CONFIG_DEPENDS:=CONFIG_PACKAGE_accel-ppp_$(BUILD_VARIANT)_ext_cer_id 24 | 25 | include $(INCLUDE_DIR)/package.mk 26 | include $(INCLUDE_DIR)/cmake.mk 27 | 28 | define Package/accel-ppp 29 | SECTION:=net 30 | CATEGORY:=Network 31 | TITLE:=accel-ppp IPoE VPN server 32 | DEPENDS:=+libpcre +libopenssl +libpthread +librt +libatomic +libucontext +kmod-sched-core +kmod-pptp +kmod-pppoe +kmod-ppp 33 | endef 34 | 35 | CMAKE_OPTIONS += \ 36 | -DBUILD_DRIVER=FALSE \ 37 | -DKDIR=$(LINUX_DIR) \ 38 | -DCMAKE_INSTALL_PREFIX=/usr \ 39 | -DCMAKE_BUILD_TYPE=Release \ 40 | -DLOG_PGSQL=FALSE \ 41 | -DSHAPER=TRUE \ 42 | -DRADIUS=TRUE \ 43 | -DNETSNMP=FALSE \ 44 | -DLOG_FILE=TRUE \ 45 | -DLIB_SUFFIX= \ 46 | 47 | TARGET_CFLAGS += -I$(STAGING_DIR)/opt/include -D_GNU_SOURCE -g -O2 -Wno-incompatible-pointer-types 48 | TARGET_LDFLAGS += -lpthread -latomic 49 | 50 | define Package/accel-ppp/install 51 | $(INSTALL_DIR) \ 52 | $(1)/usr/sbin \ 53 | $(1)/usr/bin \ 54 | $(1)/usr/share/accel-ppp \ 55 | $(1)/usr/share/accel-ppp/radius \ 56 | $(1)/usr/share/accel-ppp/l2tp \ 57 | $(1)/usr/lib/accel-ppp \ 58 | $(1)/etc/init.d \ 59 | $(1)/etc/accel-ppp 60 | 61 | $(INSTALL_BIN) \ 62 | $(PKG_INSTALL_DIR)/usr/sbin/accel-pppd \ 63 | $(1)/usr/sbin/ 64 | 65 | $(INSTALL_BIN) \ 66 | $(PKG_INSTALL_DIR)/usr/bin/accel-cmd \ 67 | $(1)/usr/bin/ 68 | 69 | $(INSTALL_BIN) \ 70 | $(PKG_INSTALL_DIR)/usr/lib/accel-ppp/*.so \ 71 | $(1)/usr/lib/accel-ppp/ 72 | 73 | $(INSTALL_BIN) \ 74 | $(PKG_INSTALL_DIR)/usr/lib/accel-ppp/libtriton.so \ 75 | $(1)/usr/lib/ 76 | 77 | $(INSTALL_DATA) \ 78 | $(PKG_INSTALL_DIR)/usr/share/accel-ppp/radius/dictionary* \ 79 | $(1)/usr/share/accel-ppp/radius/ 80 | 81 | $(INSTALL_DATA) \ 82 | $(PKG_INSTALL_DIR)/usr/share/accel-ppp/l2tp/dictionary* \ 83 | $(1)/usr/share/accel-ppp/l2tp/ 84 | 85 | $(INSTALL_BIN) \ 86 | files/accel-ppp.init \ 87 | $(1)/etc/init.d/accel-ppp 88 | 89 | $(INSTALL_DATA) \ 90 | files/accel-ppp.conf \ 91 | $(1)/etc/accel-ppp 92 | 93 | endef 94 | 95 | $(eval $(call BuildPackage,accel-ppp)) 96 | -------------------------------------------------------------------------------- /openwrt-accel-ppp/README.md: -------------------------------------------------------------------------------- 1 | # openwrt-accel-ppp 2 | ACCEL-PPP is a high performance VPN server application for linux. 3 | OpenWrt package 4 | -------------------------------------------------------------------------------- /openwrt-accel-ppp/files/accel-ppp.init: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | 3 | START=35 4 | STOP=85 5 | USE_PROCD=1 6 | 7 | start_service() { 8 | procd_open_instance 9 | procd_set_param command /usr/sbin/accel-pppd -d -c /etc/accel-ppp/accel-ppp.conf 10 | # procd_set_param respawn 11 | procd_close_instance 12 | } 13 | 14 | reload_service() { 15 | procd_send_signal accel-ppp 16 | } 17 | 18 | service_triggers() 19 | { 20 | procd_add_reload_trigger accel-ppp 21 | } 22 | --------------------------------------------------------------------------------