Cloud resource audit for Google Cloud Platform VPC Network architecture,
firewall posture, and connectivity. This skill evaluates provider-specific
GCP networking constructs — global VPC Network design, firewall rule
priority evaluation, hierarchical firewall policies, Cloud NAT egress
control, Cloud Interconnect VLAN attachments, Shared VPC host/service
project topology, and Cloud Router BGP sessions — not generic cloud
networking advice.
Scope: auto-mode versus custom-mode VPC Networks, subnet IP ranges,
firewall rules with target tags and service accounts, Cloud NAT port
allocation, Cloud Interconnect and Cloud VPN connectivity, Shared VPC
cross-project networking, Cloud Router dynamic routing. Out of scope:
Cloud CDN, Cloud Armor WAF, load balancer URL maps, Cloud DNS.
Reference references/cli-reference.md for read-only gcloud commands
and references/vpc-architecture.md for the GCP global VPC model and
firewall rule evaluation order.
gcloud auth list shows active account)compute.networks.get, compute.firewalls.list, compute.routers.get, compute.interconnects.get, compute.subnetworks.list, compute.addresses.list. Shared VPC: Viewer on host and service projects. Hierarchical firewall policies: compute.firewallPolicies.get at org/folder levelFollow these six steps sequentially. Each builds on prior findings,
moving from inventory through security analysis to optimization.
Enumerate all VPC Networks in the target project and assess design.
gcloud compute networks list --project <project-id>
gcloud compute networks describe <network-name> --project <project-id>
gcloud compute networks subnets list --network <network-name>
For each VPC Network, evaluate:
Audit VPC Network firewall rules using GCP's priority-based evaluation and hierarchical firewall policies.
gcloud compute firewall-rules list --filter="network:<network-name>"
gcloud compute firewall-rules describe <rule-name>
gcloud compute firewall-rules list but active. Custom rules at 0–65534 override them.0.0.0.0/0. SSH/RDP from 0.0.0.0/0 is Critical. Verify broad ranges are justified.default VPC Network includes pre-created rules allowing ICMP, SSH, RDP, and internal traffic. Audit these permissive rules.Hierarchical firewall policies:
gcloud compute firewall-policies list --organization <org-id>
gcloud compute firewall-policies describe <policy-name>
gcloud compute firewall-policies rules list --firewall-policy <policy-name>
Hierarchical firewall policies apply at organization or folder level and evaluate before VPC Network firewall rules. A deny in a hierarchical policy blocks traffic regardless of VPC-level allows. A goto_next action delegates to VPC-level rules. Verify hierarchical policies enforce org-wide baselines (e.g., block SSH from internet).
Audit Cloud NAT gateways for egress capacity, port allocation, and logging.
gcloud compute routers nats list --router <router-name> --region <region>
gcloud compute routers nats describe <nat-name> --router <router-name> --region <region>
Cloud NAT provides outbound internet access for VMs without external IPs, configured on a Cloud Router.
minPortsPerVm/maxPortsPerVm. High-connection workloads need increased allocations. Enable Dynamic Port Allocation for bursty workloads.logConfig.enable. Options: ERRORS_ONLY, TRANSLATIONS_AND_ERRORS (recommended), ALL. Missing NAT logging reduces egress visibility.Evaluate hybrid and cross-project connectivity via Cloud Interconnect, Cloud VPN, and Shared VPC.
Cloud Interconnect:
gcloud compute interconnects list
gcloud compute interconnects describe <interconnect-name>
gcloud compute interconnects attachments list --region <region>
gcloud compute interconnects attachments describe <attachment-name> --region <region>
state: ACTIVE and operationalStatus: OS_ACTIVE. UNPROVISIONED_ATTACHMENT means partner provisioning incomplete. OS_LACP_DOWN indicates link aggregation failure.UP is healthy, DOWN indicates ASN mismatch, authentication failure, or network issue. Verify primary and redundant sessions.Cloud VPN:
gcloud compute vpn-tunnels list
gcloud compute vpn-tunnels describe <tunnel-name> --region <region>
gcloud compute vpn-gateways list
status: ESTABLISHED. FIRST_HANDSHAKE indicates IKE negotiation in progress. NO_INCOMING_PACKETS suggests on-premises misconfiguration.Shared VPC:
gcloud compute shared-vpc get-host-project <service-project-id>
gcloud compute shared-vpc list-associated-resources <host-project-id>
gcloud compute networks subnets get-iam-policy <subnet> --region <region> --project <host-project>
compute.networkUser role. Verify service accounts access only intended subnets.Audit Cloud Router configuration for route advertisements, BGP settings, and dynamic routing mode.
gcloud compute routers list --project <project-id>
gcloud compute routers describe <router-name> --region <region>
gcloud compute routers get-status <router-name> --region <region>
regional or global. Regional: Cloud Routers advertise/learn routes only within their region. Global: routes propagate across all regions. Multi-region workloads accessing on-premises via single-region Cloud Interconnect require global mode.get-status learned routes and AS paths. Unexpected paths indicate route leaks or suboptimal selection.get-status for count versus limits.Compile findings and identify optimization opportunities.
gcloud compute addresses list --filter="status=RESERVED" --project <project-id>
gcloud compute instances list --filter="networkInterfaces[].accessConfigs[].natIP:*"
gcloud compute firewall-rules list --filter="disabled=true"
Compile the findings report using the Report Template section.
| Finding | Severity | Rationale |
|---|---|---|
| --------- | ---------- | ----------- |
| Firewall rule allows SSH (22) from 0.0.0.0/0 | Critical | Shell access from internet |
| Firewall rule allows RDP (3389) from 0.0.0.0/0 | Critical | Remote desktop from internet |
| Firewall rule allows all ports from 0.0.0.0/0 | Critical | No port restriction on ingress |
| Target tag on sensitive workload instead of service account | High | Tags mutable by project editors |
| Hierarchical firewall policy missing at org level | High | No organization-wide baseline |
| VPC Flow Logs disabled on production subnet | High | No traffic visibility |
| Firewall rule with priority 0 | High | Audit for broad scope |
| Disabled firewall rule undocumented | Medium | Audit confusion risk |
| Auto-mode VPC Network in production | Medium | Uncontrolled IP allocation |
| Firewall rule with >20 source ranges | Medium | Excessive complexity |
| Metric | Severity | Action |
|---|---|---|
| -------- | ---------- | -------- |
| VLAN attachment state not ACTIVE | Critical | No traffic flow — engage provider |
| BGP session DOWN | High | Check ASN, authentication, link |
| Single edge availability domain | High | No redundancy — add second |
| Learned route count >80% limit | Medium | Approaching route capacity |
| Available Ports (%) | Severity | Action |
|---|---|---|
| --------------------- | ---------- | -------- |
| <10% | Critical | Connection drops — increase allocation |
| 10–25% | High | Enable Dynamic Port Allocation |
| 25–50% | Medium | Monitor trend |
| >50% | Low | Healthy |
Firewall rule under review
├── Source range is 0.0.0.0/0?
│ ├── Yes
│ │ ├── Port = 22 (SSH) or 3389 (RDP)?
│ │ │ ├── Yes → CRITICAL: Use IAP tunnel instead
│ │ │ └── No
│ │ │ ├── Port = 443 on load balancer backend?
│ │ │ │ ├── Yes → Acceptable for public services
│ │ │ │ └── No → HIGH: Review necessity
│ │ │ └── All ports (all protocols)?
│ │ │ └── CRITICAL: Unrestricted ingress
│ │ └── Is rule disabled?
│ │ ├── Yes → LOW: Verify it should remain disabled
│ │ └── No → Classify severity by port scope
│ └── No (specific CIDR or service account source)
│ ├── Target uses service account? → Stronger binding
│ └── Target uses network tag?
│ ├── Tag on sensitive workload? → MEDIUM: Migrate to service account
│ └── Tag on dev/test? → LOW: Acceptable
VPC Network under review
├── Custom-mode?
│ ├── No (auto-mode) → MEDIUM for production
│ └── Yes
│ ├── Subnets in required regions? → Verify
│ ├── VPC Flow Logs on production subnets?
│ │ ├── No → HIGH: No traffic visibility
│ │ └── Yes → Check aggregation and sampling
│ └── Private Google Access?
│ ├── No → MEDIUM: Internal VMs cannot reach APIs
│ └── Yes → Good
├── Shared VPC?
│ ├── Yes → Audit host designation, subnet IAM, associations
│ └── No → OK for single-project
├── Hierarchical firewall policy?
│ ├── No → HIGH: No org-wide baseline
│ └── Yes → Audit goto_next vs deny
└── Dynamic routing mode?
├── Regional + multi-region → Switch to global
└── Global → Verify cross-region propagation
GCP VPC NETWORK AUDIT REPORT
================================
Project: [project-id] ([project-name])
Organization: [org-id or N/A]
VPC Network: [network-name]
Routing Mode: [regional/global]
Network Type: [auto-mode/custom-mode]
Audit Date: [timestamp]
Performed By: [operator/agent]
VPC NETWORK ARCHITECTURE:
Subnets: [total] across [n] regions
Type: [auto-mode/custom-mode]
Private Google Access: [enabled on n/total subnets]
VPC Flow Logs: [enabled on n/total subnets]
FIREWALL RULES:
Total: [n] | With 0.0.0.0/0 ingress: [n] | Disabled: [n]
Target type: tag-based:[n] service-account:[n] all-instances:[n]
Hierarchical policies: [n at org] [n at folder]
CLOUD NAT:
Gateways: [n] | Covered subnets: [n]
IP allocation: [automatic/manual] | Port min: [n]
NAT logging: [enabled/disabled]
CONNECTIVITY:
Cloud Interconnect: [n attachments] | BGP: [UP/DOWN]
Cloud VPN: [n tunnels] | Status: [ESTABLISHED/other]
Shared VPC: [host-project or N/A] | Service projects: [n]
CLOUD ROUTER:
Routers: [n] | Dynamic mode: [regional/global]
Custom advertisements: [yes/no]
Graceful restart: [enabled/disabled]
Learned routes: [n] / [limit]
OPTIMIZATION:
Unused static IPs: [n] | Disabled firewall rules: [n]
Tag-based rules on sensitive workloads: [n]
Cloud NAT port utilization: [assessment]
FINDINGS:
1. [Severity] [Category] — [Description]
Resource: [resource-name] → Recommendation: [action]
RECOMMENDATIONS: [prioritized by severity]
NEXT AUDIT: [CRITICAL: 30d, HIGH: 90d, clean: 180d]
VPC Flow Logs in GCP are subnet-level, not VPC-level. Each subnet must
be individually enabled. Enabling is non-disruptive. Missing VPC Flow
Logs on production subnets is a High finding.
Verify the target: if using a target tag, confirm the tag is on the VM
(tags are case-sensitive). If using a service account target, verify the
VM runs with that account. Firewall rules with no target apply to all
VMs in the VPC Network.
Check state and operationalStatus. UNPROVISIONED_ATTACHMENT means
partner provisioning incomplete. OS_LACP_DOWN indicates Layer 2
failure. Verify Cloud Router BGP session has correct ASN and IP pair.
Verify the deploying service account has compute.networkUser on the
specific subnet in the host project. Subnet-level IAM is required even
if the service project is associated with the host project.
Check Cloud Logging with resource.type="gce_router". Common causes:
on-premises router exceeding learned route limit, authentication key
mismatch, or MTU issues on the Cloud Interconnect link. Enable graceful
restart to preserve forwarding during brief flaps.
共 1 个版本