Skip to main content

More Info:

Ensure legacy networks do not exist for a project.

Risk Level

Medium

Address

Security

Compliance Standards

CISGCP, CBP

Triage and Remediation

Remediation

Using Console

To remediate the misconfiguration “Legacy Networks Should Not Be Used” in GCP using GCP console, follow the below steps:
  1. Open the GCP console and go to the VPC networks page.
  2. Select the legacy network that you want to remediate.
  3. In the top menu, click “Delete”.
  4. Review the list of resources that will be deleted with the legacy network. If you are sure you want to delete the legacy network and all its resources, click “Delete”.
  5. Repeat this process for all legacy networks in your GCP project.
Alternatively, you can create a new VPC network and migrate your resources to it. To do so, follow the below steps:
  1. Open the GCP console and go to the VPC networks page.
  2. Click “Create VPC network”.
  3. Enter a name for the new VPC network.
  4. Choose a subnet mode and specify the IP range for the new VPC network.
  5. Click “Create”.
  6. Migrate your resources to the new VPC network by updating their network settings to use the new VPC network.
Note: Before deleting a legacy network, make sure that all resources that depend on it have been migrated to the new VPC network.

To remediate the “Legacy Networks Should Not Be Used” misconfiguration in GCP using GCP CLI, follow these steps:
  1. Open the GCP Cloud Shell by clicking on the Activate Cloud Shell button on the top right corner of the GCP Console.
  2. Run the following command to list all the VPC networks in your project:
  3. Identify the legacy network(s) in the list. Legacy networks are identified by the “LEGACY” network type.
  4. Delete the legacy network(s) using the following command:
    Replace [LEGACY_NETWORK_NAME] with the name of the legacy network you want to delete.
  5. Confirm the deletion by typing “y” when prompted.
Note: Deleting a VPC network deletes all the subnets, routes, and firewall rules associated with the network. Therefore, make sure to review the network configuration and any dependencies before deleting it.
To remediate the misconfiguration “Legacy Networks Should Not Be Used” in GCP using Python, you can follow the below steps:Step 1: Install the required packages:
Step 2: Authenticate with GCP using the below command:
Step 3: Write a Python script to remediate the misconfiguration:
Step 4: Replace “your-project-id” and “your-region” with your actual project ID and region where the legacy networks are located.Step 5: Run the Python script to delete all the legacy networks in the specified project and region.Note: Before deleting any network, make sure that it is not being used by any resources in your project.