Forum Discussion
Justin_18188
Nimbostratus
Sep 18, 2008iRule variable problems
I have an iRule that captures the SSL client DN and places it in a variable to be passed to an application. 98% of the time, there is no problem. But 2% of the time, user's CN get crossed. One person ...
Justin_18188
Nimbostratus
Sep 18, 2008when CLIENTSSL_CLIENTCERT {
set ssl_cert [SSL::cert 0]
set id [SSL::sessionid]
session add ssl $id $ssl_cert 900
}
when HTTP_RESPONSE {
if { [info exists certStr] } {
HTTP::header insert "Set-Cookie: ClientZ=$certStr; Path=/"
}
if { [info exists ssl_dn] } {
HTTP::header insert "Set-Cookie: SSL_CLIENT_DN=$ssl_dn; Path=/"
}
}
when HTTP_REQUEST {
set my_uri [string tolower [HTTP::uri]]
if {( $my_uri starts_with "/console") || ($my_uri starts_with "/soafportalwebproject")} {
if {! [HTTP::cookie exists ClientZ] } {
set id [SSL::sessionid]
set cert [session lookup ssl $id]
if { $cert ne "" } {
set certStr [X509::whole $cert]
set ssl_dn [X509::subject $cert]
remove unwanted formatting.
regsub -all "\n" $certStr "" certStr
set certStr [string trimleft $certStr "-----BEGIN CERTIFICATE-----"]
set certStr [string trimright $certStr "-----END CERTIFICATE-----"]
if certStr is blank...
if { $certStr equals "" } {
log local0. "no certStr... Deleting Session 11"
session delete ssl $id
}
}
} else {
set certStr [HTTP::cookie ClientZ]
}
if { [info exists certStr] } {
if { $certStr ne "" } {
HTTP::header insert WL-Proxy-Client-Cert $certStr
HTTP::header insert WL-Proxy-Client-Keysize 128
HTTP::header insert WL-Proxy-Client-Secretkeysize 128
}
}
if { [info exists ssl_dn] } {
if { $ssl_dn ne "" } {
HTTP::header insert SSL_CLIENT_DN $ssl_dn
}
}
HTTP::header insert WL-Proxy-SSL true
HTTP::header insert WL-Proxy-Client-IP [IP::client_addr]
}
}
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