Forum Discussion
Authenticate customer using SSL client certificate or LDAP
1.check incoming request for ssl client certificate
2.if certificate is present: validate user against trusted certificates and ocsp
3.add client cert information to http headers if ssl client authentication is successful or move to LDAP authentication if not successful
4.if no certificate is present or certificate is invalid: use LDAP username and password
5.add LDAP username and password (other client information that can be pulled from LDAP) into http headers
6.send client to a redirect page if both ssl and LDAP authentication fail
Thank you very much,
Rob
14 Replies
- Robert_Decker_2
Nimbostratus
Is it possible to call/use existing IRules within an IRule? I have a client ssl certificate IRule from previous post and the default IRule for LDAP, which both work great. I would like to try the following: - Colin_Walker_12Historic F5 AccountThere is currently no way to nest rules, or to call one rule from another.
- Not sure if this is what Colin was getting at or not, but you could assign multiple rules to a vip and pass variables between them. This way you can "simulate" calling multiple iRules using conditions.
**** rule check_for_client_cert **** when CLIENTSSL_CLIENTCERT { set has_client_cert 1 } **** rule client_cert_rule **** when HTTP_REQUEST { if { [info exists has_client_cert] } { code goes here } } **** rule ldap_rule **** when HTTP_REQUEST { if { ! [info exists has_client_cert] } { code goes here. } }
- Robert_Decker_2
Nimbostratus
Thank you for the help Joe and Colin. I really appreciate your patience. I have tried to combine rules using Joe's suggestion. I tried to combine the existing sys_auth_ldap rule with an ssl client cert rule from previous posts. Below is my Irule: - Robert_Decker_2
Nimbostratus
Thank you for the help Joe. Do you know what I am doing wrong as far as the SSL function is concerned? Every time I use the rule it goes right to LDAP. I have put a logging statement on each piece to track the usage and I don't see a message for the section under "info exists has_client_cert". - Did you put a log statement inside the CLIENTSSL_CLIENTCERT event where you were setting the has_client_cert variable to make sure that the variable is getting set. If the info exists command returns 0 then that means the variable is undefined.
- Robert_Decker_2
Nimbostratus
Thank you both for your help! I think I am slowly starting to understand the global variable thing. It seems like any certificate will pass the ssl portion, even if it is not supposed to. Other than that, it seems to be doing what I would like it to at this point. First, I am prompted for ssl certificate. I can then cancel out and use LDAP. Could you guys point out what I am doing wrong with regards to the SSL certificate? In addition, how would I redirect a failed LDAP connection to a custom web page? Currently, IE displays a blank page when I fail the LDAP connection. - Robert_Decker_2
Nimbostratus
Possible problem-- I need to set the client profile to "request cert" in order for the LDAP to work. It seems like any cert will work with this setting. Could it be possible that the user provides an invalid certificate and is still able to get the page because the "request" setting is used? - unRuleY_95363Historic F5 AccountYou could add some extra logic to your rule that verifies the cert is from a legitamate issuer or other criteria.
- Robert_Decker_2
Nimbostratus
Thank you for all the help! I've made some changes and they seem to be working. The Irule will begin by prompting for a client cert. It will complete the request if the cert is valid or redirect to another website if not. You can cancel out of the client cert portion and be prompted for a username and password. The connection will complete if you have valid credentials or redirect to yet another website if you fail. Could someone look this over to see if I am making any rookie mistakes(I am a programming newbie). Thank you in advance.
Recent Discussions
Related Content
* 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