Configuring the F5 BIG-IP as an Explicit Forward Web Proxy Using Secure Web Gateway (SWG)

In previous articles, we have discussed the use of F5 BIG-IP as a SSL VPN and other use cases for external or inbound access. I now wanted to take some time to discuss an outbound access use case using F5 BIG-IP as an explicit forward web proxy. In laymen terms, this use case allows you to control end user web access with malware prevention, URL and content filtering. This is made possible with a great partnership between F5 and Forcepoint, previously known as Websense. The BIG-IP can also be used as a transparent forward proxy though this will be outside the scope of this article. Below is a diagram and description of each.

OK, so now that we've discussed the intent of the article, let's go over the requirements before getting started. The customer requirement is to identify a forward web proxy solution that provides URL filtering, content filtering as well as the ability to export logs and statistics on end user browsing. They also require single sign on using Kerberos authentication.

As the integrator, you're wondering how much it would cost to bring in a new vendor and appliances to meet this requirement. Then you remember hearing that F5 is somewhat of a Swiss Army Knife, can they do this? So as many of us do, we go back to our handy dandy search engine and type in web proxy site:f5.com. What do you know, you see BIG-IP APM Secure Web Gateway Overview.

After reading the overview you will now identify the requirements to successfully deploy this solution. They include:

  • BIG-IP
  • LTM Licensed
  • APM Licensed
  • SWG Licensed

Note: SWG is a subscription based licenses which includes Forcepoint (Websense DB updates)

  • Obtain a signing cert and private key
  • Keytab generated using KTPass
  • Latest SWG iApp from https://downloads.f5.com
  • DNS Configured on BIG-IP to resolve external web addresses
  • Downloading the IP Intelligence database
  • Configure browser with explicit web proxy

Now looking at this it seems like it must include much much more than F5 but let's go deeper. Running on the F5 BIG-IP is LTM, APM and SWG. From SWG you will download the IP intelligence database which will be stored on the local BIG-IP and if connected to the internet can download updates on a reoccurring basis. With all of that now covered and you have provided a project timeline and requirements to your local PM, let's get started!

We will begin by validating the required modules have been provisioned on the BIG-IP.
  • Navigate to System > Resource Provisioning
  • Validate LTM, APM and Secure Web Gateway are provisioned as you see in the screenshot below. If each of these modules is not provisioned, select the appropriate resources and click Submit.

Note: Additional details regarding resource provisioning can be found here https://support.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/bigip-system-essentials-12-1-1/7.html

Now that you have provisioned the necessary F5 modules, you must obtain a signing cert and key which you will import into the BIG-IP for use later in the article. For this use case, I used a Windows 2012 box to submit a custom certificate request to my CA. For the sake of time, I am not going to walk through the certificate request process though I will provide one very important detail when performing the certificate request. When submitting the custom request, you must enable basic constraints allowing the subject to issue certificates behalf of the BIG-IP.

Import the cert and key into the BIG-IP.

  • Navigate to System > Certificate Management > Traffic Certificate Management > Click SSL Certificate List.
  • Click Import
  • Specify PKCS 12 as the import type.
  • Specify Demo_SWG_CA as the certificate name.
  • Browse to the location that the PFX file was exported to and Import.
  • Provide the password created when exporting cert and key.

  • Click Import

Before deploying the SWG iApp, we are going to configure our Active Directory AAA server, create a Keytab file, configure a Kerberos AAA server, create an explicit access policy, custom URL filter as well as a per-request access policy.

Create an Active Directory AAA

  • Navigate to Access > Authentication >Active Directory.
  • Click Create
  • Specify an AAA Server Name.
  • Specify an Domain Name.
  • Select the Direct radio button.
  • Specify the IP Address of your domain controller.
  • Provide an Admin username.
  • Provide the Admin Password.
  • Click Finished

Create a Keytab for Kerberos Authentication

  • From Active Directory Users and Computers, create a w user account that will be used to generate a Keytab file.



From a command prompt run the following ktpass command.

ktpass /princ HTTP/demouser.demo.lab@DEMO.LAB /mapuser demo\demouser /ptype KRB5_NT_PRINCIPAL /pass Password#1 /out c:\demo.keytab

After running the command above, navigate back to active directory users and computers and notice the changes made to the AD user account.

Create a Kerberos AAA Server

  • Create the AAA object by navigating to Access ‑> Authentication -> Kerberos.
  • Specify a Kerberos AAA server Name.
  • Specify the Active Directory domain as the Auth Realm.
  • Specify HTTP as the Service Name.
  • Browse for the Keytab File.
  • Click Finished

