comparison mod_firewall/mod_firewall.lua @ 2113:d75145297bf9

mod_firewall: Support for defining extra chains in the config file
author Matthew Wild <mwild1@gmail.com>
date Thu, 17 Mar 2016 12:09:20 +0000
parents 41a0a9db89ef
children 5aa3b93cd37a
comparison
equal deleted inserted replaced
2111:4e434abaf8fc 2113:d75145297bf9
4 local it = require "util.iterators"; 4 local it = require "util.iterators";
5 5
6 local definitions = module:shared("definitions"); 6 local definitions = module:shared("definitions");
7 local active_definitions = {}; 7 local active_definitions = {};
8 8
9 local chains = { 9 local default_chains = {
10 preroute = { 10 preroute = {
11 type = "event"; 11 type = "event";
12 priority = 0.1; 12 priority = 0.1;
13 "pre-message/bare", "pre-message/full", "pre-message/host"; 13 "pre-message/bare", "pre-message/full", "pre-message/host";
14 "pre-presence/bare", "pre-presence/full", "pre-presence/host"; 14 "pre-presence/bare", "pre-presence/full", "pre-presence/host";
24 deliver_remote = { 24 deliver_remote = {
25 type = "event"; "route/remote"; 25 type = "event"; "route/remote";
26 priority = 0.1; 26 priority = 0.1;
27 }; 27 };
28 }; 28 };
29
30 local extra_chains = module:get_option("firewall_extra_chains", {});
31
32 local chains = {};
33 for k,v in pairs(default_chains) do
34 chains[k] = v;
35 end
36 for k,v in pairs(extra_chains) do
37 chains[k] = v;
38 end
29 39
30 function idsafe(name) 40 function idsafe(name)
31 return name:match("^%a[%w_]*$") 41 return name:match("^%a[%w_]*$")
32 end 42 end
33 43