Edge Networking & Security
Objective
This guide provides instructions on how to create secure edge networks using F5® Distributed Cloud Console and F5 Distributed Cloud Mesh.
The steps to create secure edge networks are:
Figure: Steps to Deploy Edge Cloud Networking and Security
The following images shows the topology of the example for the use case provided in this document:
Figure: ECNS Sample Topology
Using the instructions provided in this guide, you can deploy an F5 Distributed Cloud Site as part of a fleet, connect it to the cloud or SaaS services over public internet or privately, and secure the Distributed Cloud Site using network policies, service policies, and application firewall.
Prerequisites
-
Distributed Cloud Console SaaS account.
Note: If you do not have an account, see Create an Account.
-
Amazon Web Services (AWS) account.
Note: This is required to deploy a Site.
-
Intel NUC as commodity device with at least 4 VCPU and 8G memory.
Note: See Hardware Installation.
-
Distributed Cloud vesctl utility.
Note: See vesctl for more information.
-
Docker.
-
The balenaEtcher software to flash the F5 Distributed Cloud Services software image on to a USB drive.
-
A secret and policy document for encrypting your certificates and secrets using F5 Distributed Cloud Blindfold.
Note: See Blindfold for more information.
-
Self-signed or CA-signed certificate for your application domain.
Configuration
The use case provided in this guide sets up a Site on a commodity edge device and adds it to a fleet. The Site is then connected to cloud or SaaS services and secured using the Disitributed Cloud security features.
The following list outlines the sequence of activities performed for this use case:
-
Distributed Cloud Services software is installed on the edge device and registered on F5 Distributed Cloud Console.
-
A fleet is created with the required network configurations, and a fleet label is applied to the Site to make it part of the fleet.
-
The edge Site is connected to cloud or SaaS services over public internet in the
Default Gateway SNAT Mode
orForward Proxy Mode
. The step also shows how to privately connect the edge Site to cloud apps, without exposing communication to the internet. -
Network policy to allowlist access to specific IP addresses and service policy to allowlist or denylist access to specific URLs is configured. Also, the application firewall is applied to block sophisticated application layer attacks such as the SQL injection attack.
The use case for this document assumes that an application called as Hipster Webapp is deployed in an AWS EKS in Amazon VPC. Also, a Distributed Cloud Mesh node is deployed in the same VPC with the Site name as hipster-webapp-west
. The K8s namespace name is hipster
.
The application consists of the following services:
- frontend
- cartservice
- productcatalogservice
- currencyservice
- paymentservice
- shippingservice
- emailservice
- checkoutservice
- recommendationservice
- adservice
- cache
Note: Ensure that you keep the Amazon Elastic IP VIPs ready for later use in configuration.
Step 1: Provision
The following video shows the Site provisioning workflow:
You can use any of the supported hardware devices. However, in case of F5 Volterra IGW or ISV devices, the software is pre-installed, and you can power on, connect through Ethernet or Wi-Fi, and perform registration.
Perform the following steps to provision the Site on the commodity device:
Step 1.1: Download the Distributed Cloud Services software image.
Download the certified hardware image from the Certified Images page.
Step 1.2: Create a site token.
Log into Distributed Cloud Console and create a site token as per the instructions in the Site Management guides.
Note: You can also use an existing site token. In case you do not have any token, create one for using later for registration.
Step 1.3: Install the software on the device.
-
Install the Distributed Cloud Services software using the downloaded image on the commodity device as per the instructions in the Install Distributed Cloud Node guide.
-
Log into your device terminal and perform initial configuration. Initial configuration includes setting site token, cluster name, and set default values for rest of the options such as network configuration.
Step 1.4: Perform Site registration.
-
Log into Console and select the
Multi-Cloud Network Connect
service. -
Select
Manage
from the configuration menu andSite Management
->Registrations
in the options. -
Click
Pending Registrations
tab and find the registration request for your device. ClickApprove
. -
Click
Accept
to confirm.
Note: Check for your device status in the
Other Registrations
tab. TheONLINE
status indicates that the Site is provisioned and ready to use.
Step 1.5: Deploy web application and node in the Amazon VPC.
Perform the steps mentioned in the Step 1: Deploy Site chapter of the Secure Kubernetes Gateway guide to deploy the web application.
Note: This step performs automatic Site registration.
Step 2: Define
Create a fleet of Sites with inside and outside network configuration and add the Site created in the previous chapter to this fleet.
The following video shows the fleet configuration and Site inclusion workflow:
Perform the following steps to configure the fleet and add site to it:
Step 2.1: Log into Console and create network configuration required for fleet.
Create virtual networks and network interfaces for the inside and outside networks. Also, create a network connector for connecting inside network with outside network.
Step 2.1.1: Create outside and inside networks.
- Select
Manage
in the configuration menu andNetworking
->Virtual Networks
in the options. ClickAdd virtual network
. - Enter a name for your network and select
Site Local Network
for theNetwork Type
field. - Click
Add subnet
, enter an IP address for thePrefix
field, and enter prefix length for thePrefix Length
field. ClickApply
to add subnet. - Click
Add virtual network
to create the virtual network.
Figure: Virtual Network Creation
- Repeat the above steps to create another network with the
Network Type
asSite Local Inside Network
.
Step 2.1.2: Create outside and inside network interfaces.
- Select
Manage
in the configuration menu andNetworking
->Network Interfaces
in the options. ClickAdd network interface
. - Enter a name for your network interface, set
Ethernet
for theType
field, and seteth0
for theDevice Name
field. - Click
Select Virtual Network
, select the outside network created in the previous step and clickSelect Virtual Network
to apply the virtual network. - Select
Enable
for theEnable DHCP Client
field. - Select
Disable DHCP Server
for theEnable DHCP Server
field. - Click
Add network interface
to complete creating the network interface.
Figure: Network Interface Creation
- Repeat the above steps to create another network interface with the following configuration:
- Set
Ethernet
for theType
field and seteth1
for theDevice Name
field. - Click
Select Virtual Network
, select the inside network created in the previous step and clickSelect Virtual Network
to apply the virtual network. - Select
Disable
for theEnable DHCP Client
field. - Select
Enable DHCP Server
for theEnable DHCP Server
field.
- Set
Step 2.1.3: Create network connector.
- Select
Manage
in the configuration menu andNetworking
->Network Connectors
in the options. ClickAdd network connector
. - Enter a name for your network and select
Default Gateway Snat
for theNetwork Connector Type
field. - Select
Site Local Network
for theOutside Virtual Network Type
field. - Click
Select outside network
and select the outside network created in Step 2.1.1. - Select
Site Local Inside Network
for theInside Virtual Network Type
field. - Click
Select inside network
and select the inside network in Step 2.1.1. - Click
Add network connector
to complete creating the network connector.
Figure: Network Connector Creation
Step 2.2: Start creating a fleet.
- Navigate to the
Manage
in the configuration menu andFleets
in the options. ClickAdd fleet
to load fleet creation form. - Enter a name for your fleet and set a label in the
Fleet Label Value
field.
Figure: Fleet Basic Configuration
Step 2.3: Configure network settings.
Step 2.3.1: Add outside and inside network interfaces to the fleet.
- Click
Add device
and set a name for theDevice Name
field. - Select
Owner VER
andNetworking Device
for theDevice Owner
andDevice Instance
fields respectively. - Click
Select Interface
and select the outside network interface created in Step 2.1.2. - Select
Outside Interface
for theUse
field and clickApply
to add the device to fleet.
Figure: Fleet Network Interface Configuration
- Repeat the above steps to add the inside network interface created in Step 2.1.2. Select
Inside Interface
for theUse
field.
Step 2.3.2: Add network connector to the fleet.
Click Select network connector
and add the network connector created in Step 2.1.3.
Step 2.4: Complete fleet creation.
Click Add fleet
to complete fleet creation.
Step 2.5: Add Site to the fleet.
- Select
Sites
from configuration menu andSite List
from options. Click...
->Edit
to open Site edit form. - Click in the
Labels
field and selectves.io/fleet
as the label. Select the value as the label of the fleet you created in Step 2.2.
Figure: Add Fleet Label to Site
- Click
Save changes
to add your Site to the fleet.
Step 3: Connect
Connect privately to cloud application that is not exposed on public internet. This use case has the cloud app, hipster-shop that is already deployed in AWS EKS. The users on the edge Site need to reach frontend service over a private connection without exposing frontend to the internet. This is achieved by deploying a Mesh node in the same VPC where the hipster-shop is deployed, setting up service discovery, and configuring load balancer for the frontend service.
Note: This chapter provides the details for configuring the required components for the load balancer. For detailed instructions on creation of virtual host, see Virtual Hosts.
The following video shows the service discovery and load balancer creation workflow:
Perform the following to configure service discovery and load balancer:
Step 3.1: Log into Console and update proxy mode for network connector.
- Select
Manage
in the configuration menu andNetworking
->Network Connectors
in the options. Find the network connector created and click...
->Edit
. - Scroll down to the
Proxy Type
field and selectForward Proxy
. - Click
Save changes
.
Step 3.2: Configure service discovery for the webapp deployed in the Amazon VPC.
Select Manage
in the configuration menu and Site Management
-> Discovery
in options. Click Add discovery
and enter the configuration as per the following guidelines:
- Enter a name in the
Name
field. - Select
Virtual Site
for theWhere
field. - Click
Select ref
, selecthipster-webapp-west
as the Site, and clickSelect ref
. - Select
Site Local Network
for theNetwork Type
field. - Select
Kubernetes
for theType
field. - Select
K8s
for theDiscovery Service Access Information
field and selectKubeconfig
for theOneoff
field.
Figure: Service Discovery Configuration
- Encrypt Kubeconfig file for your EKS cluster using the F5 Distributed Cloud Blindfold:
vesctl request secrets encrypt --policy-document <policy-doc> --public-key <public-key> hipster-app-kubeconfig > hipster-app-bf-secret
- Click
Kubeconfig
and enter the configuration as per the following guidelines:- Select
Blindfold
for theSecret info
field. - Enter the encrypted secret in the
Location
field. - Select
EncodingNone
forSecret Encoding
field.
- Select
Figure: Service Discovery Secret Configuration
- Select
Apply
andAdd discovery
to create discovery object.
Step 3.3: Change to the hipster-webapp
namespace and create endpoint.
Select Manage
->Endpoints
. Click Add endpoint
and enter the configuration as per the following guidelines:
- Enter a name in the
Name
field. - Enter
Site
for theWhere
field and selecthipster-webapp-west
for theSelect ref
field. - Select
Site Local Network
for the network type. - Select
Service Selector Info
forEndpoint Specifier
field. - Select
Kubernetes
for theDiscovery
field andService Name
for theService
field. - Enter
frontend.hipster
as the service name. Herehipster
is the K8s namespace name. - Select
TCP
as the protocol. - Enter 80 for the
Port
field. - Click
Add endpoint
to create endpoint.
Step 3.4: Create healthcheck.
Select Manage
->Healthcheck
. Click Add healthcheck
and enter the configuration as per the following guidelines:
- Enter a name in the
Name
field. - Select
HTTP Healthcheck
theHealth check
field. - Enter
/
for path - Enter
5
forTimeout
andInterval
fields. This sets timeout and interval as 5 seconds for health check. - Enter
3
and1
for Unhealthy Threshold and Healthy Threshold fields. - Click
Add healthchcek
.
Step 3.5: Create cluster.
Select Manage
->Clusters
. Click Add cluster
and enter the configuration as per the following guidelines:
- Enter a name in the
Name
field. - Select the endpoint created for the
Select endpoint
field. - Select the healthcheck object created for the
Select healthcheck
field. - Select
Round Robin
for theLoadBalancer Algorithm
field. - Click
Add cluster
.
Step 3.6: Add route towards the created cluster.
Select Manage
-> Routes
. Enter a name and click Add route
. Enter the configuration as per the following guidelines:
- Click
Add match
. SelectANY
for theHTTP Method
field andRegex
for thePath Match
field. Enter(.*?)
for theRegex
field and clickAdd match
. - Select
Destination List
for theRoute action
field and clickAdd destination
. ClickSelect cluster
and select the cluster object created. ClickSelect cluster
andAdd destination
to add the cluster. - Click
Add route
to create the route.
Step 3.7:Add advertise policy.
- Select
Manage
->Advertise Policies
. ClickAdd advertise policy
and selectSite
for theWhere
field - Click
Select ref
and select the Site created in the Step 1: Provision chapter. - Select
TCP
as the protocol and443
as the port. - Click
Add advertise policy
to complete creating the advertise policy.
Step 3.8: Encrypt the private key of the certificate using the Distributed Cloud Blindfold.
Use the public key and policy document obtained. This example shows the sample of generating a secret for your application domain. Store the output to a file.
vesctl request secrets encrypt --policy-document secure-kgw-demo-policy-doc --public-key hipster-co-public-key tls.key > tls.key.secret
Note: The
tls.key
is the private key of the certificate you generated.
Step 3.9: Add a virtual host.
Select Manage
-> Virtual Hosts
. Click Add virtual host
and set the configuration as per the following guidelines:
- Enter name, application domain, and your proxy type. This sample uses
HTTPS_PROXY
as the proxy type andhello-web-4.helloclouds.app
as the domain. - Select previously defined route.
- Select previously created advertise policy.
- Click
TLS Parameters
and clickAdd TLS certificate
in the TLS configuration form.- Generate Base64 string of your certificate and enter it in the
string:///
format in theCertificate URL
field. You can use theecho <certficiate> |base64
command.
- Generate Base64 string of your certificate and enter it in the
- Click
Private key
and selectSecret info
asBlindfold secret
and enter the secret in theLocation
field. SelectSecret Encoding
asEncodingNone
. ClickApply
andAdd virtual host
.
Note: Use the secret created in previous step.
Step 4: Secure
Securing the ingress and egress traffic requires you to set the network policies, service policies, WAF, and network firewall.
The following video shows the workflow of securing the ingress and egress:
This example sets policies that allow egress traffic to github.com
, block traffic to origin IP 8.8.8.8/32
, and block egress traffic to some identified malicious domains. It also enables the WAF to block malicious ingress attacks such as SQL injection traffic.
Step 4.1: Create network policy.
-
Change to the
system
namespace and selectSecurity
->Firewall
->Network Policies
. ClickAdd network policy
. -
Set a name for the policy and select
Endpoints Reachable via all Outside Interfaces
in theSelect Endpoint
field ofAttachment
section. This makes the policy apply to all endpoints.
Figure: Network Policy Endpoint Configuration
-
Click
Configure
in theEgress
section and configure egress rules as per the following guidelines:- Select
Deny
for theAction
field. - Select
IPv4 Prefix List
for theSelect Other Endpoint
field. - Set 8.8.8.8/32 for the
IPv4 Prefix List
field. - Enter a name for the
Rule Name
field and clickApply
.
- Select
Figure: Network Policy Egress Rule
- Click
Continue
to create the network policy.
Step 4.2: Create forward proxy policies.
Navigate to Security
-> Firewall
->Forward Proxy Policy
.
Step 4.2.1: Create a forward proxy policy to allow access to GitHub.
Click Add forward proxy policy
and enter the following configuration:
- Set a name for the policy.
- Select
All Proxies on Site
for theSelect Forward Proxy
field in theProxy
section. - Select
Allowed Connections
in theSelect Policy Rules
section and clickConfigure
under theTLS Domains
field.
Figure: Forward Proxy Policy Rule Configuration
- Click
Add item
in theTLS Domains
screen and entergithub.com
in theExact Value
field. You can changeEnter Domain
field to exact value or suffix value or regex values. However, the default is exact value.
Figure: Forward Proxy Policy TLS Domain Configuration
- Click
Apply
to add the TLS domain to the forward proxy policy configuration. - Click
Continue
to complete creating the forward proxy.
Step 4.2.2: Create another forward proxy policy to block access to malicious sites of your choice.
- Set a name for the policy.
- Select
All Proxies on Site
for theSelect Forward Proxy
field in theProxy
section. - Select
Denied Connections
in theSelect Policy Rules
section. - Click
Configure
for theTLS Domains
field, clickAdd item
in the TLS domains screen, and select a value for theEnter Domain
field. - Enter a domain as per your domain type selection and click
Apply
. This example setting suffix value.
Figure: Forward Proxy Policy TLS Deny Configuration
- Similarly click
Configure
for theHTTP URLs
field and add URLS of the Sites to which access is to be blocked and clickApply
. This example shows sample Sites that are blocked.
Figure: Forward Proxy Policy HTTP Deny Configuration
- Click
Continue
to complete creating the forward proxy policy.
Step 4.3: Create network firewall.
Select Security
-> Firewall
-> Network Firewall
. Click Add network firewall
and set the following configuration:
- Set a name for the firewall.
- Select
Active Forward Proxy Policies
for theSelect Forward Policy Configuration
field in theForward Proxy Policy
section. - Select the deny policy created in the previous step for the
Forward Proxy Policies
field. - Click
Add item
and add the GitHub allow policy. - Select
Active Network Policies
for theSelect Network Policy Configuration
field in theNetwork Policy
section. - Select the deny policy for IP 8.8.8.8/32 created in the previous step for the
Network Policies
field.
Figure: Network Firewall Configuration
- Click
Continue
to complete creating network firewall.
Step 4.4: Apply the network firewall to the fleet.
Select Manage
-> Site Management
->Fleets
and find your fleet from the displayed list. Click ...
-> Edit
to open the fleet edit form. Click Select network firewall
and select the firewall created in the previous step. Click Save changes
to apply the network firewall to the fleet of Sites.
Figure: Network Firewall Addition to Fleet
Note: After adding the network firewall to the fleet, any updates to the network policy or forward proxy policy are applied to all Sites that are part of that fleet.
Step 4.4: Create a WAF and apply it to virtual host.
Change to your application namespace and create WAF.
- Navigate to
Security
->App Firewall
->App Firewall
. ClickAdd firewall
. - Enter a name and select
BLOCK
for theMode
field. - Click
Add firewall
to complete creating the WAF.
Figure: WAF Creation
Navigate to your virtual host and apply the WAF.
- Navigate to
Manage
->Virtual Hosts
. Find your virtual host from the displayed list and click...
->Edit
to open the virtual host edit form. - Scroll down and click
WAF Config
to open the WAF configuration form. - Select
WAF
for theWAF Config
field. ClickSelect WAF
, select the created WAF, and clickApply
. - Click
Save changes
to apply WAF to virtual host configuration.
Figure: Apply WAF to Virtual Host
Verification
The applied security policies block egress traffic towards 8.8.8.8/32 and also towards malicious URLs as per the configuration. Also, traffic towards GitHub is allowed. You can also inspect the virtual host and site monitoring for requests and alerts:
Perform the following to verify this:
Step 1: Verify if the requests to github.com are allowed and requests to the blocked sites are rejected.
- Use curl from command line or browser to load github.com and GitHub should be allowed.
- Use curl from command line or browser to load the URLs you configured to block in the forward proxy deny policy. The requests should be rejected.
- Enter
ping 8.8.8.8/32
from the command line and this should be unsuccessful.
Step 2: Verify the requests in the site dashboard
- Navigate to
Sites
->Site List
and click on your site to open its dashboard. - Click on the
Requests
tab and check the sample requests. Your requests to the blocked sites are displayed along with the HTTP return code.
Figure: Sampled Site Requests
Step 3: Verify alerts related to your site
- Change to
system
namespace and navigate toNotifications
->Alerts
. By default, active alerts are displayed for all sites. Filter the alerts for your site by entering your site name in theSearch
field. - Switch to all alerts using the
All
option. All alerts for your site are displayed.
Figure: Site Alerts
Note: You can also post your alerts to a 3rd party monitoring system or communication platform such as OpsGenie or Slack. For more information, see Alerting.