[sr-dev] [kamailio/kamailio] Feature Request: Configure permissions module without database (#2037)

Daniel-Constantin Mierla notifications at github.com
Wed Aug 21 11:25:42 CEST 2019


As another solution, when using KEMI, I did it by defining a local map/array and then looping and using ipops functions, like next one in Lua:

```
ALLOWADDR={
    "10.10.10.0/24",,
    "10.11.11.11/32"
};

function ksr_is_src_trusted()
    local srcaddr = KSR.pv.get("$si");
    for idx, val in pairs(ALLOWADDR) do
        if KSR.ipops.ip_is_in_subnet(srcaddr, val) > 0 then
            return true;
        end
    end
    return false;
end
```

Then reload Lua script.

Also, if you match on IP only, then you can use dispatcher module, there are functions to match addresses in a group.

Then, permissions module has functionality to work with text files, but I am not sure they map on trusted or address table, never used those features, but I expect to be something documented in the readme.

Finally, I actually considered to implement an embedded solution in the module to work with a text file for address matching (I am not using allow_trusted(), only allow_address()), but I didn't get there yet, finding other variants so far when I wanted to avoid database.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2037#issuecomment-523375754
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20190821/3e65b2ee/attachment.html>


More information about the sr-dev mailing list