Forum Discussion
Scot_86001
Nimbostratus
Feb 21, 2010iRule Optimization w/ Certificates?
The iRule below functions and performs as it should. I have been told that what I have below may not be efficient or optimized. I am looking to see if anyone can make some suggestions on how to better optimize. I would also like to know if session persistence and timeout are being maintained as they should. This iRule performs client side cert authentication only when a certain URI is sent. Upon successfull login, header information from the cert is passed to the receiving application. The code below was pieced together from other iRules on DevCentral.
when CLIENTSSL_CLIENTCERT {
set cert [SSL::cert 0]
HTTP::release
if { [SSL::cert count] < 1 } {
reject
}
}
when HTTP_REQUEST {
set v1 [URI::query [HTTP::uri] "p"]
if { ($v1 contains "ESAT") || ($v1 contains "311") } then {
if { [SSL::cert count] <= 0 } {
HTTP::collect
SSL::session invalidate
SSL::authenticate always
SSL::authenticate depth 9
SSL::cert mode request
SSL::renegotiate
}
}
}
when HTTP_REQUEST_SEND {
clientside {
if { [SSL::cert count] > 0 } {
HTTP::header insert "X-SSL-Session-ID"[SSL::sessionid]
HTTP::header insert "X-SSL-Client-Cert-Status"[X509::verify_cert_error_string [SSL::verify_result]]
HTTP::header insert "SSL_CLIENT_S_DN"[X509::subject [SSL::cert 0]]
HTTP::header insert "SSL_CLIENT_I_DN"[X509::issuer [SSL::cert 0]]
}
}
}
21 Replies
- hoolio
Cirrostratus
I'm not an F5 employee. I work for an F5 partner in the UK. I'm booked fairly solid for the next five weeks. You could contact F5 sales in the US to get more immediate official help. Else, if you get stuck, email me: hooleylists at gmail dot com and I'll send you some free pointers a bit faster than replying to posts here. Once we figure out a solution, we can summarize it here.
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects