Module 5: Network Egress Firewall
Security is important to every customer. The least privilege principle is a common security practice that limits an application’s access to only those resources it needs to operate. For example, if we know an application does not need access to the internet, we should create a policy to block that application’s access to the internet.
In the real world, customers will solve this challenge with outbound proxies/VLANs/firewalls, but those solutions can be expensive and complex to implement. Now we will show OpenShift Virtualization allows us to add an additional layer of security with just a few button clicks.
In this module, you will test blocking egress access from a Windows VM to the Internet with the built-in, cloud native features of OpenShift.
Access the Internet through a Windows VM console
-
Click VirtualMachines, click winweb01 then click the Console tab. You are already logged into the windows VM’s administrative interface.
-
Type 15 and hit Enter to start Powershell
-
Copy the following command and paste in the VM console with the special paste button. Click into the VM console and hit Enter. Notice that the connection succeeds with
StatusCode: 200
curl google.com -UseBasicParsing -TimeoutSec 1 | findstr StatusCode"
Implement a Network Policy to Block Egress
-
On the left side, click Networking → NetworkPolicies → Create NetworkPolicy.
-
Select the YAML View radio button.
-
Replace the sample YAML with the following NetworkPolicy.
kind: NetworkPolicy apiVersion: networking.k8s.io/v1 metadata: name: noegress namespace: windowsnetworking-sample_username spec: podSelector: matchLabels: app: winnetworking policyTypes: - Egress
-
Click Create when your console looks as follows.
Validate that Internet Access is Blocked from the Windows VM
-
Go back to the Powershell and test the network connection to the Internet. Click Virtualization → VirtualMachines → winweb01 → Console Click into the console and repeat the Internet access test. To run the same command again, press the Up Arrow and hit Enter