Forum Discussion
Mathew_Loesch
Nimbostratus
Feb 01, 2017Client certificate check. Redirect if none, continue if presented.
I need an iRule that checks for the existence of a Client SSL certificate. If no cert, redirect to request page. If present, continue to default pool. However, my example below always points me to...
Kai_Wilke
MVP
Feb 06, 2017the problem of your original, next attempt and most recent code is that the $clientCRT variable is not getting initialized, if the user doesn't provide a certificate.
A fix for your problem would be to initialize the $clientCRT variable with value of 0 during CLIENT_ACCEPTED event and overwrite its value to 1 during CLIENTSSL_CLIENTCERT in the case that the client provides a certificate. In this case you will make sure that the HTTP_REQUEST event can savely query the current value of $clientCRT without raising a TCL exeption...
when CLIENT_ACCEPTED {
set clientCRT 0
}
when CLIENTSSL_CLIENTCERT {
if { [SSL::cert 0] ne "" } then {
set clientCRT 1
}
}
when HTTP_REQUEST {
if { $clientCRT } then {
pool PoolName
} else {
HTTP::redirect "URL"
}
}
Cheers, Kai
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