APM Cookbook: Multiple Domain Authentication - Part 1
From time to time I receive requests on how to make APM authenticate against multiple domains. These organizations require unique domains for various user roles such as contractor versus employee or student versus faculty. There are several ways to achieve this depending upon the required user interaction - manual versus automated.
In this series we will work through a few ways APM can help your achieve this requirement:
- Domain drop down menu on the logon page
- Home realm discovery / where are you from
- Domain lookup
- End-point inspection (certificate / registry settings)
Domain Drop Down Menu
For part 1 we’ll take a look at placing a domain drop down list on the APM logon page. This topic has previously been covered by Jason Rahm on DevCentral but required advanced APM knowledge and heavy modifications of underlying code. In BIG-IP TMOS version 11.5 additional login page input types were added: select and checkbox.
With the addition of these new input types F5 has significantly reduced the complexity of implementing this solution.
In this example I assume you already have an APM Access Policy created and we will modify it to add the domain drop down feature.
Logon Page Modification
- Open the APM Visual Policy Editor for your access policy
- Make the following modifications:
Type select Post Variable Name domain Session Variable Name domain Values In the pop-up window add values for Contractor and Employee (see image below) Logon Page Input Field #3 Domain - Click Save
Domain Decision Box
Now that we’ve customized the Logon Page we need to add logic to our Visual Policy Editor to choose the correct domain based upon which domain was selected.
- Add an empty action to the VPE after the Logon Page
- Name the empty action Check Domain
- Click the Branch Rules tab
- Click the Add Branch Rule button
- Name the new rule Contractor
- Click the change link next to Expression: Empty
- Click the Advanced tab
- Enter the following TCL expression:
expr { [mcget {session.logon.last.domain} ] eq “Contractor” }
- Click Finished
- Click Save
Final VPE Configuration
With the logon Page customized and the Check Domain decision box complete now you can add multiple AD Authentication (or any other authentication types) to your Visual Policy Editor. The image blow provides an example of a completed VPE.
End Results
The final result will provide a Domain drop down box on the APM logon page allowing users to select which domain they belong to. Pretty easy!
In the next post we’ll add additional logic to select the correct domain without requiring the drop down box
- Alton_104690NimbostratusI want to add that there is correct for TCL syntax. For most Domain they use ALL capital in the NETBIOS name. Therefore the expr { [mcget {session.last.domain}] eq "Contractor"} will not work instead ignore case but making it not case sensitive. with this syntax: expr { [string tolower [mcget {session.logon.last.domain}]] eq "contractor"}
- whswhswhs124_98Nimbostratus'
- Luis_C__WiedemaNimbostratusThis is a great article but is there anywhere I can reference for doing this in 11.4? :)
- Nelgin_NepoleanNimbostratusthe expr { [mcget {session.last.domain}] eq "Contractor"} didn't work. So I used expr { [string tolower [mcget {session.logon.last.domain}]] contains "contractor"}, then it is starts working. Thanks for your document. it is helpfull
- kenny_50210Nimbostratusthis worked for me as well. thanks! expr { [string tolower [mcget {session.logon.last.domain}]] contains "contractor"}
- xmatt_99538NimbostratusI've had a pretty good search but can't find "part 2" of this - or any other parts actually. I'm interested in the following: Home realm discovery / where are you from Domain lookup End-point inspection (certificate / registry settings). Thanks.
- AP_129594NimbostratusExcellent article. I run into an issue when a user select the wrong domain the first time after submit login, the user will receive an error when select the correct domain the second time. I will investigated more tomorrow morning but have anybody run into this issue?
- woytazAltostratus@AP It works like you wrote because by default in AD Auth "Max Logon Attempts Allowed" is set to 3. Change it to 1 and after choosing wrong domain session will be removed from APM and you will receive Error with link to New session. I couldn't find better solution.
- rob_carrCirrocumulus
I'd really love to see the second article in this sequence.
- col_h_175104Nimbostratus
You can find the 2nd part here - https://f5guru.com/2014/11/17/apm-cookbook-multiple-domain-authentication-part-2/ I'm still having issues with this setup, syntax appears to be OK but sessions fail and report shows this logic just skips past the two domains I have setup to failback and deny.