Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TLS: Client authentication with client certificate CN #709

Closed
wants to merge 4 commits into from

Conversation

ph4r05
Copy link
Contributor

@ph4r05 ph4r05 commented Nov 26, 2015

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.

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).

Example configuration for TLS client authentication:

# 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;
    }
}

@ph4r05 ph4r05 changed the title Client authentication with TLS client cert CN Client authentication with TLS client certificate CN Dec 1, 2015
@ph4r05 ph4r05 changed the title Client authentication with TLS client certificate CN TLS: Client authentication with client certificate CN Dec 1, 2015
@ph4r05
Copy link
Contributor Author

ph4r05 commented Dec 3, 2015

as new features are not accepted to 1.11 branch, should I do the same changes also on 2.x branch? Will it be accepted then?

@bogdan-iancu
Copy link
Member

Please migrate your PR to master (2.2) in order to be accepted. The feature looks great and I will love to have it committed, but we can do this only in 2.2/master branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants