<p>TLSOPS module was extended to add support for checking correspondence between FROM/TO URIs and CN of the client certificate used for TLS connection = client authentication via client certificates.</p>
<p>For clients using TLS client certificates this patch can save bandwidth and messages up to 50% for REGISTER, MESSAGE and INVITE requests compared to traditional www_authorize authentication. This improvement is especially important for clients connected via mobile networks (higher packet loss / latency). </p>
<p>Example configuration for TLS client authentication:</p>
<pre><code># authenticate the REGISTER requests
if (proto==TLS && is_peer_verified()){
xlog("L_NOTICE","[$pr:$fU@$si:$sp]: Processing '$rm' auth trusted cert '$tls_peer_subject_cn'\n");
# Doing pretty serious stuff here, check if to matches CN.
if (!tls_check_to())
{
xlog("L_NOTICE","[$pr:$fU@$si:$sp]: Processing '$rm' auth TO check failed\n");
sl_send_reply("403","Forbidden auth ID");
exit;
}
}
else {
# TLS validation could not be applied - use challenge response
$var(auth_code) = www_authorize("", "subscriber");
xlog("L_NOTICE","[$pr:$fU@$si:$sp]: Processing '$rm' auth: '$var(auth_code)'\n");
if ( $var(auth_code) == -1 || $var(auth_code) == -2 ) {
xlog("L_NOTICE","Auth error for $fU@$fd from $si cause $var(auth_code)");
}
if ( $var(auth_code) < 0 ) {
www_challenge("", "0");
exit;
}
if (!db_check_to())
{
sl_send_reply("403","Forbidden auth ID");
exit;
}
}
</code></pre>
<hr>
<h4>You can view, comment on, or merge this pull request online at:</h4>
<p> <a href='https://github.com/OpenSIPS/opensips/pull/716'>https://github.com/OpenSIPS/opensips/pull/716</a></p>
<h4>Commit Summary</h4>
<ul>
<li>CN-AUTH: authentication via TLS client certificate CN functions added to tls_mgm module</li>
<li>CN-AUTH: documentation for tls_check_{from,to}</li>
</ul>
<h4>File Changes</h4>
<ul>
<li>
<strong>M</strong>
<a href="https://github.com/OpenSIPS/opensips/pull/716/files#diff-0">modules/tls_mgm/README</a>
(42)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/OpenSIPS/opensips/pull/716/files#diff-1">modules/tls_mgm/doc/tls_mgm_admin.xml</a>
(54)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/OpenSIPS/opensips/pull/716/files#diff-2">modules/tls_mgm/tls_mgm.c</a>
(113)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/OpenSIPS/opensips/pull/716/files#diff-3">modules/tls_mgm/tls_select.c</a>
(49)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/OpenSIPS/opensips/pull/716/files#diff-4">modules/tls_mgm/tls_select.h</a>
(3)
</li>
</ul>
<h4>Patch Links:</h4>
<ul>
<li><a href='https://github.com/OpenSIPS/opensips/pull/716.patch'>https://github.com/OpenSIPS/opensips/pull/716.patch</a></li>
<li><a href='https://github.com/OpenSIPS/opensips/pull/716.diff'>https://github.com/OpenSIPS/opensips/pull/716.diff</a></li>
</ul>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/OpenSIPS/opensips/pull/716">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AFOciYNoUj33WkLsngXzfATEYrOnd-C9ks5pMLhkgaJpZM4Guai8.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://github.com/OpenSIPS/opensips/pull/716"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>