implementing-gcp-vpc-firewall-rules

Implement and audit GCP VPC firewall rules for network segmentation and egress control.

954|172|Updated Mar 13, 2026
One-click install
npx skills add https://github.com/xalgord/xalgorix --skill implementing-gcp-vpc-firewall-rules
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: implementing-gcp-vpc-firewall-rules
Source: https://github.com/xalgord/xalgorix/tree/main/internal/tools/skills/data/cloud-security/implementing-gcp-vpc-firewall-rules
Command: npx skills add https://github.com/xalgord/xalgorix --skill implementing-gcp-vpc-firewall-rules

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

GCP environments often accumulate overly permissive firewall rules, such as SSH open to 0.0.0.0/0 or unrestricted egress, which expose workloads to attack and data exfiltration. This Skill provides a structured workflow to audit existing rules, implement least-privilege ingress and egress controls, deploy hierarchical firewall policies, and validate enforcement with VPC Flow Logs.

Core Features & Use Cases

  • Firewall Rule Auditing: Enumerate rules and detect risky configurations like internet-open SSH/RDP, allow-all protocols, disabled rules, and shadowed deny rules.
  • Least-Privilege Rule Creation: Build targeted ingress rules using network tags and service accounts, plus default-deny egress with explicit allow rules for DNS, Google APIs, and partner CIDRs.
  • Hierarchical Policies & Monitoring: Deploy organization-level firewall policies and enable VPC Flow Logs with Cloud Logging queries to verify which rules actually match traffic.
  • Use Case: After Security Command Center flags 14 firewall findings in a production VPC, use this Skill to baseline traffic with flow logs, replace default-allow rules with tier-specific rules, and add a default-deny egress policy without causing outages.

Quick Start

Audit my GCP project's firewall rules for overly permissive ingress and help me replace them with least-privilege rules and a default-deny egress policy.

Frequently Asked Questions about implementing-gcp-vpc-firewall-rules

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find overly permissive GCP firewall rules?

Use gcloud compute firewall-rules list with filters for direction=INGRESS and sourceRanges=0.0.0.0/0 to find internet-open rules. Also check for rules allowing all protocols, SSH or RDP open to the internet, and disabled rules that enforce nothing.

How do I restrict egress traffic in a GCP VPC?

Create a deny-all egress rule at priority 65534, then add explicit allow rules at higher priority for required destinations like Google APIs restricted VIP, DNS resolvers, and specific partner CIDRs. GCP's implied rule allows all egress by default, so explicit denies are required.

Should I use network tags or service accounts in GCP firewall rules?

Service accounts are more secure for critical rules because network tags can be attached by anyone with compute.instances.setTags permission. Use --source-service-accounts and --target-service-accounts for sensitive paths, reserving tags for lower-risk targeting.

Why is my new GCP firewall deny rule not taking effect?

GCP evaluates rules by lowest priority number first, so a default-allow rule at a lower priority number overrides your new deny rule. List rules sorted by priority, then delete or reprioritize legacy default-allow rules after validating traffic with flow logs.

When should I not use VPC firewall rules in GCP?

VPC firewall rules do not provide application-layer filtering; use Cloud Armor WAF for L7 inspection and Cloud DNS response policies for DNS-based filtering. They also operate at the network level within the VPC, not as a substitute for identity-aware access controls.