Software /
code /
prosody-modules
Comparison
mod_firewall/mod_firewall.lua @ 2364:17d236129118
mod_firewall: Allow implicit defitions of chains in scripts if they begin with 'user/'
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 15 Nov 2016 14:58:43 +0000 |
parent | 2342:6848297cf40a |
child | 2365:05dae9adf778 |
comparison
equal
deleted
inserted
replaced
2363:12b78170b76c | 2364:17d236129118 |
---|---|
215 state = nil; | 215 state = nil; |
216 elseif not(state) and line:sub(1, 2) == "::" then | 216 elseif not(state) and line:sub(1, 2) == "::" then |
217 chain = line:gsub("^::%s*", ""); | 217 chain = line:gsub("^::%s*", ""); |
218 local chain_info = chains[chain]; | 218 local chain_info = chains[chain]; |
219 if not chain_info then | 219 if not chain_info then |
220 return nil, errmsg("Unknown chain: "..chain); | 220 if chain:match("^user/") then |
221 chains[chain] = { type = "event", priority = 1, "firewall/chains/"..chain }; | |
222 else | |
223 return nil, errmsg("Unknown chain: "..chain); | |
224 end | |
221 elseif chain_info.type ~= "event" then | 225 elseif chain_info.type ~= "event" then |
222 return nil, errmsg("Only event chains supported at the moment"); | 226 return nil, errmsg("Only event chains supported at the moment"); |
223 end | 227 end |
224 ruleset[chain] = ruleset[chain] or {}; | 228 ruleset[chain] = ruleset[chain] or {}; |
225 elseif not(state) and line:sub(1,1) == "%" then -- Definition (zone, limit, etc.) | 229 elseif not(state) and line:sub(1,1) == "%" then -- Definition (zone, limit, etc.) |