Forum Discussion

11 Replies

  • More specifically I want to check the CN and Certificate Template Information field.
  • Something like this could do the trick. You may have to tweak to your needs. You will also need to set your client auth in your client SSL profile to request.

    https://devcentral.f5.com/wiki/iRules.X509__subject.ashx

    https://devcentral.f5.com/wiki/iRules.SSL__cert.ashx

    when HTTP_REQUEST {
        if {[SSL::cert count] > 0}{
            set cert_subject [X509::subject [SSL::cert 0]]
            if {$cert_subject equals "CN..."}{
                return
            }
            else {
                if cert doesn't contain required subject, redirect
                HTTP::respond 302 noserver Location "https://someurl"
            }
        }
        else {
            if no cert presented, redirect
            HTTP::respond 302 noserver Location "https://someurl"
        }
    }
    
    • Soap_111722's avatar
      Soap_111722
      Icon for Nimbostratus rankNimbostratus
      Thanks for the reply Brad, I'm looking for a more granular approach if possible as we do have some certs that will be on client machine with the same CN. Is it possible to query the Certificate Template Name field as well as the CN?
  • Something like this could do the trick. You may have to tweak to your needs. You will also need to set your client auth in your client SSL profile to request.

    https://devcentral.f5.com/wiki/iRules.X509__subject.ashx

    https://devcentral.f5.com/wiki/iRules.SSL__cert.ashx

    when HTTP_REQUEST {
        if {[SSL::cert count] > 0}{
            set cert_subject [X509::subject [SSL::cert 0]]
            if {$cert_subject equals "CN..."}{
                return
            }
            else {
                if cert doesn't contain required subject, redirect
                HTTP::respond 302 noserver Location "https://someurl"
            }
        }
        else {
            if no cert presented, redirect
            HTTP::respond 302 noserver Location "https://someurl"
        }
    }
    
    • Soap_111722's avatar
      Soap_111722
      Icon for Nimbostratus rankNimbostratus
      Thanks for the reply Brad, I'm looking for a more granular approach if possible as we do have some certs that will be on client machine with the same CN. Is it possible to query the Certificate Template Name field as well as the CN?