Build and Secure Networks in Google Cloud: Challenge Lab


Build and Secure Networks in Google Cloud: Challenge Lab





The challenge contains 6 required tasks:

  1. Remove the overly permissive rules
  2. Start the bastion host instance
  3. Create a firewall rule that allows SSH (tcp/22) from the IAP service and add a network tag on bastion
  4. Create a firewall rule that allows traffic on HTTP (tcp/80) to any address and add a network tag on juice-shop
  5. Create a firewall rule that allows traffic on SSH (tcp/22) from acme-mgmt-subnet network address and add a network tag on juice-shop
  6. SSH to bastion host via IAP and juice-shop via bastion

Let's do it one by one :))

1. Remove the overly permissive rules

This task is very simple. You only need to the open-access firewall rules.

  1. In the Cloud Console, navigate to Menu > VPC Network > Firewall
  2. Check the box next to the rule named open-access.
  3. Click on DELETE to remove it.
Remove open-access firewall rules on Google Cloud Platform☁ Build and Secure Networks in Google Cloud: Challenge Lab | logbook

2. Start the bastion host instance

  1. In the Cloud Console, navigate to Menu > Compute Engine > VM instances
  2. Check the box next to the instance named bastion.
  3. Click on Start to run the instance.

3. Create a firewall rule that allows SSH (tcp/22) from the IAP service and add network tag on bastion

Add network tag on bastion

  1. On the VM instances page, click on the name of the bastion instance.
  2. Click EDIT on the details page.
  3. Add bastion to the Network tags field.
  4. Scroll to the button of the page and click Save.

Create firewall rule to allow SSH from the IAP service

Read Using IAP for TCP forwarding in the Google Cloud Documentation before you create the firewall rule.

create a firewall rule to allow IAP to connect to your VM instances in Google Cloud Console☁ Build and Secure Networks in Google Cloud: Challenge Lab | logbook
  1. Go back to the Firewall Rules page, and click Create firewall rule.
  2. Configure the following settings:

    FieldValue
    Namee.g. allow-ssh-from-iap
    Direction of trafficIngress
    TargetsSpecified target tags
    Target tagsbastion
    Source IP ranges35.235.240.0/20
    Protocols and portsSelect TCP and enter 22 to allow SSH
Firewall rule settings for the secure remote ssh access via IAP-enabled bastion☁ Build and Secure Networks in Google Cloud: Challenge Lab | logbook

4. Create a firewall rule that allows traffic on HTTP (tcp/80) to any address and add network tag on juice-shop

Create firewall rule to allow HTTP traffic to juice-shop

  1. On the Firewall Rules page, and click Create firewall rule.
  2. Configure the following settings:

    FieldValue
    Namee.g. allow-http-ingress
    Direction of trafficIngress
    TargetsSpecified target tags
    Target tagsjuice-shop
    Source IP ranges0.0.0.0/0
    Protocols and portsSelect TCP and enter 80 to allow HTTP
Firewall rule settings for the juice-shop VM instance☁ Build and Secure Networks in Google Cloud: Challenge Lab | logbook

Add network tag on juice-shop

  1. On the VM instances page, click on the name of the juice-shop instance.
  2. Click EDIT on the details page.
  3. Add juice-shop to the Network tags field.
  4. Scroll to the button of the page and click Save.

5. Create a firewall rule that allows traffic on SSH (tcp/22) from acme-mgmt-subnet network address and add network tag on juice-shop

  1. Navigate to VPC network > VPC networks.
  2. Copy the IP address range of the acme-mgmt-subnet.
  3. Go back to the Firewall Rules page, and click Create firewall rule.
  4. Configure the following settings:

    FieldValue
    Namee.g. allow-ssh-from-mgmt-subnet
    Direction of trafficIngress
    TargetsSpecified target tags
    Target tagsbastion and juice-shop
    Source IP rangesIP address range of your aceme-mgmt-subnet
    Protocols and portsSelect TCP and enter 22 to allow SSH
Firewall rule settings for the SSH traffic from acme-mgmt-subnet☁ Build and Secure Networks in Google Cloud: Challenge Lab | logbook

6. SSH to bastion host via IAP and juice-shop via bastion

After configuring the firewall rules, try to verify the environment via the bastion.

  1. Navigate to Compute Engine > VM instances.
  2. Copy the Internal IP of the juice-shop instance.
  3. Click on the SSH button in the row of the bastion instance.
  4. In the SSH console, access the juice-shop from the bastion using the following command:

    ssh <internal-IP-of-juice-shop>
    

    (Remember to REPLACE <internal-IP-of-juice-shop> with the copied IP address)


Congratulations! You completed this challenge lab.