본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)35k · #8044

implementing-gcp-vpc-firewall-rules

하는 일

이 도구는 Google Cloud(GCP) 네트워크 방화벽 규칙을 설정하고 점검하도록 돕습니다. 허용된 트래픽만 네트워크에 들어오거나 나갈 수 있도록 하여 데이터를 안전하게 지킵니다.

사용하는 경우

  • ✓GCP에서 새 네트워크를 설정할 때.
  • ✓기존 보안 규칙을 검토할 때.
  • ✓무단 접근에 대한 보안 경고에 대응해야 하는 경우.

스킬 링크

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-gcp-vpc-firewall-rules/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-gcp-vpc-firewall-rules/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“'web-server' 태그가 붙은 서버에 특정 IP에서만 SSH 접근을 허용하는 규칙을 설정해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 도구는 Google Cloud 명령(gcloud)을 사용해 방화벽 규칙을 조회하고, 만들고, 변경합니다. 어떤 트래픽을 허용하거나 거부할지, 어디서 오고 어디로 가는지 정의할 수 있습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Implementing GCP VPC Firewall Rules

When to Use

  • When deploying new GCP workloads that require network-level access controls
  • When auditing existing firewall configurations for overly permissive rules
  • When implementing zero trust network segmentation within GCP VPC networks
  • When responding to Security Command Center findings about open firewall rules
  • When building hierarchical firewall policies across a GCP organization

Do not use for application-layer filtering (use Cloud Armor WAF), for DNS-based filtering (use Cloud DNS response policies), or for VPN/interconnect traffic filtering without understanding that VPC firewall rules apply to traffic within the VPC.

Prerequisites

  • GCP project with Compute Engine API enabled
  • IAM roles: roles/compute.securityAdmin for firewall management, roles/compute.networkViewer for auditing
  • Organization Admin role for hierarchical firewall policies
  • gcloud CLI authenticated with appropriate permissions
  • VPC Flow Logs enabled on target subnets for monitoring

Workflow

Step 1: Audit Existing Firewall Rules for Security Gaps

Enumerate all firewall rules and identify overly permissive configurations.

# List all firewall rules in the project
gcloud compute firewall-rules list \
  --format="table(name, network, direction, priority, allowed[].map().firewall_rule().list():label=ALLOWED, sourceRanges, targetTags)"

# Find rules allowing all traffic from 0.0.0.0/0
gcloud compute firewall-rules list \
  --filter="direction=INGRESS AND sourceRanges=0.0.0.0/0" \
  --format="table(name, network, allowed, priority, targetTags)" \
  --sort-by=priority

# Find rules allowing all protocols and ports
gcloud compute firewall-rules list \
  --filter="direction=INGRESS AND allowed[].IPProtocol=all" \
  --format="table(name, network, sourceRanges, targetTags)"

# Find rules with SSH (22) or RDP (3389) open to the internet
gcloud compute firewall-rules list \
  --filter="direction=INGRESS AND sourceRanges=0.0.0.0/0 AND (allowed[].ports=22 OR allowed[].ports=3389)" \
  --format="table(name, network, allowed, sourceRanges)"

# Check for disabled rules
gcloud compute firewall-rules list \
  --filter="disabled=true" \
  --format="table(name, network, direction)"

Step 2: Create Restrictive Ingress Firewall Rules

Implement least-privilege ingress rules using network tags and service accounts for targeting.

# Create rule allowing HTTPS from the internet to web servers only
gcloud compute firewall-rules create allow-https-web \
  --network=production-vpc \
  --direction=INGRESS \
  --action=ALLOW \
  --rules=tcp:443 \
  --source-ranges=0.0.0.0/0 \
  --target-tags=web-server \
  --priority=1000 \
  --description="Allow HTTPS to web servers from internet"

# Create rule allowing SSH only from bastion host subnet
gcloud compute firewall-rules create allow-ssh-bastion \
  --network=production-vpc \
  --direction=INGRESS \
  --action=ALLOW \
  --rules=tcp:22 \
  --source-ranges=10.0.1.0/24 \
  --target-tags=ssh-allowed \
  --priority=1000 \
  --description="Allow SSH only from bastion subnet"

# Create rule allowing internal communication between app tiers
gcloud compute firewall-rules create allow-app-to-db \
  --network=production-vpc \
  --direction=INGRESS \
  --action=ALLOW \
  --rules=tcp:5432 \
  --source-tags=app-server \
  --target-tags=db-server \
  --priority=1000 \
  --description="Allow PostgreSQL from app tier to database tier"

# Create service-account-based rule (more secure than tags)
gcloud compute firewall-rules create allow-api-internal \
  --network=production-vpc \
  --direction=INGRESS \
  --action=ALLOW \
  --rules=tcp:8080 \
  --source-service-accounts=api-client@project.iam.gserviceaccount.com \
  --target-service-accounts=api-server@project.iam.gserviceaccount.com \
  --priority=1000

Step 3: Implement Egress Restrictions

Configure egress firewall rules to control outbound traffic and prevent data exfiltration.

# Deny all egress by default (low priority)
gcloud compute firewall-rules create deny-all-egress \
  --network=production-vpc \
  --direction=EGRESS \
  --action=DENY \
  --rules=all \
  --destination-ranges=0.0.0.0/0 \
  --priority=65534 \
  --description="Default deny all egress traffic"

# Allow egress to Google APIs via restricted VIP
gcloud compute firewall-rules create allow-google-apis \
  --network=production-vpc \
  --direction=EGRESS \
  --action=ALLOW \
  --rules=tcp:443 \

…
자주 묻는 질문

방화벽 규칙이란 무엇인가요?

설정한 규칙에 따라 클라우드의 가상 네트워크에 누가 들어오고 나갈 수 있는지 통제하는 디지털 문지기와 같습니다.

‘인그레스’와 ‘이그레스’는 무엇을 의미하나요?

‘인그레스’는 네트워크로 들어오는 트래픽이고, ‘이그레스’는 네트워크에서 나가는 트래픽입니다.

이것으로 특정 웹사이트를 차단할 수 있나요?

직접적으로는 안 됩니다. 이 도구는 네트워크 규칙에 초점을 맞춥니다. 웹사이트를 차단하려면 Cloud Armor나 DNS 같은 다른 도구가 필요합니다.

상세 정보

작성자의 원본 설명

Implements and audits GCP VPC firewall rules using gcloud, covering auditing overly permissive rules, creating restrictive ingress/egress rules, hierarchical firewall policies, and monitoring rule effectiveness with VPC Flow Logs. Use when deploying GCP workloads needing network access controls, auditing firewall configs, or responding to Security Command Center findings; not for Cloud Armor or DN

repo: mukul975/Anthropic-Cybersecurity-Skills

인기도

GitHub 스타
35k
순위
#8044
라이선스
Apache-2.0
업데이트
2026. 8. 31.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