<div dir="ltr">Hello, this is really an Asterisk question. <div>Here in Kamailio we'd recommend you do that filtering at the proxy level, using the "permissions" module.<div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Regards,</div><div><br></div>David Villasmil<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div><div>phone: +34669448337</div></div></div></div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Oct 10, 2021 at 6:52 PM Mihai Cezar <<a href="mailto:cezar@mokalife.ro">cezar@mokalife.ro</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
The last matching rule is the one used. If no rule matches, then the<br>
connection is permitted.<br>
<br>
Example:<br>
deny=<a href="http://0.0.0.0/0.0.0.0" rel="noreferrer" target="_blank">0.0.0.0/0.0.0.0</a><br>
permit=<a href="http://1.2.3.4/32" rel="noreferrer" target="_blank">1.2.3.4/32</a><br>
Deny every address except for the only one allowed.<br>
<br>
Basically the rules are processed from the first to the last.<br>
<br>
On Sat, Oct 9, 2021 at 3:26 PM Bugaian A. Vitalie <<a href="mailto:bugaian@gmail.com" target="_blank">bugaian@gmail.com</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> I think its the order you apply the ACL, first permit some, then deny any?<br>
><br>
> Vitalie.<br>
><br>
> On Sat, Oct 9, 2021 at 1:58 PM Mihai Cezar <<a href="mailto:cezar@mokalife.ro" target="_blank">cezar@mokalife.ro</a>> wrote:<br>
>><br>
>> Hello,<br>
>><br>
>> I have an issue with filtering on the asterisk side, my requests are:<br>
>> UsersPhones(bria) -> Kamailio -> Asterisk -> Sip Trunk Out.<br>
>><br>
>> The goal is to manage a new layer of protection ( IP filtering / Whitelisting ).<br>
>> When I try to compile a list of Whitelisted IP in sip.conf I get this error:<br>
>><br>
>> NOTICE[205]: acl.c:748 ast_apply_acl: SIP contact ACL: Rejecting<br>
>> '145.72.23.45' due to a failure to pass ACL '(BASELINE)'<br>
>> WARNING[205]: chan_sip.c:17061 parse_register_contact: Domain<br>
>> '<a href="http://5.12.16.2:48669" rel="noreferrer" target="_blank">5.12.16.2:48669</a>' disallowed by contact ACL (violating IP<br>
>> 145.72.23.45)<br>
>> WARNING[205]: chan_sip.c:17933 register_verify: Registration denied<br>
>> because of contact ACL<br>
>><br>
>> The IP 145.72.23.45, is the proxy kamailio and if I added it to<br>
>> sip.conf it works, but so does every ip afterwards.<br>
>><br>
>> I tried with contactpermit also with permit, the result is the same as<br>
>> long as I permit the proxy ip it works. Is there something that I can<br>
>> do on the asterisk side to activate this filtering Or there is<br>
>> something that I can do in Kamailio so it will forward the realip ?<br>
>><br>
>> contactdeny=<a href="http://0.0.0.0/0.0.0.0" rel="noreferrer" target="_blank">0.0.0.0/0.0.0.0</a><br>
>> contactpermit=<a href="http://145.72.23.45/32" rel="noreferrer" target="_blank">145.72.23.45/32</a><br>
>> contactpermit=<a href="http://5.12.16.2/32" rel="noreferrer" target="_blank">5.12.16.2/32</a><br>
>><br>
>><br>
>> Thanks in advance,<br>
>><br>
>> __________________________________________________________<br>
>> Kamailio - Users Mailing List - Non Commercial Discussions<br>
>>   * <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
>> Important: keep the mailing list in the recipients, do not reply only to the sender!<br>
>> Edit mailing list options or unsubscribe:<br>
>>   * <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
><br>
> __________________________________________________________<br>
> Kamailio - Users Mailing List - Non Commercial Discussions<br>
>   * <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
> Important: keep the mailing list in the recipients, do not reply only to the sender!<br>
> Edit mailing list options or unsubscribe:<br>
>   * <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br>
__________________________________________________________<br>
Kamailio - Users Mailing List - Non Commercial Discussions<br>
  * <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
Important: keep the mailing list in the recipients, do not reply only to the sender!<br>
Edit mailing list options or unsubscribe:<br>
  * <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div>