bypassing client authentication

i’ve got a virtual server listening on 443 which uses both a certificate for SSL and also requires client authentication. this works fine

i’ve now been informed of another set of users who want to access the same site but don’t want to have to authenticate (although they still want their sessions to be encrypted using SSL)

is there a way of making use of the same virtual server with an irule which determines from the uri whether or not they need to authenticate?

thanks

Hi Skuba,

I’m working on an iRule which does this and a bit more. Maybe when I finish testing it I can post it to the Codeshare.

In the meantime, if you want to selectively request or require a client cert, you’ll need to set the SSL profile client cert option to none and then use an iRule to check the requested URI and renegotiate the SSL handshake using SSL::renegotiate for specific URIs. The SSL::renegotiate wiki page has a very simplified example (Click here).

Aaron

hi

thanks for your reply. i’ve just been looking at the example, and i think we need something similar but even more simplistic. such as…

when HTTP_REQUEST {

if {[HTTP::uri] starts_with “/abc/” } {

***something to route traffic straight to pool members bypassing client authentication***

}

else {}

***client is forced to authenticate***

}

any tips/advice would be appreciated

thanks

That’s pretty much what the wiki page example does. Just reverse the logic for the check of the URI.

Aaron

would something like this do the trick? the clients would eventually go on to the same back end pool, don’t know if i could just reference it once at the bottom?

cheers

when CLIENTSSL_HANDSHAKE {

if { [SSL::cert count] > 0 } {

HTTP::release

}

pool serverpool

}

when HTTP_REQUEST {

if {[SSL::cert count] == 0} {

HTTP::collect

SSL::authenticate always

SSL::authenticate depth 9

SSL::cert mode require

SSL::renegotiate

}

pool serverpool

}

I think you could start with something like this:

when CLIENTSSL_HANDSHAKE { 
   if { [SSL::cert count] > 0 } { 
     HTTP::release 
   } 
 } 
  
 when HTTP_REQUEST { 
   if {not ([HTTP::uri] starts_with "/abc/") } { 
     if {[SSL::cert count] == 0} { 
       HTTP::collect 
       SSL::authenticate always 
       SSL::authenticate depth 9 
       SSL::cert mode require 
       SSL::renegotiate 
     } 
   } 
 }

Aaron

hi aaron

why do you have to specify the SSL:: options? won’t these be picked up in the actual client ssl profile that already exists? if not, why don’t you need to specify the actual CA and CRL in the irule?

thanks for all your help

The clientssl profile you add to the virtual server should have client cert set to ignore and then the iRule dynamically requests (or requires) a client cert for specific URIs using the SSL:: commands.

If you set the cert mode to require, a client who doesn’t send a cert when it’s prompted will receive a TCP reset. If you want to handle this more gracefully, you could set the profile to request and then have the app send a response if no cert is present.

You’ll probably want to insert the client cert in the session table and include some details about the cert in the HTTP headers in requests to the pool. This way the pool member can validate the cert before allowing the request. This could also be done in the iRule using the clientssl profile’s Trusted CA cert field and the SSL::verify command.

Aaron

it was the irule vs. client profile that was confusing me, but that makes sense now

thanks a lot aaron!

aaron

one last question…

can you explain what this part actually does?..

when CLIENTSSL_HANDSHAKE {

if { [SSL::cert count] > 0 } {

HTTP::release

}

}

i guess it’s saying, if the client offers a certificate then release the data. but according to the wiki, the CLIENTSSL_HANDSHAKE is triggered when a client-side SSL handshake has actually been completed

in addition, i don’t know why this is required and what effect it has on the second part of the irule?

thank you

CLIENTSSL_HANDSHAKE is triggered when the clientside SSL handshake is completed. SSL::cert count returns the number of client certs in the request. If there is one or more certs, then the HTTP held from when HTTP::collect was called is released and the request continues.

Aaron

Hi Aaron

I’ve tested the iRule today and it seems to work great. Is there any way that I can log unsuccessful client authentication attempts?

Thanks

Hi Skuba,

You could add logic in CLIENTSSL_HANDSHAKE to check for clients making a request with no cert after the renegotiation. You could also validate the client cert against either the SSL cert in the client SSL profile or using a trusted CA cert. You can use the SSL::verify_result (Click here). You’d probably also want to check the AUTH::status value in AUTH_RESULT to see whether the OCSP validation was completed successfully.

Note there is an issue where you can’t differentiate between no response and a revoked status from the OCSP responder using AUTH::status. F5 is tracking this in CR126501. A workaround is to create a pool containing the OCSP server IP address(es) and then use a monitor to check the status of the pool. You can then use [active_members $ocsp_pool] in your iRule to detect whether the OCSP servers are down.

Aaron

Hi Scuba,

I am having difficulties join LTM to domain for my vip. following LTM guild for kerberos and trying to join. getting this error everytime I tried:

Run msktutil $s = system(“KRB5CCNAME=$cc msktutil $verboseflag --server $kdcname --computer-name $shortname --hostname $hostcmd --delegation -c --upn HOST/$hostcmd”); die “Couldn’t join domain($s).” unless $s == 0; Add the HTTP service principal. $s = system(“KRB5CCNAME=$cc msktutil $verboseflag --server $kdcname --computer-name $shortname --hostname $hostname --service HTTP”); unlink $cc;

I have created a new virtual servers, on vip, it shows dns name. I’m using following command from putty. [root@OA-PP-LB2:Standby] config domaintool --debug --join --admin_principal admin --host

DC can do forward and reverse lookup on DNS. Any assistance in this situation will be appreciated. What settings you have in your working v.ip.

thx.