From 8986de8101339d5b7a2b9842536f7550ab8fcafc Mon Sep 17 00:00:00 2001
From: nrb <freifunk@nicoboehr.de>
Date: Sat, 17 Aug 2019 14:53:39 +0200
Subject: [PATCH] add ffs-allow-wan-status

This will make the status page accessible over the WAN interface by
default.
---
 ffs-allow-wan-status/Makefile                 | 34 +++++++++++++++++++
 .../lib/gluon/upgrade/141-allow-wan-status    | 13 +++++++
 2 files changed, 47 insertions(+)
 create mode 100644 ffs-allow-wan-status/Makefile
 create mode 100644 ffs-allow-wan-status/files/lib/gluon/upgrade/141-allow-wan-status

diff --git a/ffs-allow-wan-status/Makefile b/ffs-allow-wan-status/Makefile
new file mode 100644
index 0000000..c2204cc
--- /dev/null
+++ b/ffs-allow-wan-status/Makefile
@@ -0,0 +1,34 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ffs-allow-wan-status
+PKG_VERSION:=1
+
+PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
+
+include $(TOPDIR)/../package/gluon.mk
+
+PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG)
+
+
+define Package/ffs-allow-wan-status
+  SECTION:=gluon
+  CATEGORY:=Gluon
+  TITLE:=Allow status page to be accessed over WAN
+endef
+
+define Build/Prepare
+	mkdir -p $(PKG_BUILD_DIR)
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+define Package/ffs-allow-wan-status/install
+	$(INSTALL_DIR) $(1)/lib/gluon/upgrade
+	$(INSTALL_BIN) ./files/lib/gluon/upgrade/141-allow-wan-status $(1)/lib/gluon/upgrade/141-allow-wan-status
+endef
+
+$(eval $(call BuildPackage,ffs-allow-wan-status))
diff --git a/ffs-allow-wan-status/files/lib/gluon/upgrade/141-allow-wan-status b/ffs-allow-wan-status/files/lib/gluon/upgrade/141-allow-wan-status
new file mode 100644
index 0000000..60b85f4
--- /dev/null
+++ b/ffs-allow-wan-status/files/lib/gluon/upgrade/141-allow-wan-status
@@ -0,0 +1,13 @@
+#!/usr/bin/lua
+
+local uci = require('simple-uci').cursor()
+	
+uci:section('firewall', 'rule', 'wan_status', {
+	name =  'wan_status',
+	src = 'wan',
+	dest_port = '80',
+	proto = 'tcp',
+	target = 'ACCEPT',
+})
+
+uci:save('firewall')
-- 
GitLab