Create an explicit access policy

  • Navigate to Access > Profiles / Policies > Access Profiles (Per-Session Policies).
  • Click Create
  • Specify a name for the Per-Session access policy.
  • Specify SWG-Explicit as the policy type.
  • Accepted Languages: English or any that applies to you.
  • Click Finished
  • Once redirected back to Profiles / Policies: Access Profiles (Per-Session Policies) click Edit on the policy that was created in the previous step.

  • Select the + between Start and Deny and add a 407 Response.

  • From the HTTP Auth Level drop down select negotiate and click Save.
  • Navigating back to the VPE, following the Basic branch select + between the 407 Response created in the previous step and Deny.
  • From the Authentication tab select AD Auth and click Add.

You will then be presented with the AD Auth configuration item.

  • Select the AAA AD server we created in previous steps by using the drop down next to Server.

  • Click Save
  • Navigate back to the VPE.
  • Following the Negotiate branch select the + between the HTTP 407 Response and Deny.
  • From the Assignment tab select Variable Assign and click Add Item.

  • From the Variable Assign configuration item, select Add new entry.
  • Select change from the Assignment created in the previous step.
  • Within the Custom Variable text field, type session.server.network.name .
  • Within the Custom Expression text field, type expr { "demo.lab" } .
  • Click Finished
  • Click Save
  • Following the same workflow, select + between Variable Assign and Deny.
  • Select the Authentication tab.
  • Select Kerberos Auth and Click Add Item.

  • From the Kerberos Auth configuration item, select the Kerberos AAA server created in previous steps using the drop down next to AAA Server.
  • Click Save

  • From the VPE, modify the endings following Kerberos Auth and AD Auth to Allow.

Create a Custom URL Filter

  • Navigate to Access > Secure Web Gateway > URL Filter and click Create.
  • Specify a URL Filter name.
  • Click Finished
  • Once the page refreshes, you will be presented with a page to Allow or Deny URL categories. For demo purposes only, select the check in the first column as shown in the screenshot below.

  • Click Allow at the bottom left of the screen.
  • Next place a single check mark next to Social Web - YouTube and click Block.

Create a Per-Request Access Policy

With a Per-Request Access Policy, we can identify the category of each website a user browsers to.

  • Navigate to Access > Profiles / Policies > Per-Request Policies and click Create.
  • Specify a Per-Request Policy name.
  • Click Finished
  • Click on Edit for the Per-Request Policy created in the previous step and you will be redirected to a visual policy editor.

  • Click on the + symbol between Start and Allow.
  • Select the General Purpose tab and add Category Lookup.

  • Click Add Item
  • Leave all default settings and click Save.
  • Following Category Lookup, click the + , select the General Purpose tab and add URL Filter Assign.

  • Click Add Item
  • From the URL Filter drop down select the URL filter created in previous steps.

  • Click Save

Review of Completed Steps

  1. Provisioned the required BIG-IP Modules.
  2. Created and exported a signing certificate and key into a pfx file format.
  3. Created a Keytab for Kerberos Auth.
  4. Created an AAA for AD authentication.
  5. Created an AAA for Kerberos authentication using Keytab.
  6. Created a URL filter to restrict access to YouTube.
  7. Created a per-session access policy.
  8. Created a per-request access policy.

iApp Download

After completing each of the steps above, we can now move onto creating an explicit proxy configuration using the latest SWG iApp.
  • From a browser navigate to downloads.f5.com and login.

Note: This is a no cost account. If you have not done so, register using a valid email address and you will have access to F5 downloads.

  • Select Find a Download
  • From the BIG-IP Product Line, select iApp Templates.

You will then be redirected to the iApps download page

  • Select iApp-Templates
  • Accept the End User Software License Agreement.
  • Select the iapps-1.x.x.x.x.zip file.
  • Select the link to your nearest location.
  • Save File

Return to the BIG-IP TMUI

  • Navigate to iApps > Templates > Click Import
  • Click Choose File or Browse to the iApp tmpl file located within the compressed zip file.
  • Click Open and then Upload.
  • Navigate to Application Services > Applications.
  • Click Create
  • Specify a name for the application.
  • From the Template drop down, change the template to “f5.secure_web_gateway.x.x
  • Use the following responses to complete the iApp configuration.

  • Click Finished and once the page is refreshed you will see all objects created by the iApp.

Configure Trusted CA in Windows Group Policy

Before we begin testing it is recommended to configure the local workstation to trust the CA that will be forging new certificates on behalf of the origin servers. In order to ensure all domain joined workstations receive the certificate and it is placed in the Trusted Root Certification Authorities store I utilized group policy to deploy the certificate.
  • Click Start, point to Administrative Tools, and then click Group Policy Management.
  • In the console tree, double-click Group Policy Objects in the forest and domain containing the Default Domain Policy Group Policy object (GPO) that you want to edit.
  • Right-click the Default Domain Policy GPO, and then click Edit.
  • In the Group Policy Management Console (GPMC), go to Computer Configuration, Windows Settings, Security Settings, and then click Public Key Policies.
  • Right-click the Trusted Root Certification Authorities store.
  • Click Import and follow the steps in the Certificate Import Wizard to import the certificates.
  • From the workstation you will be testing from perform a group policy update using gpupdate /force or reboot the machine.
  • Launch iexplore.exe
  • Navigate to the Content tab and click Certificates.
  • Click on the Trusted Root Certification Authorities tab and scroll down and validate the certificate chosen in the previous step is present.

  • In order to configure your browser with a Proxy Server, within Internet Explorer Settings navigate to the Connections tab and click LAN settings.
  • Enable the checkbox for Use a proxy server for your LAN.
  • Address: swgkrb.demo.lab
  • Port: 3128
  • Click OK twice.

