
Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Create a firewall rule
/ 25
Generate HTTP network traffic
/ 25
Createa a deny firewall rule
/ 25
Analyze the firewall logs
/ 25
The assets within a cloud environment need to be protected from unauthorized access. To address this, security professionals use perimeter protection which refers to the security measures implemented to defend the edge of a network or system against unauthorized access and cyber threats. One type of perimeter protection includes using firewalls to manage and secure network traffic entering and leaving a cloud environment. Firewalls help protect trusted internal networks (like a company's private network) from untrusted external networks (such as the Internet). Firewalls examine both incoming and outgoing network traffic based on predefined rules to either allow or block specific data packets. This is crucial for helping maintain application security, traffic control, compliance, and policy enforcement.
In this lab, you‘ll access a firewall and create rules to test the security of a server and make modifications as necessary.
Cymbal Bank has a demo web server that is provisioned on an existing Virtual Private Cloud (VPC) network. Your team lead, Chloe, is concerned about the security configurations of this web server and wants you to analyze the inbound network traffic to the web server and block connections to unnecessary ports using firewall rules. You have been tasked with analyzing the firewall rules for this web server and testing its connection. To complete this task, you will need to create several firewall rules, connect to the web server, and analyze the logs associated with the network connections.
Here’s how you'll do this task: First, you'll create a firewall rule to allow network traffic to the demo web server. Then, you’ll generate HTTP network traffic to the server and analyze its network logs. Next, you’ll create and test a new firewall rule to deny HTTP traffic to the server. Finally, you'll analyze the firewall logs to verify that the new firewall rule works as intended.
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.
This practical lab lets you do the activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
Click the Start Lab button. On the left is the Lab Details panel with the following:
Click Open Google Cloud console (or right-click and select Open Link in Incognito Window) if you are running the Chrome browser. The Sign in page opens in a new browser tab.
Tip: You can arrange the tabs in separate, side-by-side windows to easily switch between them.
If necessary, copy the Google Cloud username below and paste it into the Sign in dialog. Click Next.
You can also find the Google Cloud username in the Lab Details panel.
You can also find the Google Cloud password in the Lab Details panel.
After a few moments, the Console opens in this tab.
In this task, you'll create a firewall rule that allows HTTP and SSH connectivity. You will also specify a target tag for the newly created firewall rule.
In Google Cloud, firewall rules must specify targets to define which VM instances they apply to. Target tags can be used to apply a firewall rule to a specific group of VMs, helping simplify the management of firewall rules. You'll use target tags to enable this firewall rule to the web server only.
On the toolbar, click + Create Firewall Rule. The Create a firewall rule dialog displays.
Specify the following, and leave the remaining settings as their defaults:
Field | Value |
---|---|
Name | allow-http-ssh |
Logs | On |
Network | vpc-net |
Targets | Specified target tags |
Target tags | http-server |
Source filter | IPv4 ranges |
Source IPv4 ranges | 0.0.0.0/0 |
In the Protocols and ports section |
|
Click Check my progress to verify that you have completed this task correctly.
In this task, you'll generate HTTP network traffic to the web server by visiting its external IP address. The network traffic you generate will then be recorded as logs that you can analyze in the Logs Explorer.
First, you need to generate network traffic.
In the Google Cloud console, click the Navigation menu ().
Select Compute Engine > VM instances. The VM instances page opens.
For web-server, click on the External IP link to access the server.
(Alternatively, you can add the External IP value to http://EXTERNAL_IP/ in a new browser window or tab.) A default web page should display.
Next, you need to find the IP address of the computer you’re using.
Click Check my progress to verify that you have completed this task correctly.
In this task, you'll access and analyze the VPC Flow Logs for the web server using the Logs Explorer.
In the Google Cloud console, click the Navigation menu ().
Select Logging > Logs Explorer. The Logs Explorer page opens. (You may need to expand the More Products drop-down menu within the Navigation menu and locate Logging under Operations.)
On the left side of the Logs Explorer page, the Log fields pane is presented. The Resource type and Severity sections are available. Under the Resource type section, select Subnetwork.
Entries from the subnetwork logs will display on the Query results pane to the right of the Log fields pane.
Once selected, entries from the VPC Flow Logs display on the Query results pane.
In the Query builder at the top of the page, at the end of line 2, press ENTER to create a new line.
On line 3, enter the following:
Your query should resemble the following:
Replace YOUR_IP
with the IP address you saved from Task 2. This query will search for network traffic logs originating from your IP address that you had generated in the previous task.
Click Run query. The query results should display on the Query results pane.
In the Query results pane, expand one of the log entries.
Within the entry, expand jsonPayload by clicking the expand arrow >. Then, expand the connection field.
Here you can examine the details about the network connection to the web server:
After analyzing the details of this log entry, you should notice that the network traffic you generated (on HTTP port 80) was allowed due to the firewall rule allow-http-ssh you created previously. This rule allowed incoming traffic on ports 80 and 22.
In this task, you'll create a new firewall rule that denies traffic from port 80.
In the Google Cloud console, click the Navigation menu ().
Select VPC network > Firewall. The Firewall policies page displays.
On the toolbar, click + Create Firewall Rule.
In the Create a firewall rule dialog, specify the following, and leave the remaining settings as their defaults:
Field | Value |
---|---|
Name | deny-http |
Logs | On |
Network | vpc-net |
Action on match | Deny |
Targets | Specified target tags |
Target tags | http-server |
Source filter | IPv4 ranges |
Source IPv4 ranges | 0.0.0.0/0 |
In the Protocols and ports section |
|
Click Check my progress to verify that you have completed this task correctly.
In this task, you'll test the deny-http firewall rule that you created in the previous task.
First, attempt to connect to the web server.
The following error message should display on the page:
This error occurred because of the deny-http firewall rule you created in the previous task. To verify this, access the Logs Explorer to analyze the firewall logs for the web server.
In the Google Cloud console, click the Navigation menu ().
Select Logging > Logs Explorer. The Logs Explorer page opens. (You may need to expand the More Products drop-down menu within the Navigation menu and locate Logging under Operations.)
Under the Resource type section, select Subnetwork.
On the Log fields pane, in the Log name section, select compute.googleapis.com/firewall to access the firewall logs for the network.
In the Query builder at the top of the page, at the end of line 2, press ENTER to create a new line.
On line 3, enter the following:
Replace YOUR_IP
with the IP address you saved from Task 2. This query will search for firewall logs that denied your IP address connection to the web server. Your query should resemble the following:
Click Run query. The query results should display on the Query results pane.
In the Query results pane, expand one of the log entries.
Within the log entry, expand the jsonPayload field by clicking the expand arrow >. Then, expand the connection field. You can examine the details about the network connection to the web server to verify if the firewall rule was successfully triggered:
By examining the details of this firewall log entry, you should notice that the firewall rule deny-http you set up to deny HTTP traffic was successfully triggered. This rule denied incoming network traffic on port 80.
Click Check my progress to verify that you have completed this task correctly.
Great work!
You now have practical experience in creating and testing firewall rules for a web server in a cloud environment. By creating firewall rules and analyzing log entries, you have a familiarity with the intricacies of perimeter protection. This is useful for monitoring and analyzing potential security incidents or threats, which is an essential part of a security analyst's role.
You’re well on your way to understanding how to modify firewall rules to ensure maximum network security.
Before you end the lab, make sure you’re satisfied that you’ve completed all the tasks. When you're ready, click End Lab and then click Submit.
Ending the lab will remove your access to the lab environment, and you won’t be able to access the work you've completed in it again.
Copyright 2024 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
This content is not currently available
We will notify you via email when it becomes available
Great!
We will contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one