Re: Rules tuning categories
Posted by
hans2 on
Mar 02, 2016; 5:52pm
URL: https://itus.accessinnov.com/Rules-tuning-categories-tp222p253.html
/usr/lib/lua/luci/controller/snort.lua and /usr/lib/lua/luci/model/cbi/snort.lua are responsible for how LuCI works with the Services > IPS section.
In the cbi/snort.lua this is the code for exclusion tab:
.....
--------------------- Exclude Rules Tab ------------------------
config_file5 = s:taboption("tab_rules", TextValue, "text4", "")
config_file5.wrap = "off"
config_file5.rows = 25
config_file5.rmempty = false
function config_file5.cfgvalue()
local uci = require "luci.model.uci".cursor_state()
file = "/etc/snort/rules/exclude.rules"
if file then
return fs.readfile(file) or ""
else
return ""
end
end
function config_file5.write(self, section, value)
if value then
local uci = require "luci.model.uci".cursor_state()
file = "/etc/snort/rules/exclude.rules"
fs.writefile(file, value:gsub("\r\n", "\n"))
luci.sys.call("/etc/init.d/snort restart")
end
end
.....
but the code looks clean and similar to the other codes access when changing the custom rules, threshold config etc.
No more: Shield Pro v1, Chaos Calmer, FW 1.51 SP1