For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Andrea_Arquint's avatar
Andrea_Arquint
Icon for Nimbostratus rankNimbostratus
Aug 13, 2013

How to combine two variables together in APM variable assign

Hi

 

I would like do combine two variables together:

 

Right now I have something like this: session.logon.last.username = expr { [mcget {session.ntlm.last.username}] }

 

And I want to have something like that: session.logon.last.username = expr { [mcget {session.ntlm.last.domain}" \"{session.ntlm.last.username}] }

 

--> session.logon.last.username should contain DOMAIN\USERNAME

 

How is that possible?

 

thanx bb

 

7 Replies

  • Lucas_Thompson_'s avatar
    Lucas_Thompson_
    Historic F5 Account
    Hi, thanks for the question. In Variable Assign (or branch rules), you can include any TCL you want. The TCL command "expr" is used because the results are mostly boolean. For a variable assignment though, they are mostly strings, so the expr command in this context is inappropriate. Better to use "return". This avoids problems where expr's number conversion can mess up text strings. So, to concatenate them, it would be simply: session.logon.last.username = return "[mcget {session.ntlm.last.username}]\\[mcget {session.ntlm.last.domain}]" If you want, you can also put some logic in the right-hand of the assignment, like if sometimes the user already put in USERNAME\DOMAIN: session.logon.last.username = if { [mcget "session.logon.last.username"] contains "\\" } { return [mcget "session.logon.last.username"] else { return "[mcget {session.ntlm.last.username}]\\[mcget {session.ntlm.last.domain}]" }
  • To answer the question about how to combine the two variables, this should work:

     

    session.logon.last.username = expr { [concat "[mcget {session.ntlm.last.domain}]\\[mcget {session.ntlm.last.username}]" ] }

     

  • I tried both methods the "return" and the "expr" one and both seems to work fine for me if I check the session variables in the APM report. But when using a RDP with auto logon enabled, it just puts the username into the RDP logon mask. Interesting thing is, if I just use a single "\" in the expression the result in the session variable is:

     

    DOMAIN[mcget {session.logon.last.username}]

     

    but it will be exactly filled in that way in the RDP logon mask.

     

    Any idea what I'm doing wrong or what I can further try?

     

    Thank you!

     

    Ciao Stefan :)

     

  • Mcget is used in branch conditions. If you need variable expansion, like in a configuration object, try using the ${ } syntax instead:

    DOMAIN\\${session.logon.last.username}
    
  • Hi Kevin,

     

    this seems to be not working at all. It's neither correctly displayed in the session variables (APM report) nor correctly filled in the RDP logon mask (just the username). I tried these different options:

     

    session.logon.last.username = f5-lab.local\\${session.logon.last.username}

     

    session.logon.last.username = return "f5-lab.local\\[mcget {session.logon.last.username}]"

     

    session.logon.last.username = expr { [concat "f5-lab.local\\[mcget {session.logon.last.username}]" ] }

     

    Ciao Stefan :)

     

  • Ahh, back in my lab and now see what you're trying to do. Your last attempt was actually pretty close. In your variable assignment, try this:

    session.logon.last.username = expr { "f5-lab.local\\[mcget {session.logon.last.username}]" }
    
  • Hi Kevin,

     

    yes this syntax is correct and it will correctly be shown in the session variable (APM report). But it's still not parsed to the WinXP RDP logon mask, there just the real username is shown. I also tried several other syntax, which also worked correctly from the session variable point of view, but for NONE of them the combined variable will be parsed to the RDP logon mask. For your reference I'm using the following order in VPE:

     

    Logon Page -> LDAP Auth -> Variable Assign -> Resource Assign -> Webtop and Links Assign

     

    Any further idea? Thank you!

     

    Ciao Stefan :)