Add gluon-firewall package to mitigate open resolver issue

Original patch by Daniel Ehlers <danielehlers@mindeye.net>
This commit is contained in:
Matthias Schiffer 2014-06-06 12:59:32 +02:00
parent 6f9fbcc6b7
commit 9786be0d15
2 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,37 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-firewall
PKG_VERSION:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/gluon-firewall
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Restrictive firewall rules
DEPENDS:=+gluon-core +firewall
endef
define Package/gluon-firewall/description
Gluon community wifi mesh firmware framework:
Firewall rules which try to ensure a node can't be abused
(e.g. for DNS amplification attacks)
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/gluon-firewall/install
$(CP) ./files/* $(1)/
endef
$(eval $(call BuildPackage,gluon-firewall))

View File

@ -0,0 +1,29 @@
#!/usr/bin/lua
local site = require 'gluon.site_config'
local uci = require 'luci.model.uci'
local c = uci.cursor()
local function reject_input_on_wan(zone)
if zone.name == 'wan' then
c:set('firewall', zone['.name'], 'input', 'REJECT')
end
return true
end
c:foreach('firewall', 'zone', reject_input_on_wan)
c:section('firewall', 'rule', 'wan_ssh',
{
name = 'wan_ssh',
src = 'wan',
dest_port = '22',
proto = 'tcp',
target = 'ACCEPT',
}
)
c:save('firewall')
c:commit('firewall')