Forum Discussion
eric_haupt1
Nimbostratus
Sep 06, 2017Client Certificate - Regex to parse numbers from cert subject
I've been using an irule from Devcentral for quite some time to parse the othername:UPN x509 field from our client certificates for APM use. However, our clients are provided two certs and one of th...
Simon_Blakely
Employee
Sep 07, 2017And as a further addendum, regexp does not return a string, it takes a variable name to set to the match:
when ACCESS_POLICY_AGENT_EVENT {
switch [ACCESS::policy agent_id] {
"CACPROCESSING" {
if { [ACCESS::session data get session.ssl.cert.x509extension] contains "othername:UPN<" } {
set tempupn [findstr [ACCESS::session data get session.ssl.cert.x509extension] "othername:UPN<" 14 ">"]
ACCESS::session data set session.custom.certupn $tempupn }
else { if { [regexp {([0-9]{16}|[0-9]{10})} [ACCESS::session data get session.ssl.cert.subject] temppiv ] == 1 } {
set tempupn "$temppiv@company"
ACCESS::session data set session.custom.certupn $tempupn }
}
}
}
}
Add some logging and do some testing. I hope this helps.
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
