Forum Discussion
TIm_Maestas
Nimbostratus
Apr 06, 2005SSL cert verify TCL error?
I have the following iRule:
when CLIENTSSL_HANDSHAKE {
set cert [SSL::cert 0 ]
}
when HTTP_REQUEST {
set stuff [X509::subject $cert ]
if { [matchclass $stuff contains $::merlin] } {
use pool test-sun }
else { reject }
}
The merlin class contains things like CN=validhost.company.com. When a host comes in presenting a client certificate with a valid CN everything works fine. When a host comes in without a matching CN in the merlin class, they get a page cannot be displayed error in IE, which is also fine. However, when a client comes in by typing the IP in their browser, which results in a pop-up window because the IP doesn't match the common name of the certificate, I get the following error logged to /var/log/ltm:
tmm tmm[5569]: 01220001:3: TCL error: Rule test - while executing "X509::subject $cert "
While this isn't necessarily a bad thing (because they should be coming in via the correct URL and not get any pop-up errors) it makes me think I've writte my rule incorrectly or should have done this differently. Is there a better way to do what I'm doing?
- unRuleY_95363Historic F5 AccountYou may want to try adding this:
when HTTP_REQUEST { if { [info exists cert] } { ... your existing rule stuff... } else { log "No Cert presented" reject } }
- TIm_Maestas
Nimbostratus
That didn't seem to work. My rule now looks like - bl0ndie_127134Historic F5 AccountHow about something like this ...
when HTTP_REQUEST { if {[SSL::cert count] == 0} { reject } else { set subject [X509::subject [SSL::cert 0 ]] if { [matchclass $subject contains $::merlin] } { use pool test-sun } } }
I am still a little baffled as to why "info exists" failed. I will do some testing tomorrow to try and find out why.when CLIENTSSL_HANDSHAKE { if {[SSL::cert count] > 0} { set cert [SSL::cert 0 ] } }
- TIm_Maestas
Nimbostratus
Ok so I realized my plan was flawed in that, as was pointed out to me above, a client will not present a cert on each and every http request. So, I began going down the road of tracking whether we have validated a cert using the session table. However, I seem to be doing something wrong just adding the session entry. The rule:when CLIENTSSL_CLIENTCERT { set id [SSL::sessionid] session add ssl $id [X509::verify_cert_error_string [SSL::verify_result]] 180 } when HTTP_REQUEST { if {[SSL::cert count] == 0} { reject } else { set subject [X509::subject [SSL::cert 0 ]] if { [matchclass $subject contains $::merlin] } { use pool test-sun } } }
- efftee_26336Historic F5 AccountHi there,
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