Securing communications and establishing boundary protection · Topic 2 of 4

Cloud Armor, Secure Web Proxy, Cloud DNS Security and API Restriction

Protect apps with Cloud Armor WAF rules, filter egress with Secure Web Proxy, secure Cloud DNS with DNSSEC, and monitor and restrict Google APIs.

  • 5 min
In a nutshell
  • Cloud Armor sits on the load balancer: WAF rules, geo and IP rules, rate limits, bot control.
  • Test Cloud Armor rules in preview mode; Adaptive Protection detects layer 7 DDoS.
  • Secure Web Proxy is explicit egress filtering by host and URL; Cloud NAT is not a filter.

What it is

Four controls finish the perimeter. Google Cloud Armor filters inbound web traffic at the load balancer.

Secure Web Proxy controls outbound web traffic from your workloads. Cloud DNS security settings protect name resolution, and API restrictions limit which Google services a project can use at all.

Inbound webCloud ArmorWAF, rate limitsLoad balancerWorkloadsSecure Web Proxyallowed hosts onlyInternet

How it works

Google Cloud Armor

Cloud Armor security policies attach to backend services of external Application Load Balancers (and some other load balancers). Rules are evaluated in priority order, lowest number first, and each has a match and an action.

Rule typeExamplePurpose
IP and geographyorigin.region_code == 'KP'Block regions or address ranges
Preconfigured WAFevaluatePreconfiguredWaf('sqli-v33-stable')OWASP Top 10 style attacks, based on the OWASP ModSecurity Core Rule Set
Rate limitingthrottle or rate_based_ban actionsLimit requests per client key such as IP
Bot managementreCAPTCHA integrationChallenge or block automated clients
Custom expressionsMatch headers, paths or query stringsApp-specific rules
gcloud compute security-policies create shop-waf \
  --description="WAF for shop frontend"

gcloud compute security-policies rules create 1000 \
  --security-policy=shop-waf \
  --expression="evaluatePreconfiguredWaf('sqli-v33-stable')" \
  --action=deny-403

gcloud compute backend-services update shop-backend \
  --security-policy=shop-waf --global

Use preview mode on new rules first: matches are logged but not enforced. Adaptive Protection uses machine learning to detect layer 7 DDoS attacks and suggest rules.

Edge security policies filter requests before Cloud CDN serves cached content. Cloud Armor Enterprise is a paid subscription (Paygo or Annual) that adds features such as Google Threat Intelligence, named IP address lists and Adaptive Protection; DDoS response team support and DDoS bill protection come only with the Annual plan.

Secure Web Proxy

Secure Web Proxy is a managed, explicit forward proxy for workloads' outbound HTTP and HTTPS traffic. Workloads send traffic to the proxy's address; the proxy allows only what its policy permits.

ElementRole
GatewayThe regional proxy instance, which needs a proxy-only subnet
Policy and rulesAllow or deny by destination host, URL lists, source identity such as service account or secure tag
TLS inspectionOptional; uses a CA from Certificate Authority Service so rules can match full URLs
LoggingEach request is logged to Cloud Logging

Choose Secure Web Proxy when workloads must reach only approved internet sites, such as package repositories or partner APIs. Cloud NAT gives outbound reach but no URL filtering.

Cloud DNS security

SettingProtects against
DNSSEC on public zonesSpoofed or tampered answers; publish the DS record at the registrar
Private zonesInternal names leaking; visible only to authorized VPC networks
Response policiesUsers resolving unwanted domains; override or block answers, or point Google API names to restricted VIPs
DNS server policiesInbound forwarding for on-premises resolvers, alternative name servers, and query logging
IAM on Cloud DNSUnauthorised record changes; grant DNS Administrator narrowly
gcloud dns managed-zones update example-public-zone --dnssec-state=on

Monitoring and restricting APIs

Every enabled API is attack surface. A security engineer controls which APIs exist in each project and who can call them.

ControlHow
Enable only needed APIsReview with gcloud services list --enabled; disable unused ones
Organization-wide service restrictionOrganization policy gcp.restrictServiceUsage lists services allowed or denied in a subtree
Data exfiltration through APIsVPC Service Controls restricted services and VPC accessible services
API keysRestrict each key to specific APIs and to allowed apps, IPs or referrers; rotate and delete unused keys
MonitoringAPI metrics in the console, Cloud Monitoring request metrics, Cloud Audit Logs per method
Your own APIsAPI Gateway or Apigee for authentication, quotas and threat protection

A worked example

An online shop is hit by SQL injection attempts and a scraping bot, while its VMs download packages from anywhere on the internet. The engineer attaches a Cloud Armor policy with preconfigured SQLi and XSS rules in preview mode, then enforces them after a day of clean logs, and adds a per-IP rate limit.

For egress, Secure Web Proxy allows only the package mirrors and payment provider, and egress firewall rules block direct internet access so traffic must use the proxy. DNSSEC is turned on for the public zone.

Attack trafficCloud ArmorSQLi, XSS, rate limitBlockedVMsSecure Web Proxypackage mirrors, payment APIAllowed sites only

How the exam asks about this

  • "Protect a public web app behind a global load balancer from SQL injection and cross-site scripting." Cloud Armor with preconfigured WAF rules on the backend service.
  • "VMs may reach only a list of approved external domains over HTTPS." Secure Web Proxy with host-based allow rules.
  • "Prevent cache poisoning and spoofed answers for the company's public domain." Enable DNSSEC on the Cloud DNS public zone and publish the DS record.

What to remember for the exam

  • Cloud Armor sits on the load balancer: WAF rules, geo and IP rules, rate limits, bot control.
  • Test Cloud Armor rules in preview mode; Adaptive Protection detects layer 7 DDoS.
  • Secure Web Proxy is explicit egress filtering by host and URL; Cloud NAT is not a filter.
  • DNSSEC for public zones, private zones for internal names, response policies to override answers.
  • Restrict APIs with gcp.restrictServiceUsage, VPC Service Controls and API key restrictions.
Watch out

Cloud Armor only sees traffic that passes through the load balancer it is attached to. If backends also have external IPs, attackers can bypass it, so remove them or block direct access with firewall rules.

Common mistakes

Using firewall rules to stop SQL injection. Firewall rules see addresses and ports, not HTTP payloads. Use Cloud Armor WAF rules.

Enforcing new WAF rules straight away. False positives can block real customers. Use preview mode, read the logs, then enforce.

Leaving API keys unrestricted. An unrestricted key works for every enabled API from anywhere. Restrict it to one API and to known callers.

Check yourself

  • Where is a Cloud Armor security policy attached?

    To the backend service (or backend bucket for edge policies) of a supported load balancer.

  • When would you choose Secure Web Proxy over Cloud NAT?

    When outbound web traffic must be filtered by destination host or URL, since Cloud NAT only translates addresses.

  • What does turning on DNSSEC for a public zone require outside Google Cloud?

    Publishing the zone's DS record at the domain registrar so resolvers can validate the chain.

Topic 2 of 4 in Securing communications and establishing boundary protection

Test yourself on Securing communications and establishing boundary protection

The full Google Cloud Professional Cloud Security Engineer question bank has 749 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Google Cloud. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.