Testing our Solution

Now the time you've been waiting for. F5 said it has the ability but only way to validate is test yourself. So let's get to the bottom of this F5 explicit web proxy claim by F5 and test for ourselves.

  • From the browser configured in the step above, navigate to https://nfl.com.

  • Once the page is rendered, you should not receive a certificate error.
  • Click the Lock next to the refresh button and validate the certificate was issued from the signing certificate configured in previous steps.
  • Once validated, navigate back to the TMUI > Access > Overview > Active Sessions
  • Validate an access session is present for the request for https://nfl.com

Next we will validate users are not able to access YouTube.com as defined in our URL filter.
  • From the client browser, attempt to navigate to youtube.com where you should be presented with an blocked page from the BIG-IP.

Validate and View Reporting

Now that we have successfully validated functionality, we must ensure that we can meet the customers final requirement which is reporting.
  • From the TMUI navigate to Access > Overview > SWG Reports > Overview

  • Navigate to Access > Overview > SWG Reports > All Requests

  • Navigate to Access > Overview > SWG Reports > Blocked Requests

As a review, the customer requirements were to provide the following:
  • URL filtering
  • Content filtering
  • Logs and statistics on end user browsing.
  • Single Sign On using Kerberos authentication.

Well, there you have it. You have successfully deployed a forward web proxy solution using something you may already have in your data center. No time to celebrate though, you've got 10 more priority one projects that came into your queue in the hour it took you to deploy SWG! Until next time.

Reference Documentation

https://www.f5.com/pdf/solution-center/websense-overview.pdf

https://support.f5.com/kb/en-us/products/big-ip_apm/manuals/product/apm-secure-web-gateway-implementations-12-1-0/14.html

https://support.f5.com/kb/en-us/products/big-ip_apm/manuals/product/apm-secure-web-gateway-implementations-12-1-0/13.html

https://support.f5.com/content/kb/en-us/products/big-ip_apm/manuals/product/apm-secure-web-gateway-implementations-12-1-0/_jcr_content/pdfAttach/download/file.res/BIG-IP%C2%AE_Access_Policy_Manager%C2%AE__Secure_Web_Gateway.pdf

https://support.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/bigip-system-essentials-12-1-1/7.html

http://clouddocs.f5.com/training/community/iam/html/class1/kerberos.html

https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc772491(v=ws.11)

Published Mar 14, 2018
Version 1.0
  • Good article and I'm at the moment implementing this at a customer. I do have some issues which I do not know how to solve. Maybe you have some insight?

     

    First one being that the Kerberos Auth is not in any way tied to the actual user that executes the process on the client. I.e. if the user launches a new Internet Explorer window with "Run as different user..." this new browser window will ride on the first "Auth" made by the first User's browser window, accidently inherenting this user's assigned URL filter. Another side effect of this is that before the user logs in to the computer, Microsoft Windows by itself, starts accessing pages on the Internet e.g. msftconnecttest and other webpages. This results in that the user authenticated to APM might be a Machine Account.

     

    Second problem we have has to do with the "Confirm Box" that you can use to force the User to temporary accept a policy violation. The choice the user takes seems to hit the whole URL filter and not the actual Category of this particular website. Also there is no way to set the timeout anywhere for the choice made? I suspect there must be a cookie or something that needs to be cleared but I can not find any documentation of it anywhere...

     

    I'd be grateful if you can point me in the right direction if you happen to know anything about these issues...

     

    Kind regards, Marcus

     

  • Hi Marcus, I apologize for the delayed response. Give me a few days to review your questions and I will get back to you as soon as I can.

     

  • Excellent article!!!

     

    Really helps a lot.

     

    By any chance do you have a guide in how to make a sizing exercise for this solutions with this components?

     

    And another one: I was reading the guide "replacing TMG" and makes a reference of using "AFM" but in your article and many playbooks that I have checked, I haven't seen that recommendation, my question would be: Do I need it?. The question comes from an economical point of view. If we go "best" is an elevated price vs. having LTM + APM + SWG.

     

     

    Thanks!!!!

     

  • I'm sorry Steve, regarding the "AFM" question; already got my answer.

     

    It's optional if you required some reporting and DoS defenses, etc.

     

    So, only I would ask for the sizing exercise. If you can help me with that, I would realy appreciate it man!