F5 is upgrading its customer support chat feature on My.F5.com. Chat support will be unavailable from 6am-10am PST on 1/20/26. Refer to K000159584 for details.

Forum Discussion

a_evissa_195792's avatar
a_evissa_195792
Icon for Nimbostratus rankNimbostratus
Apr 05, 2015

Extracting email from APM client ert

Hi

 

Im trying to extract an email address from a client cert from the subject using the below regex that should work but some reason nothing is returned.

 

Does anyone have and ideas ?

 

regexp {a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,4}} [mcget {session.ssl.cert.subject}]

 

6 Replies

  • kunjan's avatar
    kunjan
    Icon for Nimbostratus rankNimbostratus

    To use regexp, may try the following in the variable assignment

    regexp {([a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,4})} [ mcget {session.ssl.cert.subject}] matched a; return $a

  • Hi,

     

    Im trying to extract the email address from cert in VPE, what does the matched a; return $a do as that seems to work, thanks

     

    regexp {([a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,4})} [ mcget {session.ssl.cert.subject}] matched a; return $a

     

  • kunjan's avatar
    kunjan
    Icon for Nimbostratus rankNimbostratus

    Basically it saves the first matched regex to variable 'a'. Then variable 'a' value, $a, is 'return'ed to the session variable assigned.

     

  • does anyone know what this will do?

     

    session.ssl.cert.user

     

    set f1 [mcget {session.ssl.cert.subject} ] set f2 [split $f1 "=" ] set f3 [lindex $f2 1] set f4 [split $f3 ","] set f5 [lindex $f4 0]

     

  • I have following value in subject with the client cert

     

    Subject name OU = MULTI-ALLOWED OU = VPN-WEB CN = TEST@NGOPER

     

    I have configured the following variables with APM

     

    custom variable

     

    session.ssl.cert.user

     

    custom expression

     

    set f1 [mcget {session.ssl.cert.subject} ] set f2 [split $f1 "=" ] set f3 [lindex $f2 1] set f4 [split $f3 ","] set f5 [lindex $f4 0]

     

    I get following error

     

    The error we’re getting is: “LDAP module: query with 'cn=MULTI-ALLOWED' failed: No such object, no matching users found”

     

    Is there something wrong with my custom expression?