Welcome to the Identity & Access Management lab series at Agility 2017.
The following labs and exercises will instruct you on how to configure and troubleshoot federation use cases based on the experience of field engineers, support engineers and clients. This guide is intended to complement lecture material provided during the course as well as a reference guide that can be referred to after the class as a basis for configuring federation relationships in your own environment.
The content contained here leverages a full DevOps CI/CD pipeline and is sourced from the GitHub repository at https://github.com/f5devcentral/f5-agility-labs-iam. Bugs and Requests for enhancements can be made using by opening an Issue within the repository.
In the interest of focusing as much time as possible configuring and performing lab tasks, we have provided some resources and basic setup ahead of time. These are:
If you wish to replicate these labs in your environment you will need to perform these steps accordingly. Additional lab resources are provided as illustrated in the diagram below:
The time it takes to perform each lab varies and is mostly dependent on accurately completing steps. This can never be accurately predicted but we strived to provide an estimate based on several people, each having a different level of experience. Below is an estimate of how long it will take for each lab:
Lab Description | Time Allocated |
---|---|
LAB I (SAML Service Provider (SP)) | 25 minutes |
LAB II (SAML Identity Provider (IDP)) | 25 minutes |
LAB III (Kerberos to SAML) | 25 minutes |
LAB IV (SAAS Federation IAPP) | 25 minutes |
The following credentials will be utilized throughout this Lab guide.
Credential Use | User ID | Password |
---|---|---|
BIG-IP Configuration Utility (GUI) | admin | admin |
BIG-IP CLI Access (SSH) | root | default |
Jump Host Access | f5demo\user | Agility1 |
All User authentication for Labs/Tasks | user | Agility1 |
The preferred browsers for this lab are Firefox and Internet Explorer. Shortcut links have been provided to speed access to targeted resources and assist you in your tasks. Except where noted, either browser can be used for all lab tasks.
As noted previously, environment staging has been done to speed up lab time, reducing repetitive tasks to focus on key learning elements. Where possible steps that have been optimized have been called out with links and references provided in the Additional Information section for additional clarification. The intention being that the lab guide truly serves as a resource guide for all your future federation deployments.
The purpose of this lab is to configure and test a SAML Service Provider. Students will configure the various aspects of a SAML Service Provider, import and bind to a SAML Identity Provider and test SP‑Initiated SAML Federation.
Objective:
Lab Requirements:
Estimated completion time: 25 minutes
Begin by selecting: Access -> Federation -> SAML Service Provider -> Local SP Services
Click the Create button (far right)
In the Create New SAML SP Service dialog box click General Settings in the left navigation pane and key in the following as shown:
Name: | app.f5demo.com |
Entity ID: | https://app.f5demo.com |
Click OK on the dialogue box
Note
The yellow box on Host will disappear when the Entity ID is entered.
Click on Access ‑> Federation ‑> SAML Service Provider ‑> External IdP Connectors or click on the SAML Service Provider tab in the horizontal navigation menu and select External IdP Connectors
Click specifically on the Down Arrow next to the Create button (far right)
Select From Metadata from the drop down menu
In the Create New SAML IdP Connector dialogue box, click Browse and select the idp.partner.com‑app_metadata.xml file from the Desktop of your jump host.
In the Identity Provider Name field enter idp.partner.com:
Click OK on the dialog box
Note
The idp.partner.com-app_metadata.xml was created previously. Oftentimes, IdP providers will have a metadata file representing their IdP service. This can be imported to save object creation time as it has been done in this lab
Click on the Local SP Services from the SAML Service Providers tab in the horizontal navigation menu
Click the checkbox next to the previously created app.f5demo.com and click Bind/Unbind IdP Connectors at the bottom of the GUI
Add New Row button
In the added row, click the Down Arrow under SAML IdP Connectors and select the /Common/idp.partner/com SAML IdP Connector previously created
Click the Update button and the OK button at the bottom of the dialog box
Under the Access ‑> Federation ‑> SAML Service Provider ‑> Local SP Services menu you should now see the following (as shown):
Name: | app.f5demo.com |
SAML IdP Connectors: | idp.partner.com |
Begin by selecting Access ‑> Profiles/Policies ‑> Access Profiles (Per‑Session Policies)
Click the Create button (far right)
In the New Profile window, key in the following:
Name: | app.f5demo.com‑policy |
Profile Type: | All (from drop down) |
Profile Scope: | Profile (default) |
Scroll to the bottom of the New Profile window to the Language Settings
Select English from the Factory Built‑in Languages on the right, and click the Double Arrow (<<), then click the Finished button.
From the Access ‑> Profiles/Policies ‑> Access Profiles
(Per‑Session Policies) screen, click the Edit link on the previously
created app.f5demo.com‑policy
line
In the Visual Policy Editor window for /Common/app.f5demo.com‑policy
,
click the Plus (+) Sign between Start and Deny
In the pop‑up dialog box, select the Authentication tab and then click the Radio Button next to SAML Auth
Once selected, click the Add Item button
In the SAML Auth configuration window, select /Common/app.f5demo.com
from the AAA Server drop down menu
Click the Save button at the bottom of the window
In the Visual Policy Editor window for /Common/app.f5demo.com‑policy
,
click the Plus (+) Sign on the Successful branch following
SAML Auth
In the pop-up dialog box, select the Assignment tab, and then click the Radio Button next to Variable Assign
Once selected, click the Add Item buton
In the Variable Assign configuration window, click the Add New Entry button
Under the new Assignment row, click the Change link
In the pop‑up window, configure the following:
Left Pane | |
---|---|
Variable Type: | Custom Variable |
Security: | Unsecure |
Value: | session.logon.last.username |
Right Pane | |
---|---|
Variable Type: | Session Variable |
Session Variable: | session.saml.last.attr.name.emailaddress |
Click the Finished button at the bottom of the configuration window
Click the Save button at the bottom of the Variable Assign dialog window
In the Visual Policy Editor select the Deny ending along the fallback branch following the Variable Assign
From the Select Ending dialog box, select the Allow button and then click Save
In the Visual Policy Editor click Apply Access Policy (top left) and close the Visual Policy Editor
Begin by selecting Local Traffic -> Virtual Servers
Click the Create button (far right)
In the New Virtual Server window, key in the following as shown:
General Properties | |
---|---|
Name: | app.f5demo.com |
Destination Address/Mask: | 10.1.10.100 |
Service Port: | 443 |
Configuration | |
---|---|
HTTP Profile: | http (drop down) |
SSL Profile (Client) | app.f5demo.com‑clientssl |
Access Policy | |
---|---|
Access Profile: | app.f5demo.com‑policy |
Resources | |
---|---|
iRules: | application‑irule |
Scroll to the bottom of the configuration window and click Finished
Note
The iRule is being added in order to simulate an application server to validate successful access.
Using your browser from the jump host, navigate to the SAML SP you just
configured at https://app.f5demo.com
(or click the provided bookmark)
Did you successfuly redirect to the IdP?
Log in to the IdP. Were you successfully authenticated?
Note
Use the credentials provided in the Authentication section at the beginning of this guide (user/Agility1)
After successful authentication, were you returned to the SAML SP?
Were you successfully authenticated to the app in the SAML SP?
Review your Active Sessions (Access ‑> Overview ‑> Active Sessions)
Review your Access Report Logs (Access ‑> Overview ‑> Access Reports)
The purpose of this lab is to configure and test a SAML Identity Provider. Students will configure the various aspect of a SAML Identity Provider, import and bind to a SAML Service Provider and test IdP-Initiated SAML Federation.
Objective:
Lab Requirements:
Estimated completion time: 25 minutes
Begin by selecting: Access ‑> Federation ‑> SAML Identity Provider ‑> Local IdP Services
Click the Create button (far right)
In the Create New SAML IdP Service dialog box, click General Settngs in the left navigation pane and key in the following:
IdP Service Name: | idp.f5demo.com‑app |
IdP Entity ID: | https://idp.f5demo.com/app |
Note
The yellow box on “Host” will disappear when the Entity ID is entered
In the Create New SAML IdP Service dialog box, click Assertion Settings in the left navigation pane and key in the following:
Assertion Subject Type: | Persistent Identifier (drop down) |
Assertion Subject Value: | %{session.logon.last.username} (drop down) |
In the Create New SAML IdP Service dialog box, click SAML Attributes in the left navigation pane and click the Add button as shown
In the Name field in the resulting pop-up window, enter the
following: emailaddress
Under Attribute Values, click the Add button
In the Values line, enter the following: %{session.ad.last.attr.mail}
Click the Update button
Click the OK button
In the Create New SAML IdP Service dialog box, click Security Settings in the left navigation pane and key in the following:
Signing Key: | /Common/SAML.key (drop down) |
|
Signing Certificate: | /Common/SAML.crt (drop down) |
Note
The certificate and key were previously imported
Click OK to complete the creation of the IdP service
Click on External SP Connectors (under the SAML Identity Provider tab) in the horizontal navigation menu
Click specifically on the Down Arrow next to the Create button (far right)
Select From Metadata from the drop down menu
In the Create New SAML Service Provider dialogue box, click Browse and select the app.partner.com_metadata.xml file from the Desktop of your jump host
In the Service Provider Name field, enter the following:
app.partner.com
Click OK on the dialog box
Note
The app.partner.com_metadata.xml file was created previously. Oftentimes SP providers will have a metadata file representing their SP service. This can be imported to save object creation time as has been done in this lab.
Click on Local IdP Services (under the SAML Identity Provider tab) in the horizontal navigation menu
Select the Checkbox next to the previously created idp.f5demo.com
and click the Bind/Unbind SP Connectors button at the bottom of the GUI
In the Edit SAML SP’s that use this IdP dialog, select the
/Common/app.partner.com
SAML SP Connection Name created previously
Click the OK button at the bottom of the dialog box
Under the Access ‑> Federation ‑> SAML Identity Provider ‑> Local IdP Services menu you should now see the following (as shown):
Name: | idp.f5demo.com-app |
SAML SP Connectors: | app.partner.com |
Begin by selecting Access ‑> Federation ‑> SAML Resources
Click the Create button (far right)
In the New SAML Resource window, enter the following values:
Name: | partner‑app |
SSO Configuration: | idp.f5demo.com‑app |
Caption: | Partner App |
Click Finished at the bottom of the configuration window
Select Access ‑> Webtops ‑> Webtop List
Click the Create button (far right)
In the resulting window, enter the following values:
Name: | full_webtop |
Type: | Full (drop down) |
Click Finished at the bottom of the GUI
Select Access ‑> Profiles/Policies ‑> Access Profiles (Per-Session Policies)
Click the Create button (far right)
In the New Profile window, enter the following information:
Name: | idp.f5demo.com‑policy |
Profile Type: | All (drop down) |
Profile Scope: | Profile (default) |
Scroll to the bottom of the New Profile window to the Language Settings section
Select English from the Factory Built‑in Languages menu on the right and click the Double Arrow (<<), then click the Finished button.
The Default Language should be automatically set
From the Access ‑> Profiles/Policies ‑> Access Profiles
(Per-Session Policies) screen, click the Edit link on the previously
created idp.f5demo.com‑policy
line
In the Visual Policy Editor window for /Common/idp.f5demo.com‑policy
,
click the Plus (+) Sign between Start and Deny
In the pop-up dialog box, select the Logon tab and then select the Radio next to Logon Page, and click the Add Item button
Click Save in the resulting Logon Page dialog box
In the Visual Policy Editor window for /Common/idp.f5demo.com‑policy
,
click the Plus (+) Sign between Logon Page and Deny
In the pop-up dialog box, select the Authentication tab and then select the Radio next to AD Auth, and click the Add Item button
In the resulting AD Auth pop-up window, select /Common/f5demo_ad
from the Server drop down menu
Click Save at the bottom of the window
In the Visual Policy Editor window for /Common/idp.f5demo.com‑policy
,
click the Plus (+) Sign on the successful branch between AD Auth
and Deny
In the pop-up dialog box, select the Authentication tab and then select the Radio next to AD Query, and click the Add Item button
In the resulting AD Query pop-up window, select /Common/f5demo_ad
from the Server drop down menu
In the AD Query pop‑up window, select the Branch Rules tab
Change the Name of the branch to Successful.
Click the Change link next to the Expression
In the resulting pop-up window, delete the existing expression by clicking the X as shown
Create a new Simple expression by clicking the Add Expression button
In the resulting menu, select the following from the drop down menus:
Agent Sel: | AD Query |
Condition: | AD Query Passed |
Click the Add Expression Button
Click the Finished button to complete the expression
Click the Save button to complete the AD Query
In the Visual Policy Editor window for /Common/idp.f5demo.com‑policy
,
click the Plus (+) Sign on the successful branch between AD Query and Deny
In the pop-up dialog box, select the Assignment tab and then select the Radio next to Advanced Resource Assign, and click the Add Item button
In the resulting Advanced Resource Assign pop-up window, click the Add New Entry button
In the new Resource Assignment entry, click the Add/Delete link
In the resulting pop-up window, click the SAML tab, and select the
Checkbox next to /Common/partner-app
Click the Webtop tab, and select the Checkbox next to
/Common/full_webtop
Click the Update button at the bottom of the window to complete the Resource Assignment entry
Click the Save button at the bottom of the Advanced Resource Assign window
In the Visual Policy Editor, select the Deny ending on the fallback branch following Advanced Resource Assign
In the Select Ending dialog box, selet the Allow radio button and then click Save
In the Visual Policy Editor, click Apply Access Policy (top left), and close the Visual Policy Editor
Begin by selecting Local Traffic ‑> Virtual Servers
Click the Create button (far right)
In the New Virtual Server window, enter the following information:
General Properties | |
---|---|
Name: | idp.f5demo.com |
Destination Address/Mask: | 10.1.10.110 |
Service Port: | 443 |
Configuration | |
---|---|
HTTP Profile: | http (drop down) |
SSL Profile (Client) | idp.f5demo.com‑clientssl |
Access Policy | |
---|---|
Access Profile: | idp.f5demo.com‑policy |
Scroll to the bottom of the configuration window and click Finished
Using your browser from the jump host, navigate to the SAML IdP you just
configured at https://idp.f5demo.com
(or click the provided bookmark)
Log in to the IdP. Were you successfully authenticated? Did you see the webtop with the SP application?
Note
Use the credentials provided in the Authentication section at the beginning of this guide (user/Agility1)
Click on the Partner App icon. Were you successfully authenticated (via SAML) to the SP?
Review your Active Sessions (Access ‑> Overview ‑> Active Sessions)
Review your Access Report Logs (Access ‑> Overview ‑> Access Reports)
The purpose of this lab is to deploy and test a Kerberos to SAML configuration. Students will modify a previous built Access Policy and create a seamless access experience from Kerberos to SAML for connecting users. This lab will leverage the work performed previously in Lab 2. Archive files are available for the completed Lab 2.
Objective:
Lab Requirements:
Estimated completion time: 25 minutes
Using the existing Access Policy from Lab 2, navigate to Access ‑> Profiles/Policies ‑> Access Profiles (Per-Session Policies), and click the Edit link next to the previously created idp.f5demo.com-policy
Delete the Logon Page object by clicking on the X as shown
In the resulting Item Deletion Confirmation dialog, ensure that the previous node is connect to the fallback branch, and click the Delete button
In the Visual Policy Editor window for /Common/idp.f5demo.com‑policy
,
click the Plus (+) Sign between Start and AD Auth
In the pop-up dialog box, select the Logon tab and then select the Radio next to HTTP 401 Response, and click the Add Item button
In the HTTP 401 Response dialog box, enter the following information:
Basic Auth Realm: | f5demo.com |
HTTP Auth Level: | basic+negotiate (drop down) |
Click the Save button at the bottom of the dialog box
In the Visual Policy Editor window for /Common/idp.f5demo.com‑policy
,
click the Plus (+) Sign on the Negotiate branch between
HTTP 401 Response and Deny
In the pop-up dialog box, select the Authentication tab and then select the Radio next to Kerberos Auth, and click the Add Item button
In the Kerberos Auth dialog box, enter the following information:
AAA Server: | /Common/apm-krb-aaa (drop down) |
Request Based Auth: | Disabled (drop down) |
Click the Save button at the bottom of the dialog box
Note
The apm-krb-aaa object was pre-created for you in this lab. More details on the configuration of Kerberos AAA are included in the Learn More section at the end of this guide.
In the Visual Policy Editor window for
/Common/idp.f5demo.com‑policy
, click the Plus (+) Sign on the
Successful branch between Kerberos Auth and Deny
In the pop-up dialog box, select the Authentication tab and then select the Radio next to AD Query, and click the Add Item button
In the resulting AD Query(1) pop-up window, select
/Commmon/f5demo_ad
from the Server drop down menu
In the SearchFilter field, enter the following value:
userPrincipalName=%{session.logon.last.username}
In the AD Query(1) window, click the Branch Rules tab
Change the Name of the branch to Successful.
Click the Change link next to the Expression
In the resulting pop-up window, delete the existing expression by clicking the X as shown
Create a new Simple expression by clicking the Add Expression button
In the resulting menu, select the following from the drop down menus:
Agent Sel: | AD Query |
Condition: | AD Query Passed |
Click the Add Expression Button
Click the Finished button to complete the expression
Click the Save button to complete the AD Query
In the Visual Policy Editor window for /Common/idp.f5demo.com‑policy
,
click the Plus (+) Sign on the Successful branch between
AD Query(1) and Deny
In the pop-up dialog box, select the Assignment tab and then select the Radio next to Advanced Resource Assign, and click the Add Item button
In the resulting Advanced Resource Assign(1) pop-up window, click the Add New Entry button
In the new Resource Assignment entry, click the Add/Delete link
In the resulting pop-up window, click the SAML tab, and select the Checkbox next to /Common/partner-app
Click the Webtop tab, and select the Checkbox next to
/Common/full_webtop
Click the Update button at the bottom of the window to complete the Resource Assignment entry
Click the Save button at the bottom of the Advanced Resource Assign(1) window
In the Visual Policy Editor, select the Deny ending on the fallback branch following Advanced Resource Assign
In the Select Ending dialog box, selet the Allow radio button and then click Save
In the Visual Policy Editor, click Apply Access Policy (top left), and close the Visual Policy Editor
Note
In the following Lab Task it is recommended that you use Microsoft Internet Explorer. While other browsers also support Kerberos (if configured), for the purposes of this Lab Microsoft Internet Explorer has been configured and will be used.
Using Internet Explorer from the jump host, navigate to the SAML IdP you previously configured at https://idp.f5demo.com (or click the provided bookmark)
Were you prompted for credentials? Were you successfully authenticated? Did you see the webtop with the SP application?
Click on the Partner App icon. Were you successfully authenticated (via SAML) to the SP?
Review your Active Sessions (Access ‑> Overview ‑> Active Sessions)
Review your Access Report Logs (Access ‑> Overview ‑> Access Reports)
The purpose of this lab is to familiarize the Student with the new SaaS Federation iApp. Students will use the iApp to create a federation relationship with a commonly used SaaS provider. This lab will leverage the work performed previously in Lab 3. Archive files are available for the completed Lab 3.
Objective:
Lab Requirements:
Estimated completion time: 25 minutes
Navigate to Access ‑> Federation ‑> SAML Identity Provider ‑> External SP Connectors
Click specifically on the Down Arrow next to the Create button (far right)
Select From Metadata from the drop down menu
In the Create New SAML Service Provider dialogue box, click Browse
and select the SAMLSP-00D36000000jjkp.xml
file from the Desktop of your
jump host
In the Service Provider Name field, enter: salesforce
Click OK on the dialog box
Navigate to iApps ‑> Application Services -> Applications and click on the Plus (+) Sign as shown
In the resulting New Application Service window, enter saas as the Name
Select f5.saas_idp.v1.0.rc1
from the Template drop down menu
Note
The iApp template has already been downloaded and imported for this lab. You can download the latest iApp templates from https://downloads.f5.com/
Configure the iApp template as follows:
SaaS Applications | |
---|---|
Application: | New federation relationship with salesforce.com |
SP: | salesforce |
Display Name: | SalesForce |
SP Initiated: | No |
BIG-IP APM Configuration | |
---|---|
What EntityID do you want to use for your SaaS applications? | https://idp.f5demo.com/idp/f5/ |
Should the iApp create a new AAA server or use an existing one? | f5demo_ad |
BIG-IP Virtual Server | |
---|---|
What is the IP address clients will use to access the BIG-IP IdP Service? | 10.1.10.120 |
What port do you want to use for the virtual server? | 443 |
Which certificate do you want this BIG-IP system to use for client authentication? | idp.f5demo.com.crt |
What is the associated private key? | idp.f5demo.com.key |
Note
We are deploying the iApp on a different IP so that you can see
how everything is built out; however, this IdP will not work, as the
idp.f5demo.com
FQDN resolves to another IP.
We are going to use the iApp to create the SAML resource that we will
assign to our existing access policy from Lab 3.
IdP Encryption Certificate and Key | |
---|---|
Which certificate do you want to use to encrypt your SAML Assertion? | SAML.crt |
What is the associated private key? | SAML.key |
Scroll to the bottom of the configuration template and click Finished
Once deployed, you can review the built out SaaS Federation iApp at iApps ‑> Application Services ‑> Applications ‑> saas
Review the new virtual servers created by the iApp at Local Traffic ‑> Virtual Server ‑> Virtual Server List
Review the new Access Policy built by the iApp at Access ‑> Profiles/Policies ‑> Access Profiles (Per-Session Policies) and select the Edit link next to the saas Access Policy
Test the SaaS iApp by clicking on the bookmark in your browser.
Note
Navigating to the virtual server by IP will produce a certificate warning. This is expected. Click through the warning to see the resulting page.
The previous task, Task 2, was to provide you an understanding of how the SaaS Federation iApp can automatically build a configuration for you.
In this task we will be modifying the existing Webtop from prior labs to add the SaaS SalesForce application. The purpose of the task is so you can see the F5Demo App and SalesForce in the same Webtop.
Using the same Access Policy from Lab 3, navigate to Access ‑>
Profiles/Policies ‑> Access Profiles (Per-Session Policies) and
click the Edit link next to the previously created
idp.f5demo.com-policy
In the Visual Policy Editor window for /Common/idp.f5demo.com‑policy
,
click the Advanced Resource Assign object.
Click the Add/Delete link on the Resource Assignment item
Click the SAML tab, and select the checkbox next to
/Common/saas.app/saas_SalesForce_saml_resource_sso
Click the Update button at the bottom of the window to complete the Resource Assignment entry
Click the Save button at the bottom of the Advanced Resource Assign window
Repeat steps 2 - 6 with the Advanced Resource Assign (1) object
In the Visual Policy Editor, click Apply Access Policy (top left), and close the Visual Policy Editor
Using your browser from the jump host, navigate to the SAML IdP previously
configured at https://idp.f5demo.com
(or click the provided bookmark)
Were you prompted for credentials? Were you successfully authenticated? Did you see the webtop with the new SaaS SP application?
Click on the SalesForce icon. Were you successfully authenticated (via SAML) to the SP?
Review your Active Sessions (Access ‑> Overview ‑> Active Sessions)
Review your Access Report Logs (Access ‑> Overview ‑> Access Reports)
Thank you for your participation in the 301 Access Policy Manager (APM) Federation Lab. This Lab Guide has highlighted several notable features of SAML Federation. It does not attempt to review all F5 APM Federation features and configurations but serves as an introduction to allow the student to further explore the BIG-IP platform and Access Policy Manager (APM), its functions & features.
The following are additional resources included for reference and assistance with this lab guide and other APM tasks.
The following is an example of the AAA Server object used in Lab 3: Kerberos to SAML Lab (the /Common/apm-krb-aaa used in Task 1).
Create a new user in Active Directory
In this example, the User Logon Name kerberos has been created
From the Windows command line, run the KTPASS command to generate a keytab file for the previously created user object
ktpass /princ HTTP/kerberos.acme.com@ACME.COM /mapuser acme\kerberos /ptype KRB5_NT_PRINCIPAL /pass password /out c:\file.keytab
FQDN of virtual server: | kerberos.acme.com |
AD Domain (UPN format): | @ACME.COM |
Username: | acme\kerberos |
Password: | password |
Review the changes to the AD User object
Create the AAA object by navigating to Access ‑> Authentication -> Kerberos
Specify a Name
Specify the Auth Realm (Ad Domain)
Specify a Service Name (This should be HTTP for http/https services)
Browse to locate the Keytab File
Click Finished to complete creation of the AAA object
Review the AAA server configuration at Access ‑> Authentication
All lab prep is already completed if you are working in the UDF or Ravello blueprint. The following information will be critical for operating your lab. Additional information can be found in the *Learn More* section of this guide for setting up your own lab.
Lab Credentials
Host/Resource | Username | Password |
---|---|---|
Windows Jump Host | user | user |
Big-IP 1, Big-IP 2 GUI (Browser Access) | admin | admin |
Big-IP 1, Big-IP 2 CLI (SSH Access) | root | default |
Lab Network & Resource Design
Note
The entire module covering Social Login is performed on BIG-IP 1 (OAuth C/RS)
This module will teach you how to configure a Big-IP as a client and resource server enabling you to integrate with social login providers like Facebook, Google, and LinkedIn to provide access to a web application. You will inject the identity provided by the social network into a header that the backend application can use to identify the user.
Go to Local Traffic -> Virtual Servers -> Create
Enter the following values (leave others default)
social.f5agility.com-vs
10.1.20.111
443
http
f5agility-wildcard-self-clientssl
Auto Map
Select webapp-pool from the Default Pool drop down and then click Finished
Test access to https://social.f5agility.com
from the jump host’s browser.
You should be able to see the backend application, but it will give you an error indicating you have not logged in because it requires a header to be inserted to identify the user.
Go to Access -> Profiles / Policies -> Access Profiles (Per Session Policies) -> Create
Enter the following values (leave others default) then click Finished
social-ap
All
Profile
Click Edit for social-ap, a new browser tab will open
Click the + between Start and Deny, select OAuth Logon Page from the Logon tab, click Add Item
Set the Type on Lines 2, 3, and 4 to none
Change the Logon Page, Input Field #1 to “Choose a Social Logon Provider”
Click the Values column for Line 1, a new window will open.
Alternatively, you may click [Edit] on the Input Field #1 Values line. Either item will bring you to the next menu.
Click the X to remove F5, Ping, Custom, and ROPC
Click Finished
Note
The resulting screen is shown
Ping, Custom, F5 ROPC, and Ping ROPC
Click Save
Click Apply Access Policy in the top left and then close the browser tab
Go to Local Traffic -> Virtual Servers -> social.f5agility.com-vs
Modify the Access Profile setting from none to social-ap and click Update
Test access to https://social.f5agility.com from the jump host again, you should now see a logon page requiring you to select your authentication provider. Any attempt to authenticate will fail since we have only deny endings.
Login at https://console.developers.google.com
Note
This portion of the exercise requires a Google Account. You may use an existing one or create one for the purposes of this lab
Click Create Project and give it a name like “OAuth Lab” and click Create
Note
You may have existing projects so the menus may be slightly different.
Note
You may have to click on Google+ API under Social APIs
Go to the Credentials section on the left side.
Note
You may have navigate to your OAuth Lab project depending on your browser or prior work in Google Developer
Click OAuth Consent Screen tab, fill out the product name with “OAuth Lab”, then click save
Go to the Credentials tab (if you are not taken there), click Create Credentials and select OAuth Client ID
Under the Create Client ID screen, select and enter the following values and click Create
Web Application
OAuth Lab
https://social.f5agility.com
https://social.f5agility.com/oauth/client/redirect
Copy the Client ID and Client Secret to notepad, or you can get it by clicking on the OAuth Lab Credentials section later if needed. You will need these when you setup Access Policy Manager (APM).
Click Library in the left-hand navigation section, then select Google+ API under Social APIs or search for it
Click Enable and wait for it to complete, you will now be able to view reporting on usage here
For Reference: This is a screenshot of the completed Google project:
Configure the OAuth Server Object: Go to Access -> Federation -> OAuth Client / Resource Server -> OAuth Server and click Create
Enter the values as shown below for the OAuth Server and click Finished
Client + Resource Server
Google
Google
oauth-dns *(configured for you)*
<Client ID from Google>
<Client Secret from Google>
apm-default-serverssl
<Client ID from Google>
<Client Secret from Google>
apm-default-serverssl
Configure the VPE for Google: Go to Access -> Profiles / Policies ->
Access Profiles (Per Session Policies) and click Edit on social-ap
,
a new browser tab will open
Click the + on the Google provider’s branch after the OAuth Logon Page
Select OAuth Client from the Authentication tab and click Add Item
Enter the following in the OAuth Client input screen and click Save
Google OAuth Client
/Common/Google
Authorization Code
/Common/GoogleAuthRedirectRequest
/Common/GoogleTokenRequest
/Common/GoogleTokenRefreshRequest
/Common/GoogleValidationScopesRequest
https://%{session.server.network.name}/oauth/client/redirect
profile
Click + on the Successful branch after the Google OAuth Client
Select OAuth Scope from the Authentication tab, and click Add Item
Enter the following on the OAuth Scope input screen and click Save
Google OAuth Scope
/Common/Google
/Common/GoogleValidationScopesRequest
Click Add New Entry
- Scope Name:
https://www.googleapis.com/auth/userinfo.profile
- Request:
/Common/GoogleScopeUserInfoProfileRequest
Google OAuth Scope object
Add Item
Name it Google Variable Assign and click Add New Entry then change
Enter the following values and click Finished
Left Side:
Custom Variable
Unsecure
session.logon.last.username
Right Side:
Session Variable
session.oauth.scope.last.scope_data.userinfo.profile.displayName
Review the Google Variable Assign object and click Save
Click Deny on the Fallback branch after the Google Variable Assign object, select Allow in the pop up window and click Save
Click Apply Access Policy in the top left and then close the tab
Test by opening Chrome in the jump host and browsing to
https://social.f5agility.com
, select the provider and attempt logon.
Note
You are able to login and reach the app now, but SSO to the app has not been setup so you get an application error.
Note
You may also be prompted for additional security measures as you are logging in from a new location.
Go to https://developers.facebook.com and Login
Note
This portion of the exercise requires a Facebook Account. You may use an existing one or create one for the purposes of this lab
If prompted click, Get Started and accept the Developer Policy. Otherwise, click Create App
Click Create App and name (Display Name) your app (Or click the top left project drop down and create a new app, then name it). Then click Create App ID.
Note
For example the Display Name given here was “OAuth Lab”. You may also be prompted with a security captcha
Click Get Started in the Facebook Login section (Or click + Add Product and then Get Started for Facebook)
From the “Choose a Platform” screen click on WWW (Web)
In the “Tell Us about Your Website” prompt, enter
https://social.f5agility.com
for the Site URL and click Save
then click Continue
Click Next on the “Set Up the Facebook SDK for Javascript” screen
Click Next on the “Check Login Status” screen
Note
Additional screen content removed.
Click Next on the “Add the Facebook Login Button” screen
Click Facebook Login on the left side bar and then click Settings
For the Client OAuth Settings screen in the Valid OAuth redirect URIs
enter https://social.f5agility.com/oauth/client/redirect
and then
click enter to create it, then Save Changes
Click Dashboard in the left navigation bar
Here you can retrieve your App ID and App Secret for use in Access Policy Manager (APM).
Screenshot of completed Facebook project
Note
If you want Facebook Auth to work for users other than the developer you will need to publish the project
Configure the OAuth Server Object: Go to Access -> Federation -> OAuth Client / Resource Server -> OAuth Server and click Create
Enter the values as shown below for the OAuth Server and click Finished
Facebook
Client + Resource Server
Facebook
Facebook
oauth-dns
(configured for you)<App ID from Facebook>
<App Secret from Facebook>
apm-default-serverssl
<App Secret from Facebook>
apm-default-serverssl
Configure the VPE for Facebook: Go to Access -> Profiles / Policies ->
Access Profiles (Per Session Policies) and click Edit on
social-ap
, a new browser tab will open
Click the + on the Facebook provider’s branch after the OAuth Logon Page
Select OAuth Client from the Authentication tab and click Add Item
Enter the following in the OAuth Client input screen and click Save
Facebook OAuth Client
/Common/Facebook
Authorization Code
/Common/FacebookAuthRedirectRequest
/Common/FacebookTokenRequest
None
https://%{session.server.network.name}/oauth/client/redirect
public_profile
(Note underscore)Click + on the Successful branch after the Facebook OAuth Client
Select OAuth Scope from the Authentication tab, and click Add Item
Enter the following on the OAuth Scope input screen and click Save
Facebook OAuth Scope
/Common/Facebook
/Common/FacebookValidationScopesRequest
public_profile
/Common/FacebookScopePublicProfile
Click the + on the Successful branch after the Facebook OAuth Scope object
Select Variable Assign from the Assignment tab, and click Add Item
Name it Facebook Variable Assign and click Add New Entry then change
Enter the following values and click Finished
Left Side:
Custom Variable
Unsecure
session.logon.last.username
Right Side:
Session Variable
session.oauth.scope.last.scope_data.public_profile.name
Review the Facebook Variable Assign object and click Save
Click Deny on the Fallback branch after the Facebook Variable Assign object, select Allow in the pop up window and click Save
Click Apply Access Policy in the top left and then close the tab
Test by opening Chrome in the jump host and browsing to
https://social.f5agility.com
, select the provider and attempt logon.
Note
You are able to login and reach the app now, but SSO to the app has not been setup so you get an application error.
Note
You may also be prompted for additional security measures as you are logging in from a new location
Note
You may need to start a Chrome New Incognito Window so no session data carries over.
You should be prompted to authorize your request. Click Continue as <Account> (Where <Account> is your Facebook Profile name)
Login at https://www.linkedin.com/secure/developer
Note
This portion of the exercise requires a LinkedIn Account. You may use an existing one or create one for the purposes of this lab*
Click Create Application
In the Create a New Application screen fill in the required values and click Submit
Note
Generic values have been shown. You may use the values you deem appropriate
Note
An Application logo has been provided on your desktop ‘OAuth2.png’
In the “Authentication Keys” screen, check the boxes for
r_basicprofile
and r_emailaddress
. In the
Authorized Redirect URLs, enter
https://social.f5agility.com/oauth/client/redirect
Click Add. Finally, click Update at the bottom of the screen.
Configure the OAuth Server Object: Go to Access -> Federation -> OAuth Client / Resource Server -> Provider and click Create
Note
You are creating a “Provider”
Enter the values as shown below for the OAuth Provider and click Finished
LinkedIn
Custom
https://www.linkedin.com/oauth/v2/authorization
https://www.linkedin.com/oauth/v2/accessToken
https://www.linkedin.com/v1/people/~
Configure the OAuth Redirect Request Profile Object: Go to Access -> Federation -> OAuth Client / Resource Server -> Request and click Create
Enter the values as shown for the OAuth Request and click Finished
LinkedInAuthRedirectRequest
GET
auth-redirect-request
Add the following request parameters and click Add after entering the values for each:
custom
response_type
code
client-id
client_id
redirect-uri
redirect_uri
scope
scope
Note
LinkedIn requires a state parameter, but we already insert it by default.
Configure the OAuth Token Request Profile Object: Go to Access -> Federation -> OAuth Client / Resource Server -> Request and click Create
Enter the values as shown for the OAuth Request and click Finished
LinkedInTokenRequest
POST
token-request
Add the following request parameters and click Add after entering the values for each:
grant-type
grant_type
redirect-uri
redirect_uri
client-id
client_id
client-secret
client_secret
Configure the OAuth Validation Scopes Request Profile Object: Go to Access -> Federation -> OAuth Client / Resource Server -> Request and click Create
Enter the values as shown for the OAuth Request and click Finished
LinkedInValidationScopesRequest
GET
validation-scopes-request
Add the following request parameters and click Add after entering the values for each:
custom
oauth2_access_token
%{session.oauth.client.last.access_token}
custom
format
json
Configure the OAuth Scope Data Request Profile Object: Go to Access -> Federation -> OAuth Client / Resource Server -> Request and click Create
Enter the values as shown for the OAuth Request and click Finished
LinkedInScopeBasicProfile
GET
https://api.linkedin.com/v1/people/~
scope-data-request
Add the following request parameters and click Add after entering the values for each:
custom
%{session.oauth.client.last.access_token}
custom
format
json
Configure the OAuth Server Object: Go to Access -> Federation -> OAuth Client / Resource Server -> OAuth Server and click Create
Enter the values as shown below for the OAuth Server and click Finished
LinkedIn
Client + Resource Server
Custom
LinkedIn
oauth-dns *(configured for you)*
<App ID from LinkedIn>
<App Secret from LinkedIn >
apm-default-serverssl
<App ID from LinkedIn >
<App Secret from LinkedIn >
apm-default-serverssl
Configure the VPE for LinkedIn: Go to Access -> Profiles / Policies ->
Access Profiles (Per Session Policies) and click Edit on social-ap
,
a new browser tab will open
Click on the link OAuth Logon Page as shown
Click on the Values area of Line #1 as shown. A pop-up window will appear
Click Add Option. In the new Line 3, type LinkedIn in both the Value and Text (Optional) fields and click Finished
Click on the Branch Rules tab of the OAuth Logon Page screen
Click Add Branch Rule. In the resulting new line enter LinkedIn for the Name field and click the Change link on the Expression line
Click Add Expression on the Simple tab
Select OAuth Logon Page in the Agent Sel: drop down. Select OAuth provider type from the Condition drop down. In the OAuth provider field enter LinkedIn and then click Add Expression
Click Finished on the Simple Expression tab
Click Save on the completed Branch Rules tab
Click the + on the LinkedIn provider’s branch after the OAuth Logon Page
Note
If not still in the VPE: Go to Access -> Profiles / Policies -> Access Profiles (Per Session Policies). Click Edit on social-ap, a new browser tab will open*
Select OAuth Client from the Authentication tab and click Add Item
Enter the following in the OAuth Client input screen and click Save
LinkedIn OAuth Client
/Common/LinkedIn
Authorization Code
/Common/LinkedInAuthRedirectRequest
/Common/LinkedInTokenRequest
None
/Common/LinkedInValidationScopesRequest
https://%{session.server.network.name}/oauth/client/redirect
r_basicprofile *(Note underscore)*
Click + on the Successful branch after the LinkedIn OAuth Client
Select OAuth Scope from the Authentication tab, and click Add Item
Enter the following on the OAuth Scope input screen and click Save
LinkedIn OAuth Scope
/Common/LinkedIn
/Common/LinkedInValidationScopesRequest
r_basicprofile
/Common/LinkedInScopeBasicProfile
Click the + on the Successful branch after the LinkedIn OAuth Scope object
Select Variable Assign from the Assignment tab, and click Add Item
Name it LinkedIn Variable Assign and click Add New Entry then change
Enter the following values and click Finished
Left Side:
Custom Variable
Unsecure
session.logon.last.username
Right Side:
Session Variable
session.oauth.scope.last.firstName
Review the LinkedIn Variable Assign object and click Save
Click Deny on the Fallback branch after the LinkedIn Variable Assign object, select Allow in the pop up window and click Save
Click Apply Access Policy in the top left and then close the tab
Test by opening Chrome in the jump host and browsing to
https://social.f5agility.com
, select the provider and attempt logon.
Note
You are able to login and reach the app now, but SSO to the app has not been setup so you get an application error.
Note
You may also be prompted for additional security measures as you are logging in from a new location.
Note
You may need to start a Chrome New Incognito Window so no session data carries over.
You will be prompted to authorize your request. Click Allow.
In this task you will create a policy that runs on every request. It will insert a header into the serverside HTTP Requests that contains the username. The application will use this to identify who the user is, providing Single Sign On (SSO).
Go to Access -> Profiles/Policies -> Per Request Policies and click Create
Enter prp-x-user-insertion the Name field and click Finished
Click Edit on the prp-x-user-insertion policy line
Click the + symbol between Start and Allow
Under the General Purpose tab select HTTP Headers and click Add Item
Under the HTTP Header Modify section, click Add New Entry to add the following two headers and then click Save
replace
X-User
%{session.logon.last.username}
replace
X-Provider
%{session.logon.last.oauthprovidertype}
Note
Replace instead of Insert has been selected for Header Operation to improve security. A malicious user might insert their own X-User header. As using Insert would simply add another header. Using Replace will add a header if it does not exist, or replace one if it does.
You do not need to Apply Policy on per request policies. You may simply close the browser tab
Go to Local Traffic -> Virtual Servers and click on
social.f5agility.com-vs
Scroll to the Access Policy section of the Virtual Server and select
prp-x-user-insertion
from the Per-Request Policy drop down. Scroll
to the bottom of the page and click Update
Go to https://social.f5agility.com in your browser and logon using one of the social logon providers. This time you should see your name appear in the top right corner. You can also click “Headers” in the webapp and look at the headers presented to the client. You will see x-user present here with your name as the value. You’ll also see the x-provider header you inserted indicating where the data is coming from.
This section will teach you how to configure a Big-IP (#1) as a Resource Server protecting an API with OAuth and another Big-IP (#2) as the Authorization Server providing the OAuth tokens.
Go to Local Traffic -> Virtual Servers and click on Create
Enter the following values (leave others default) then scroll down to Resources
api.f5agility.com-vs
10.1.20.112
443
http
f5agility-wildcard-self-clientssl
Auto Map
In the Resources section, select following value (leave others default) then click Finished
Default Pool: api-pool
On the Jump Host, launch Postman from the desktop icon
The request should be prefilled with the settings below. If not change as needed or select TEST API Call from the API Collection and click Send
Method: GET
Target: https://api.f5agility.com/department
Authorization: No Auth
Headers: (none should be set)
You should receive a 200 OK, 4 headers and the body should contain a list of departments.
Note
This request is working because we have not yet provided any protection for the API.*
Note
If you get “Could not get any response” then Postman’s settings
may be set to verify SSL Certificates (default). Click File -> Settings
and turn SSL Certificate Verification
to Off.*
Go to Access -> Federation -> OAuth Authorization Server -> Database Instance and click Create
Enter oauth-api-db for the Name field and click Finished.
Go to Access -> Federation -> OAuth Authorization Server -> Scope and click Create
Enter the following values and and click Finished.
oauth-scope-username
username
%{session.logon.last.username}
username
Note
This scope is requested by the Resource Server and the information here is provided back. You can hardcode a value or use a variable as we have here. So if the scope username is requested, we will supply back the username that was used to login at the Authorization Server (AS).*
Go to Access -> Federation -> OAuth Authorization Server -> Client Application and click Create
Enter the following values and click Finished.
oauth-api-client
HR API
HR API
Secret
oauth-scope-username
Authorization Code
https://www.getpostman.com/oauth2/callback
Remember to click Add
Note
The Redirect URI above is a special URI for the Postman client you’ll be using. This would normally be a specific URI to your client
Go to Access -> Federation -> OAuth Authorization Server -> Resource Server and click Create
Enter the following values and click Finished.
oauth-api-rs
Secret
Go to Access -> Federation -> OAuth Authorization Server -> OAuth Profile and click Create
Enter the following values and click Finished.
oauth-api-profile
oauth-api-client
oauth-api-rs
oauth-api-db
Go to Access -> Profiles/Policies -> Access Profiles (Per Session Policies) and click Create
In the General Properties section enter the following values
oauthas-ap
All
Profile
In the Configurations section select the following value from the OAuth Profile drop down menu.
oauth-api-profile
In the Language Settings section enter the following value and then click Finished.
English
Click Edit on the oauthas-ap policy, a new browser tab will open.
Click the + between Start and Deny
Select Logon Page from the Logon tab, and click Add Item
Accept the defaults on the Logon Page and click Save
Click the + between Logon Page and Deny
Select OAuth Authorization from the Authentication tab and click Add Item
Accept the defaults for the OAuth Authorization and click Save
Click Deny on the Successful branch after the OAuth Authorization object, select Allow, click Save
Click Apply Access Policy in the top left and then close the tab
Note
We are not validating the credentials entered on the Logon Page, so you can enter anything you want. In a production deployment you would most likely include some process for validating credentials such as an LDAP Auth or AD Auth object, or perhaps limiting access by IP or client certificate
Note
This policy might also set some variables that get used as scope values. Thus, you could determine what the scope values are by utilizing the policy here.*
Go to Local Traffic -> Virtual Servers and click Create
Enter the following values for the Authorization Server Virtual Server
oauthas.f5agility.com-vs
10.1.20.110
443
http
f5agility-wildcard-self-clientssl
Auto Map
Scroll to the Access Policy section, select oauthas-ap from the Access Profile drop down menu and then click Finished at the bottom of the screen.
Go to Access -> Federation -> OAuth Client/Resource Server -> Provider and click Create
Enter the following values for the Authorization Server Virtual Server and then click Finished
oauthas.f5agility.com-provider
F5
https://oauthas.f5agility.com/f5-oauth2/v1/authorize
https://oauthas.f5agility.com/f5-oauth2/v1/token
https://oauthas.f5agility.com/f5-oauth2/v1/introspect
Go to Access -> Federation -> OAuth Client/Resource Server -> OAuth Server and click Create
Enter the following values for the Authorization Server Virtual Server and then click Finished
api-resource-server
Resource Server
F5
oauthas.f5agility.com-provider
oauth-dns
Note
We are using a custom serverssl profile to allow negotiation with an untrusted certificate. This is needed because our Authorization Server is using a self-signed certificate. In production for proper security you should leverage a trusted certificate (most likely publicly signed) and the apm-default-serverssl profile (or other as appropriate)*
The values for step 4 above can be obtained by accessing Big-IP 2 and navigating to Access -> Federation -> OAuth Authorization Server -> Resource Server -> oauth-api-rs as shown.
To configure the APM Per Session Policy go to Access -> Profiles / Policies -> Access Profiles (Per Session Policies) and then click Create
Enter the following values and then click Finished
api-ap
OAuth-Resource-Server
Profile
English
Note
User Identification Method is set to OAuth Token and you cannot change it for this profile type.
Click Edit on the new api-ap policy and a new window will open
Click Deny on the fallback branch after Start, select Allow and click Save
Click Apply Access Policy in the top left and then close the tab
To configure the APM Per Request Policy go to Access -> Profiles / Policies -> Per Request Policies and then click Create
Enter api-prp for the Name and click Finished
Click Edit on the api-prp policy and a new window will appear
Click Add New Subroutine
Leave the Select Subroutine template
as Empty. Enter RS Scope
Check for the Name and then click Save
Click the + next to the RS Scope Check
Click Edit Terminals on the RS Scope Check Subroutine
First, rename Out to Success, then click Add Terminal and name it Failure
Go to the Set Default tab and select Failure then click Save
Click Edit Terminals again (it will ignore the order settings if you do this in one step without saving in between)
Move Success to the top using the up arrow on the right side then click Save
Click the + between In and Success, a new window will appear
Select OAuth Scope from the Authentication tab and click Add Item
Enter the following values and then click Save
/Common/api-resource-server
Verify that the Successful branch terminates in Success and the Fallback branch terminates in Failure
In the main policy, click + between the Start and Allow
Select RS Scope Check from the Subroutines tab and click Add Item
Verify that the Success branch terminates in Allow and the Fallback branch terminates in Reject
Note
You do not need to “Apply Policy ” on Per Request Policies*
To add the APM Policies to the API Virtual Server, go to Local Traffic -> Virtual Servers and click on api.f5agility.com-vs
Scroll down to the Access Policy section. Change Access Profile from None to api-ap
Change Per-Request Policy from None to api-prp and then click Update
On the Jump Host, launch Postman from the desktop icon
The request should be prefilled with the settings below (same as earlier). If not change as needed or select TEST API Call from the API Collection and click Send
GET
https://api.f5agility.com/department
No Auth
(none should be set)
You should receive a 401 Unauthorized
and 3 headers,
including WWW-Authenticate: Bearer
. The body will be empty.
Note
Your API call failed because you are not providing an OAuth token. Both tabs shown
Click the Authorization tab and change the Type from No Auth to OAuth 2.0
If present, select any existing tokens on the left side and delete them on the right side. Click Get New Access Token
In the Get New Access Token window, if the values do not match then adjust as needed, and click Request Token
Note
If you’re doing this lab on your own machine and using self signed certificates you must add the certs to the trusted store on your computer. If you’ve just done this, you must close Postman and reopen. You also need to go to File -> Settings in Postman and turn SSL certificate validation to off.
https://oauthas.f5agility.com/f5-oauth2/v1/authorize
https://oauthas.f5agility.com/f5-oauth2/v1/token
Authorization Code
checked
Logon with any credentials, such as user/password
Authorize the HR API by clicking Authorize
You now have received an OAuth Token. Click the name of your token under Existing Tokens (left) and your token will appear on the right
Change the Add token to drop down to Header and the click Use Token. You will note that the Header tab (in the section tabs just above) now has one header in the Header tab which contains your Authorization Header of type Bearer with a string value.
The Header tab data is shown in the screenshot
Click Send at the top of the Postman screen
You should receive a 200 OK, 5 headers and the body should contain a list of departments
Note
This time the request was successful because you presented a valid OAuth token to the resource server (the Big-IP), so it allowed the traffic to the API server on the backend.
Go to Big-IP 1 (OAuth C/RS) -> Access -> Overview -> Active Sessions. Select the existing sessions and click Kill Selected Sessions, then confirm by clicking Delete
Go back to Postman and click Send with your current OAuth token still inserted into the header. You should still receive a 200 OK, 5 headers and the body should contain a list of departments.
Note
You were still able to reach the API because you were able to establish a new session with your existing valid token*.
Go Big-IP 2 (OAuth AS) -> Access -> Overview -> OAuth Reports -> Tokens. Change the DB Instance to oauth-api-db.
Select all tokens, click Checkbox left in title bar and the click Revoke in the top right
Go to Big-IP 1 (OAuth C/RS) -> Access -> Overview -> Active Sessions. Select the existing sessions and click Kill Selected Sessions, then confirm by clicking Delete
Go back to Postman and click Send with your
current OAuth token still inserted into the header. You should receive
a 401 Unauthorized
, 3 headers, no body, and the WWW-Authenticate
header will provide an error description indicating the token is not active.
Note
You can remove the header, delete the token, and start over getting a new token and it will work once again.*
Note
This time you were no longer able to reach the API because you no longer had a valid token to establish your new session with. Getting a new token will resolve the issue.
You can see reporting on OAuth traffic at Access -> Overview -> OAuth Reports -> Server
You can see the session logs by going to Access-> Overview-> Active Sessions and click on the active session, or for past sessions under Access -> Overview -> Access Reports -> All Sessions Report (it runs by default and asks for a time period)
After logging in Go to Access -> Overview -> Active Sessions and note that the “User” field is populated with the name from your social account (from social account labs). This happens because we took the relevant variable from the OAuth response and put it into the variable session.logon.last.username.
There are more session variables retrieved from the provider you can examine. To see them click on View under Variables for the session. Search for variables that start with “session.oauth.scope.last”. The scope will determine what the Authorization Server returns to you.
Note
You can terminate this session if desired at the Active Sessions screen*
You can see reporting on OAuth traffic at Access -> Overview -> OAuth Reports -> Client / Resource Server
You can see the session logs by going to Access-> Overview-> Active Sessions and click on the active session, or for past sessions under Access -> Overview -> Access Reports -> All Sessions Report (it runs by default and asks for a time period)
You can turn up the logging levels specific to OAuth at Access -> Overview -> Event Logs -> Settings. Often times Informational is enough to identify issues. It is recommended to start there before going to debug. In particular pay attention session.oauth.client.last.errMsg as it contains the errors the other side reported back to you.
You can actually examine what Big-IP has sent out when acting as a client/resource server. First, capture the traffic on the tmm channel:
tcpdump -i tmm:h -s0 -w /tmp/oauth.dmp
Then attempt your login using OAuth and ctrl-c the capture to end it. Now you need to ssldump the output:
ssldump -dr /tmp/oauth.dmp | more
Note
Your SSL Ciphers must support ssldump utility. Refer to the following link for further details https://support.f5.com/csp/article/K10209
Sometimes the issue is not at your end and some providers have their own logging and reporting you can leverage. As an example, Google has a dashboard that reports errors.
Although a lot of the critical stuff is passed back and forth directly without your browser being involved, you can at least validate the browser portions of the transaction are good (e.g. are you passing all the values you should, example below for Google).
Links & Information
Access Policy Manager (APM) Operations Guide:
Access Policy Manager (APM) Authentication & Single Sign On Concepts:
OAuth Overview:
OAuth Client & Resource Server:
OAuth Authorization Server:
Troubleshooting Tips
OAuth Client & Resource Server:
OAuth Authorization Server:
If you are building your own, here is some important information about the environment not covered in the lab. This lab environment requires two Big-IPs. One will act as an OAuth Client and Resource (Client/RS) Server. The other will act as an OAuth Authorization Server (AS). Both must be licensed and provisioned for Access Policy Manager (APM).
On the OAuth Client/RS Big-IP you will need backend pools for the two virtual servers, the lab expects a webapp behind the Social VS that accepts a header named x-user and reposts it back to the user. The lab expects an API behind the API VS that can respond with a list of departments to a request to /department. Also, a DNS Resolver must be configured on this Big-IP, in our case we don’t have a local DNS server to respond for the names used, so we are also leveraging an iRule and VS to answer DNS requests for specific names. You will need a browser for testing the social module and Postman for testing the API module.
Welcome to the APM 231: SWG - Securing Outbound Internet Access lab. These lab exercises will instruct you on configuring F5 Secure Web Gateway (SWG) for typical use cases. This guide is intended to complement lecture material provided during the course and to serve as a reference guide when configuring SWG in your own environment. Expected time to complete: 3 hours
In the interest of time, the following components have been set up with basic configurations for you in a cloud-based virtual lab environment with:
Each student’s lab environment is independent.
The following diagram illustrates the lab environment’s network configuration and will be useful if you wish to replicate these exercises in your personal lab environment:
The time it takes to perform each lab varies and is mostly dependent on accurately completing steps. Below is an estimate of how long it will take for each lab:
Lab Timing
Lab name (Description) | Time Allocated |
---|---|
Use Case: Enterprise Web Filtering | |
Lab 1: SWG iApp - Explicit Proxy for HTTP and HTTPS | 30 minutes |
Lab 2: URL Category-based Decryption Bypass | 25 minutes |
Lab 3: Explicit Proxy Authentication - NTLM | 25 minutes |
Use Case: Access Reporting | |
Lab 4: SWG Reporting with BIG-IQ | 15 minutes |
Use Case: Guest Access Web Filtering | |
Lab 5: SWG iApp – Transparent Proxy for HTTP and HTTPS | 15 minutes |
Lab 6: Captive Portal Authentication | 25 minutes |
Use Case: SSL Visibility | |
Lab 7: SSL Visibility for DLP (ICAP) | 15 minutes |
Provisioning Secure Web Gateway (SWG) requires Access Policy Manager (APM to also be provisioned.
When working with iApp templates for the first time, you should change the BIG-IP Configuration Utility’s default “Idle Time Before Automatic Logout” setting to a larger value. This has already been done for you in the lab environment to save time.
To access the lab environment, you will require a web browser and Remote Desktop Protocol (RDP) client software. The web browser will be used to access the Lab Training Portal. The RDP client will be used to connect to the Jump Host, where you will be able to access the BIG-IP management interfaces using HTTPS and SSH. You will also be using the Jump Host as a test client.
You class instructor will provide additional lab access details.
In this lab exercise, you will learn how to automate and simplify a deployment of SWG using an iApp template.
Estimated completion time: 30 minutes
Objectives:
Lab Requirements:
Before you can deploy the SWG iApp template, you must have the following objects configured:
Browse to Access >> Profiles / Policies >> Access Profiles (Per-Session Policies) and click Create…*
Name the profile AP_Explicit_Auth
Change the Profile Type to SWG-Explicit
Add English to the Accepted Languages list
Accept all other default settings and click Finished
Click on the Edit… link for the appropriate Access Policy created above
Select the + between Start and Deny and Add an HTTP 407 Response object
Change the HTTP Auth Level to basic
Click Save
On the Basic branch of the HTTP 407 Object, Add an AD Auth Object
Change the Server to /Common/AD_F5DEMO and change Show Extended Error to Enabled
Click Save
On the Successful branch of the AD Auth Object, click on the Deny Ending and change it to Allow
Click Save
Click on the Apply Access Policy link
Browse to Access >> Secure Web Gateway >> URL Filters and click Create…
Name your filter LAB_URL_FILTER and click Finished
Click on the first check box to select all categories
Click Allow at the bottom of the page
Click the check box to select Social Web – Facebook and then click Block (for this lab, our URL filter will only block Facebook)
Browse to Access >> Profiles / Policies >> Per-Request Policies and click Create…
Name your policy Lab_Per_Request
Click Finished
Click on the Edit… link for the appropriate Per-Request Policy created above, then go back to the VPE tab in your browser
Click on the + symbol between Start and Allow
Go to the General Purpose tab and add a Protocol Lookup object
Click Add Item
Click Save
On the HTTPS branch, click the + and Add a Category Lookup object (General Purpose tab)
Select Use SNI in Client Hello for Categorization Input
Click Save
After the Category Lookup, Add a URL Filter Assign Object (from the General Purpose tab) and choose URL Filter /Common/LAB_URL_FILTER
Important
Change the Ending of the Allow outcome on the “fallback” branch from “Reject” to Allow
Browse to iApps >> Application Services
Click Create…
Change the name to SWG
Change the Template to f5.secure_web_gateway.v1.1.0rc4 (your version may be newer)
Answer the questions as follows:
Question | Answer | |
---|---|
Do you want to see inline help? | Yes, show inline help | |
Do you want to enable advanced options? | No, do not enable advanced options |
Which type of SWG configuration do you want to deploy | Explicit Proxy |
Do you want to use ICAP to forward requests for inspection by DLP servers? | No, do not use ICAP for DLP |
What IP address and port do you want to use for the virtual server? |
|
What is the FQDN of this proxy? | proxy.f5demo.com. The local hosts file on your Jump Host has already been modified to resolve this FQDN to the correct IP address indicated above. |
On which ports should the system accept HTTP traffic? | 80 |
On which ports should the system accept HTTPS traffic? | 443 |
Which SWG-Explicit Access Policy do you want to use? | AP_Explicit_Auth |
Which Per-Request Access Policy do you want to use? | Lab_Per_Request |
Do you want the system to forward all name requests? | Yes, forward all name requests |
Which DNS servers do you want to use for forwarding? |
|
Which SSL profile do you want to use for client-side connections? | Create a new Client SSL profile |
Which Subordinate CA certificate do you want to use? | f5agility.crt |
Which CA key do you want to use? | f5agility.key |
Does the key require a password? If so, type it here | F5labs |
Which SSL profile do you want to use for server-side connections? | Create a new Server SSL profile |
Click Finished – you will see a large number of objects created for you on the Components tab.
A Windows Domain Group Policy was configured to deploy the CA certificate that SWG uses to forge new certificates (on behalf of the origin server) to domain-joined machines.
Open Internet Explorer on your Jump Host client machine
Click the gear icon or hit Alt-X
and select
Internet options
Go to the Content tab and click Certificates
Click on the Trusted Root Certification Authorities tab and scroll down. You should see the F5 Agility CA certificate in the list.
Double-click on the certificate to view its properties, then close this window and the Certificates window.
Open a new Internet Explorer “InPrivate” browser window on your Jump Host client machine
Browse to https://www.google.com
The browser should prompt you for authentication. Submit your credentials:
user1
AgilityRocks!
Verify defined user has an Access Session ID
Browse to Access > Overview > Active Sessions
Using an InPrivate browser window from the client test machine, go to https://www.google.com and verify the SSL certificate is signed by the F5 Agility CA you configured in Lab 1
Using an InPrivate browser window from the client test machine, go to https://www.wellsfargo.com and examine the certificate to verify that it is signed by the same F5 Agility CA you configured in Lab 1
Using an InPrivate browser window from the client test machine, go to https://www.facebook.com and verify that you are instead delivered a SWG Block Page, in accordance to the URL Filter you configured above.
In this lab exercise, you will bypass SSL decryption based on requests to URLs categorized as financial services web sites.
Estimated completion time: 25 minutes
Objectives:
Lab Requirements:
Copy the Lab_Per_Request Per Request Policy by browsing to Access Policy > Per-Request Policies and click Copy
Name the copy Lab_Per_Request_SSL_Bypass
Edit the new Per-Request Policy by clicking Edit, then go to the VPE tab in your browser
Modify the Encrypted Category Lookup object to include a branch for SSL Bypass:
Click on the existing Category Lookup object
On the Properties tab, change the name to Encrypted Category Lookup
Click to access the Branch Rules tab
Click Add Branch Rule and name it Banks
Click Change to modify the Expression of this new Branch Rule
Click Add Expression
Change Agent Sel: to Category Lookup
Change Category is: to Financial Data and Services
Click Add Expression
Click Finished
Click Save
Add an SSL Bypass Set object (from the General Purpose tab) on the Banks branch of the Encrypted Category Lookup
Click Save
Add an SSL Intercept Set object (from the General Purpose tab) on the “fallback” branch of the Encrypted Category Lookup
Click Save
Add a URL Filter object on the SSL Bypass Branch; select the LAB_URL_FILTER URL filter previously created in Lab1
Click Save
Change the Allow branch to an ending of Allow
user1
AgilityRocks!
In this lab exercise, you will reconfigure authentication for seamless login of AD domain-joined client using NTLM.
Estimated completion time: 25 minutes
Objectives:
Lab Requirements:
F5DEMO\\user1
AgilityRocks!
Use Firefox to access the BIG-IP GUI (https://10.1.1.10, admin/admin)
Browse to Access ›› Authentication : NTLM : Machine Account
Click Create
Fill out the fields as follows:
agility-ntlm
bigip1
f5demo.com
f5demo-dc.f5demo.com
admin
AgilityRocks!
Click Join
Create a new NTLM Auth Configuration
Browse to Access ›› Authentication : NTLM : NTLM Auth Configuration
Click Create
Name: agility-ntlm
Machine Account Name: agility-ntlm
Domain controller FQDN: f5demo-dc.f5demo.com
Click Add
Click Finished
Under Configurations:
Modify User Identification Method to Credentials
Modify NTLM Auth Configuration to agility-ntlm
Add English to Accepted Languages
Accept all other default settings and click Finished
Click on the Edit… link for the appropriate Access Policy created above
On the VPE browser tab, select the + between Start and Deny and Add a NTLM Auth Result object (from the Authentication tab)
Click Save
On the Successful branch of the NTLM Auth Result Object, click on the Deny Ending and change it to Allow
Click Save
Click Apply Access Policy
Before testing, close all browser sessions and kill all session in the GUI under Access > Overview > Active Sessions
In this lab exercise, you will explore SWG Reporting with Big-IQ Access.
Estimated completion time: 15 minutes
Objectives:
Lab Requirements:
Using Firefox, browse to the BIG-IQ Management GUI **https://10.1.1.30**
Login with the following credentials:
Username: admin
Password: admin
Browse to Monitoring > Dashboards > Access > Secure Web Gateway > Users to see the activity by users
Click on Categories to view category information,
Adjust the time period to 30 days or less
Click on SSL Bypass and view the breakdown between HTTPS Inspected and Bypassed Content
Click on Host Name to look at the hosts your users are accessing
Click on URLs to get detail on what URLs your users are accessing
In this lab exercise, you will configure SWG in transparent proxy mode to support environments where clients do not leverage an explicit proxy. BIG-IP is deployed inline on the client’s outbound path to the Internet to intercept the traffic.
Estimated completion time: 15 minutes
Objectives:
Lab Requirements:
In this lab exercise, you will a captive portal to authenticate client connecting to the Internet through the SWG transparent proxy.
Estimated completion time: 25 minutes
Objectives:
Lab Requirements:
Use Firefox to access the BIG-IP GUI (https://10.1.1.10, admin/admin)
Browse to Access >> Profiles / Policies >> Access Profiles (Per-Session Policies) and click Create…
Name the profile AP_Transparent_Captive_Portal
Change the Profile Type to SWG-Transparent
Change Captive Portals to Enabled
Set Primary Authentication URI to https://captive.f5demo.com
Add English to Accepted Languages
Accept all other default settings and click Finished
Click on the Edit… link for the appropriate Access Policy created above
On the VPE browser tab, select the + and Add a Message Box object (from the General Purpose tab)
For the Message, enter: Welcome to F5 Agility Guest Wifi Access. Please click the link to accept our terms and access the internet.
For the Link enter Go
Click Save
Select the + after the message box and Add a Logon Page object.
Configure the Logon Page as shown below:
Click Save
Click on the Deny ending and change it to Allow
Click Apply Access Policy
In this lab exercise, you will send decrypted traffic to an ICAP-based Data Loss Prevention (DLP) service for inspection. The DLP will block HTTP POSTs (uploads) of certain content such as credit cards numbers and documents with Top Secret data classification labels.
Estimated completion time: 15 minutes
Objectives:
Lab Requirements:
Browse to iApps >> Application Services > Applications
Click on SWG
Click Reconfigure
Scroll down to the ICAP Configuration section
Change the ICAP option to Yes, create a new ICAP DLP deployment
Enter 10.1.20.150 as the IP address of the DLP server (the default port of 1344 is correct).
Browse to the bottom and click Finished
user1
with
password AgilityRocks!
mydlp
with password
mydlp
.