From: Dirk Brenken Date: Mon, 9 Sep 2019 14:51:42 +0000 (+0200) Subject: luci-app-banip: sync with banIP 0.2.0 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=refs%2Fpull%2F3052%2Fhead;p=project%2Fluci.git luci-app-banip: sync with banIP 0.2.0 * see details in package PR Signed-off-by: Dirk Brenken --- diff --git a/applications/luci-app-banip/luasrc/controller/banip.lua b/applications/luci-app-banip/luasrc/controller/banip.lua index 42328d7ea4..6ada1d5167 100644 --- a/applications/luci-app-banip/luasrc/controller/banip.lua +++ b/applications/luci-app-banip/luasrc/controller/banip.lua @@ -30,7 +30,9 @@ function index() end function ban_action(name) - if name == "do_reload" then + if name == "do_refresh" then + luci.sys.call("/etc/init.d/banip refresh >/dev/null 2>&1") + elseif name == "do_reload" then luci.sys.call("/etc/init.d/banip reload >/dev/null 2>&1") end luci.http.prepare_content("text/plain") diff --git a/applications/luci-app-banip/luasrc/model/cbi/banip/overview_tab.lua b/applications/luci-app-banip/luasrc/model/cbi/banip/overview_tab.lua index 277b8363ed..9ce6703a4e 100644 --- a/applications/luci-app-banip/luasrc/model/cbi/banip/overview_tab.lua +++ b/applications/luci-app-banip/luasrc/model/cbi/banip/overview_tab.lua @@ -45,8 +45,6 @@ o4:value("uclient-fetch") o4:value("wget") o4:value("curl") o4:value("aria2c") -o4:value("wget-nossl", "wget-nossl (noSSL)") -o4:value("busybox", "wget-busybox (noSSL)") o4.default = "uclient-fetch" o4.rmempty = false @@ -57,22 +55,9 @@ ds.template = "banip/runtime" -- Source Table -bl = m:section(TypedSection, "source", translate("IP Blocklist Sources")) +bl = m:section(TypedSection, "source", translate("IPSet Sources")) bl.template = "banip/sourcelist" -ssl = bl:option(DummyValue, "ban_src", translate("SSL req.")) -function ssl.cfgvalue(self, section) - local source = self.map:get(section, "ban_src") or self.map:get(section, "ban_src_6") - if source then - if source:match("https://") then - return translate("Yes") - else - return translate("No") - end - end - return translate("n/a") -end - name_4 = bl:option(Flag, "ban_src_on", translate("enable IPv4")) name_4.rmempty = false @@ -108,38 +93,35 @@ e2.disabled = "0" e2.enabled = "10" e2.rmempty = false -e3 = e:option(Flag, "ban_backup", translate("Enable Blocklist Backup"), - translate("Create compressed blocklist backups, they will be used in case of download errors or during startup in 'backup mode'.")) -e3.rmempty = false +e3 = e:option(Value, "ban_backupdir", translate("Backup Directory"), + translate("Target directory for banIP backups. Default is '/tmp', please use preferably a non-volatile disk if available.")) +e3.datatype = "directory" +e3.default = "/tmp" +e3.rmempty = true -e4 = e:option(Value, "ban_backupdir", translate("Backup Directory"), - translate("Target directory for banIP backups. Please use preferably a non-volatile disk, e.g. an external usb stick.")) -e4:depends("ban_backup", 1) -e4.datatype = "directory" -e4.default = "/mnt" -e4.rmempty = true - -e5 = e:option(Flag, "ban_backupboot", translate("Backup Mode"), - translate("Do not automatically update blocklists during startup, use their backups instead.")) -e5:depends("ban_backup", 1) -e5.rmempty = true - -e6 = e:option(Value, "ban_maxqueue", translate("Max. Download Queue"), +e4 = e:option(Value, "ban_maxqueue", translate("Max. Download Queue"), translate("Size of the download queue to handle downloads & IPset processing in parallel (default '4'). ") .. translate("For further performance improvements you can raise this value, e.g. '8' or '16' should be safe.")) -e6.default = 4 -e6.datatype = "range(1,32)" -e6.rmempty = false +e4.default = 4 +e4.datatype = "range(1,32)" +e4.rmempty = false + +e5 = e:option(ListValue, "ban_sshdaemon", translate("SSH Daemon"), + translate("Select the SSH daemon for logfile parsing, to detect break-in events.")) +e5:value("dropbear") +e5:value("sshd") +e5.default = "dropbear" +e5.rmempty = true -e7 = e:option(Flag, "ban_autoblacklist", translate("Local Save Blacklist Addons"), +e6 = e:option(Flag, "ban_autoblacklist", translate("Local Save Blacklist Addons"), translate("Blacklist auto addons are stored temporary in the IPSet and saved permanently in the local blacklist. Disable this option to prevent the local save.")) -e7.default = e7.enabled -e7.rmempty = true +e6.default = e6.enabled +e6.rmempty = true -e8 = e:option(Flag, "ban_autowhitelist", translate("Local Save Whitelist Addons"), +e7 = e:option(Flag, "ban_autowhitelist", translate("Local Save Whitelist Addons"), translate("Whitelist auto addons are stored temporary in the IPSet and saved permanently in the local whitelist. Disable this option to prevent the local save.")) -e8.default = e8.enabled -e8.rmempty = true +e7.default = e7.enabled +e7.rmempty = true -- Optional Extra Options @@ -149,72 +131,79 @@ e20.default = 2 e20.datatype = "range(1,60)" e20.optional = true -e21 = e:option(Value, "ban_fetchparm", translate("Download Options"), - translate("Special options for the selected download utility, e.g. '--timeout=20 --no-check-certificate -O'.")) +e21 = e:option(ListValue, "ban_starttype", translate("Start Type"), + translate("Select the used start type during boot.")) +e21:value("start") +e21:value("reload") +e21.default = "start" e21.optional = true -e22 = e:option(Value, "ban_wan_input_chain", translate("WAN Input Chain IPv4")) -e22.default = "input_wan_rule" -e22.datatype = "uciname" +e22 = e:option(Value, "ban_fetchparm", translate("Download Options"), + translate("Special options for the selected download utility, e.g. '--timeout=20 --no-check-certificate -O'.")) e22.optional = true -e23 = e:option(Value, "ban_wan_forward_chain", translate("WAN Forward Chain IPv4")) -e23.default = "forwarding_wan_rule" -e23.datatype = "uciname" -e23.optional = true - -e24 = e:option(Value, "ban_lan_input_chain", translate("LAN Input Chain IPv4")) -e24.default = "input_lan_rule" -e24.datatype = "uciname" -e24.optional = true - -e25 = e:option(Value, "ban_lan_forward_chain", translate("LAN Forward Chain IPv4")) -e25.default = "forwarding_lan_rule" -e25.datatype = "uciname" -e25.optional = true - -e26 = e:option(ListValue, "ban_target_src", translate("SRC Target IPv4")) -e26:value("REJECT") -e26:value("DROP") -e26.default = "DROP" -e26.optional = true - -e27 = e:option(ListValue, "ban_target_dst", translate("DST Target IPv4")) -e27:value("REJECT") -e27:value("DROP") -e27.default = "REJECT" -e27.optional = true - -e28 = e:option(Value, "ban_wan_input_chain_6", translate("WAN Input Chain IPv6")) -e28.default = "input_wan_rule" -e28.datatype = "uciname" -e28.optional = true - -e29 = e:option(Value, "ban_wan_forward_chain_6", translate("WAN Forward Chain IPv6")) -e29.default = "forwarding_wan_rule" -e29.datatype = "uciname" -e29.optional = true - -e30 = e:option(Value, "ban_lan_input_chain_6", translate("LAN Input Chain IPv6")) -e30.default = "input_lan_rule" +e30 = e:option(Value, "ban_wan_input_chain", translate("WAN Input Chain IPv4")) +e30.default = "input_wan_rule" e30.datatype = "uciname" e30.optional = true -e31 = e:option(Value, "ban_lan_forward_chain_6", translate("LAN Forward Chain IPv6")) -e31.default = "forwarding_lan_rule" +e31 = e:option(Value, "ban_wan_forward_chain", translate("WAN Forward Chain IPv4")) +e31.default = "forwarding_wan_rule" e31.datatype = "uciname" e31.optional = true -e32 = e:option(ListValue, "ban_target_src_6", translate("SRC Target IPv6")) -e32:value("REJECT") -e32:value("DROP") -e32.default = "DROP" +e32 = e:option(Value, "ban_lan_input_chain", translate("LAN Input Chain IPv4")) +e32.default = "input_lan_rule" +e32.datatype = "uciname" e32.optional = true -e33 = e:option(ListValue, "ban_target_dst_6", translate("DST Target IPv6")) -e33:value("REJECT") -e33:value("DROP") -e33.default = "REJECT" +e33 = e:option(Value, "ban_lan_forward_chain", translate("LAN Forward Chain IPv4")) +e33.default = "forwarding_lan_rule" +e33.datatype = "uciname" e33.optional = true +e34 = e:option(ListValue, "ban_target_src", translate("SRC Target IPv4")) +e34:value("REJECT") +e34:value("DROP") +e34.default = "DROP" +e34.optional = true + +e35 = e:option(ListValue, "ban_target_dst", translate("DST Target IPv4")) +e35:value("REJECT") +e35:value("DROP") +e35.default = "REJECT" +e35.optional = true + +e36 = e:option(Value, "ban_wan_input_chain_6", translate("WAN Input Chain IPv6")) +e36.default = "input_wan_rule" +e36.datatype = "uciname" +e36.optional = true + +e37 = e:option(Value, "ban_wan_forward_chain_6", translate("WAN Forward Chain IPv6")) +e37.default = "forwarding_wan_rule" +e37.datatype = "uciname" +e37.optional = true + +e38 = e:option(Value, "ban_lan_input_chain_6", translate("LAN Input Chain IPv6")) +e38.default = "input_lan_rule" +e38.datatype = "uciname" +e38.optional = true + +e39 = e:option(Value, "ban_lan_forward_chain_6", translate("LAN Forward Chain IPv6")) +e39.default = "forwarding_lan_rule" +e39.datatype = "uciname" +e39.optional = true + +e40 = e:option(ListValue, "ban_target_src_6", translate("SRC Target IPv6")) +e40:value("REJECT") +e40:value("DROP") +e40.default = "DROP" +e40.optional = true + +e41 = e:option(ListValue, "ban_target_dst_6", translate("DST Target IPv6")) +e41:value("REJECT") +e41:value("DROP") +e41.default = "REJECT" +e41.optional = true + return m diff --git a/applications/luci-app-banip/luasrc/view/banip/runtime.htm b/applications/luci-app-banip/luasrc/view/banip/runtime.htm index 410528130c..44682206b7 100644 --- a/applications/luci-app-banip/luasrc/view/banip/runtime.htm +++ b/applications/luci-app-banip/luasrc/view/banip/runtime.htm @@ -10,16 +10,23 @@ This is free software, licensed under the Apache License, Version 2.0 { var btn1 = document.getElementById("btn1"); var btn1_running = document.getElementById("btn1_running"); + var btn2 = document.getElementById("btn2"); + var btn2_running = document.getElementById("btn2_running"); var view = document.getElementById("value_1"); var input = json.data.status; - btn1.value = "<%:Reload%>"; - btn1.name = "do_reload"; + btn1.value = "<%:Refresh%>"; + btn1.name = "do_refresh"; + + btn2.value = "<%:Reload%>"; + btn2.name = "do_reload"; view.innerHTML = input || "-"; if (input != "running") { btn1.disabled = false; running(btn1_running, 0); + btn2.disabled = false; + running(btn2_running, 0); } view = document.getElementById("value_2"); input = json.data.version; @@ -31,6 +38,9 @@ This is free software, licensed under the Apache License, Version 2.0 input = json.data.ipset_info; view.innerHTML = input || "-"; view = document.getElementById("value_5"); + input = json.data.backup_dir; + view.innerHTML = input || "-"; + view = document.getElementById("value_6"); input = json.data.last_run; view.innerHTML = input || "-"; } @@ -39,10 +49,21 @@ function btn_action(action) { var btn1 = document.getElementById("btn1"); var btn1_running = document.getElementById("btn1_running"); + var btn2 = document.getElementById("btn2"); + var btn2_running = document.getElementById("btn2_running"); - btn1.disabled = true; - running(btn1_running, 1); - + if (action.name === "do_refresh") + { + btn1.disabled = true; + btn2.disabled = true; + running(btn1_running, 1); + } + else if (action.name === "do_reload") + { + btn1.disabled = true; + btn2.disabled = true; + running(btn2_running, 1); + } new XHR.get('<%=luci.dispatcher.build_url("admin", "services", "banip")%>/action/' + action.name, null, function(x) { @@ -114,17 +135,30 @@ function btn_action(action)
- +
-
+
+ +
+ - +
+

- +
- +
+
+ +
+ + +
+