<div dir="ltr"><div>For what it's worth, we've set up a network/system where Asterisk resides completely on a private network with Kamailio acting as an edge proxy. RTPEngine is necessary as well to help the media through to the private network, but that's probably not surprising. It is completely doable, although the suggestions below about simply restricting Asterisk on a public network to the locations of the Kamailio proxies also works quite well.<br></div><div><br></div><div>Matching inbound requests in Asterisk to only the pool of Kamailio proxies can be done in a variety of fashions - IP address matching being the simplest. You will obviously need to think carefully about how Asterisk handles its outbound calling. If Kamailio is going to act as your registrar, then you will need to find some way to expose the registered contacts to Asterisk - we chose this route, and wrote a small REST sidecar to Kamailio for that purpose. If Asterisk is going to act as your registrar, you will need to fork the REGISTER requests to all of the Asterisk instances. Additionally, for INVITE requests being initiated by Asterisk, you will want to force those to flow through your edge proxies. This can be done using Asterisk's outbound_proxy setting on the AOR object in pjsip.conf.<br></div><div><br><div class="gmail_quote"><div dir="ltr">On Mon, Aug 20, 2018 at 6:23 AM Kevin Olbrich <<a href="mailto:ko@sv01.de">ko@sv01.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Henning,<div><br></div><div>I browsed the files but was unable to find one using Kamailio as SBC without exposing the Asterisk core.</div><div>Most examples indeed expose the node and let media flow directly (<a href="https://www.kamailio.org/events/2017-KamailioWorld/Day1/08-David.Casem-Building-A-Global-VoIP-Network.pdf" target="_blank">https://www.kamailio.org/events/2017-KamailioWorld/Day1/08-David.Casem-Building-A-Global-VoIP-Network.pdf</a> - interesting solution with e/iBGP which we would also be able to deploy).</div><div><br></div><div>There was just a single presentation that I was able to locate that had the proxy only on the edge:</div><div><a href="https://www.kamailio.org/events/2017-KamailioWorld/Day2/15-Sebasitan.Damm-Anti-Fraud-With-HTables.pdf" target="_blank">https://www.kamailio.org/events/2017-KamailioWorld/Day2/15-Sebasitan.Damm-Anti-Fraud-With-HTables.pdf</a><br></div><div>At least it looks like they are located behind the SBC.</div><div><br></div><div>After the research my impression is, that co-locating the B2BUA with the Edge-Proxy and firewall-ing it, seems best practice.</div><div>We will try to add some security by bridge-firewalling and BGP.</div><div><br></div><div>If anyone has a hint for a presentation with high-security edge-proxy, I would appreciate it. Thank you.</div><div><br></div><div>Kind regards,</div><div>Kevin</div><div><br><br><div class="gmail_quote"><div dir="ltr">Am Do., 16. Aug. 2018 um 19:12 Uhr schrieb Henning Westerholt <<a href="mailto:hw@kamailio.org" target="_blank">hw@kamailio.org</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Am Donnerstag, 16. August 2018, 11:57:03 CEST schrieb Kevin Olbrich:<br>
> I am working successfully with Kamailio in my lab setup where Kamailio is<br>
> the SBC for Asterisk.<br>
> The network layout is looking like this:<br>
> <br>
> SIP-Phone <== PUBLIC NET ==> Kamailio (SBC) <== PRIVATE NET ==> Asterisk<br>
> <== PUBLIC NET ==> Carrier<br>
> <br>
> Each public network is reachable from the internet and has a local firewall<br>
> with IP whitelists.<br>
> The internal SIP transactions are UDP-only but for external phones I would<br>
> like to also listen for TCP/TLS.<br>
> <br>
> For this layout to work with rtpproxy (before we move on to RTPengine), we<br>
> have to enable mhomed in Kamailio.<br>
> We also have some routing issues with packets leaving with the wrong IP via<br>
> rtpproxy (when call between carrier and external phone needs to be bridged).<br>
> <br>
> Most examples show that Asterisk is deployed on the same network as the<br>
> external interface of Kamailio (-> Asterisk exposed to the public network).<br>
> In our tests, this works much better but I have great security concerns<br>
> because this Asterisk instance itself does not need to be reachable from<br>
> external.<br>
> <br>
> How do other users deploy Kamailio in front of Asterisk or similar as SBC<br>
> to secure internals?<br>
> There is lot of docs for Kamailio's config but IMHO less for the setup as<br>
> DMZ (SBC) proxy.<br>
<br>
Hello Kevin,<br>
<br>
this is indeed a common setup to protect asterisk and to have also much <br>
greater flexibility with regards to balancing and/or SIP message adaptions.<br>
<br>
To get some ideas, have a look to the last years conferences available here:<br>
<br>
<a href="https://www.kamailio.org/events/" rel="noreferrer" target="_blank">https://www.kamailio.org/events/</a><br>
<br>
There should be some talks about using Kamailio to in front of asterisk, the <br>
talk name is usually in the file name.<br>
<br>
I think even on this year cluecon Fred Posner did a talk about Kamailio as <br>
Edge Proxy, and also on astricon there were some talks  about this scenario if <br>
I remember correctly.<br>
<br>
You should also find in the Kamailio World or FOSDEM talks a lot of <br>
information about this scenario.  You find all the talks available from <br>
Kamailio World in our youtube channel: <br>
<br>
<a href="https://www.youtube.com/kamailioworld" rel="noreferrer" target="_blank">https://www.youtube.com/kamailioworld</a><br>
<br>
Best regards,<br>
<br>
Henning<br>
<br>
-- <br>
Henning Westerholt<br>
<a href="https://skalatan.de/blog/" rel="noreferrer" target="_blank">https://skalatan.de/blog/</a><br>
</blockquote></div></div></div>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><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><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Matthew Jordan<br>Digium, Inc. | CTO<br>445 Jan Davis Drive NW - Huntsville, AL 35806 - USA<br>Check us out at: <a href="http://digium.com" target="_blank">http://digium.com</a> & <a href="http://asterisk.org" target="_blank">http://asterisk.org</a></div></div></div>