Re: Whitelisting and Blacklisting IPs Without Using a Database

"Calvin E. via sr-users" <[email protected]>
Newsgroups gmane.comp.voip.ser
Message-ID <CAC_jndqdW4xbGt82u1O+QhJPR7uFL1yDBO8xCaR6XBUBKz-O9A@mail.gmail.com>
The first thing that comes to mind is the regex module. It can reload
files during runtime using "kamcmd regex.reload" and provides regex
groups to use for different purposes.

https://kamailio.org/docs/modules/stable/modules/regex.html

Just make sure to escape dots and anchor the first and last, like
^1\.2\.3.\4$$" so you don't get unintended matches. The double dollar
is mentioned here:
https://kamailio.org/docs/modules/stable/modules/regex.html#idm144

If you will have a lot of groups or ver big groups, don't forget to
tune the number of groups and the size of each group:

https://kamailio.org/docs/modules/stable/modules/regex.html#regex.p.max_groups
https://kamailio.org/docs/modules/stable/modules/regex.html#regex.p.group_max_size

On Thu, Oct 23, 2025 at 10:04 AM Fernando Lopes via sr-users
<[email protected]> wrote:
>
> Hello everyone,
>
> I have a question: is there a way to whitelist and blacklist IP addresses without using a database table?
>
> I’m currently using the permissions module to block some traffic, but I’d also like to ban specific IPs. Ideally, I’d prefer not to use a database — I’d rather use a file-based approach, something like a permissions.allow file.
>
> Thank you.
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions -- [email protected]
> To unsubscribe send an email to [email protected]
> Important: keep the mailing list in the recipients, do not reply only to the sender!
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the sender!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.