Skip to main content

Defense in depth

Defense in depth means no single control is trusted to hold. Every edition of the BuiltForProd Baseline layers controls so that each catches what the previous one cannot: policies that even an administrator of an account, subscription or project cannot bypass, detection across the whole organization, a response for clear-cut cases, and evidence stored where the unit it describes cannot alter it.

Why it matters in production​

Every control fails sometimes. A firewall rule is loosened for a debugging session, a role is granted more than it needs, a bucket is made public by a script. One layer alone turns each of those into an incident. Layers turn them into a finding: the policy blocks the change, or the detector reports it, or the remediation reverses it, or the audit trail shows exactly what happened. Compliance frameworks ask for the same structure. For the AWS edition, the offerings note lists SOC 2, HIPAA, PCI DSS 4.0, CMMC, NIST CSF and the CIS AWS Foundations Benchmark as out-of-the-box readiness; the Azure and GCP editions state their frameworks below.

How each edition implements it​

LayerAWS Enterprise BaselineAzure Enterprise BaselineGCP Enterprise Baseline
PreventiveThree SCPs, the tag policy, the account baselineAzure Policy at mg-acme: Deny, DenyAction and Modify; the subscription baseline19 organization policy constraints, the IAM deny policy, the project baseline
NetworkTransit Gateway domain tables with blackholes, hub egress, AWS WAFFirewall policy isolation domains and single egress, Front Door WAF from the Baseline's templateSeparate domain VPCs, hierarchical and network firewall policies, Cloud Armor from the Baseline's template
IdentityIdentity Center, GitHub OIDC, per-stage KMS keysEntra groups, Conditional Access, PIM, federated identities, per-stage Key Vault keysGoogle groups, PAM, Workload Identity Federation, no service account keys, per-stage Cloud KMS keys
WorkloadNon-root pods, NetworkPolicy, TLSDeployment Safeguards, Cilium network policy, Pod Security Standard restrictedPrivate GKE nodes, Dataplane V2 network policy, Pod Security Standard restricted
DetectiveGuardDuty, Security Hub, Config, Access Analyzer; Inspector and Macie by switchDefender for Cloud plans per subscription, Azure Policy complianceSecurity Command Center, 13 log-based detections, Artifact Analysis
ResponsiveEventBridge remediation and SNS alertsAction group ag-acme-security-alerts: activity-log, KQL and Defender alertsEmail notification channel, SCC findings on Pub/Sub, optional notifier with remediation
EvidentiaryOrganization CloudTrail, Config history and flow logs in core-auditImmutable audit storage and the audit workspace in acme-core-auditAggregated organization sinks to the log and archive buckets in acme-core-audit

In every edition one switch file, environments/core/security/security.hcl, decides which security services run, every unit that must agree reads it, and code ownership gives it to the infra admins and the security team. People and pipelines never hold long-lived keys; see least privilege.

AWS Enterprise Baseline​

Three service control policies attach to both organizational units. acme-security-guardrails denies IAM users and access keys, protects S3 Block Public Access and requires MFA outside approved principals; acme-region-restriction denies activity outside the home region, the regions with folders and us-east-1; acme-audit-protection denies stopping or deleting CloudTrail and AWS Config. SCPs hold against an account administrator. The service control policies explainer has the statements.

Each isolation domain has its own Transit Gateway route table with blackhole routes for every stage outside it, and egress leaves only through the hub, where AWS Network Firewall is a switch. Firewall Manager applies a baseline AWS WAF policy to every workload load balancer. The application chart runs as UID 10001 with a read-only root filesystem and a default-deny NetworkPolicy, and TLS is required wherever traffic crosses a boundary.

core-security is delegated administrator for GuardDuty, Security Hub, Inspector, Macie, IAM Access Analyzer and Firewall Manager. AWS Config evaluates the BuiltForProd-soc2-baseline conformance pack, with 28 further packs available. EventBridge routes high-severity findings to the acme-security-alerts SNS topic and invokes the automation that re-blocks a public bucket everywhere except core-public. One organization CloudTrail with log file validation delivers every account's events to the encrypted, versioned audit bucket in core-audit.

Azure Enterprise Baseline​

Azure Policy is assigned at mg-acme, so no subscription Owner can remove it. The security guardrails initiative denies seven conditions, such as public storage access, shared-key storage access, public IPs on network interfaces and Key Vaults without purge protection, and audits three more; a custom definition denies role assignments to individual users. The region restriction denies other locations, the audit protection initiative uses DenyAction to block deleting the audit workspace, the audit storage and diagnostic settings, and the tag policy audits tag values (Deny with enforce_tag_policy) and copies missing tags from the resource group with Modify. To lift any of them takes Owner at mg-acme, which is eligible through PIM when PIM is on.

In the network, the Azure Firewall's isolation-domain rules and single egress apply to every spoke. The Web App Blueprint builds its Front Door WAF policy from the Baseline's template policies/waf-template.json, which kv-publish publishes to every stage as waf--policy-template. DDoS Network Protection is a switch (enable_ddos_protection, about $2,944 per month). AKS runs Deployment Safeguards in Warn mode and Cilium network policy, the application namespace enforces the Pod Security Standard restricted, and the chart runs as UID 10001 with a read-only root filesystem.

Microsoft Defender for Cloud plans are set per subscription from security.hcl: Containers, Storage, Key Vault and Resource Manager on; Servers, Cosmos DB, CSPM and API off. The action group ag-acme-security-alerts receives Defender alerts of High or Critical severity, 10 CIS activity-log alerts per subscription and 6 KQL alerts on the audit workspace. The edition prevents rather than remediates: Deny, DenyAction and Modify stop the change at request time. The evidence (the Activity Log of every subscription and the Microsoft Entra logs) lands in the audit workspace and in immutable audit storage with a customer-managed key in acme-core-audit, protected by DenyAction and CanNotDelete locks.

Frameworks: the Microsoft cloud security benchmark and the custom BuiltForProd-soc2-baseline initiative (13 controls) are on; nine built-in initiatives, from CIS Azure v3.0.0 to FedRAMP Moderate, are switches.

GCP Enterprise Baseline​

19 organization policy constraints at the organization node (11 boolean, 8 list) block service account keys, public bucket access, external VM IPs and peering outside the network project, among others, and restrict resource locations. An IAM deny policy keeps the audit sinks and buckets from being deleted or altered by anyone outside a short exception list. Both hold against a project Owner, because they are set above the project.

In the network, the domain VPCs are not peered with each other, the hierarchical firewall policy runs first, and each VPC's network firewall policy ends by denying and logging every egress it did not allow. The Web App Blueprint builds its Cloud Armor policy from the Baseline's rule template policies/cloud-armor-template.json, published as the parameter waf--policy-template. An optional VPC Service Controls perimeter runs in dry run until it is enforced. GKE nodes are private, Dataplane V2 enforces network policy, and the application namespace enforces the Pod Security Standard restricted.

Security Command Center runs at the organization (scc_tier = "standard"; Premium when the organization subscribes) and sends HIGH and CRITICAL findings to a Pub/Sub topic. 13 log-based detections over the central audit bucket alert the security mailbox, and Artifact Analysis scans every pushed image (about $0.26 per image). The optional notifier (enable_scc_notifier) removes public bindings from a bucket with a PUBLIC_BUCKET_ACL finding outside acme-core-public. Admin Activity and Data Access audit logs of every project reach the central log bucket and the archive bucket acme-usw1-audit-logs in acme-core-audit through two aggregated organization sinks, with CMEK and 365-day retention.

Frameworks: the GCP edition implements the CIS Google Cloud Foundations Benchmark control by control. Eight of the 13 detections come from its section 2, and DNS query logging covers recommendation 2.12. No other framework is mapped in the code.

Worked example: a public bucket​

On the GCP edition, an engineer in acme-plat-dev runs a script that grants allUsers read access on a bucket:

  1. The storage.publicAccessPrevention constraint refuses the grant at request time. Nothing becomes public.
  2. The attempt is in the Admin Activity audit log, which the aggregated sink delivers to the central bucket in acme-core-audit, where the deny policy keeps anyone in acme-plat-dev from removing it.
  3. Only acme-core-public has a project-level override of the constraint. A public bucket there is by design: Security Command Center reports it, and the notifier, when switched on, skips core-public buckets.

Two layers stopped the change and recorded it, and the third is scoped so that the one project meant to be public stays public. The same script on the AWS edition is stopped by the account-level public-access block and the remediation, and on the Azure edition by the Deny policy on public storage access.

Common mistakes​

  • Weakening a preventive rule to make a deployment pass. Design around the rule; a relaxed guardrail applies to every account, subscription or project below it.
  • Switching a security service off in one place. security.hcl is read by every unit that must agree, and code ownership gives it to the infra admins and the security team.
  • Treating security groups or firewall rules as the only network control. Isolation domains, the hub and the egress rules come first; a security group, network security group or VPC firewall rule is the last layer, not the first.
  • Sending logs to the unit that produced them. Evidence lives in core-audit so that the account, subscription or project it describes cannot rewrite it.
  • Naming a workload role outside acme-* (AWS). The MFA statement of the guardrail policy denies it unless the role carries mfa-exempt = true.
  • Removing a lock on the audit resource group (Azure). Removing a lock takes Owner, which on the core subscriptions only the Platform Leads and the break-glass group can hold, and DenyAction still blocks deleting the audit resources.
  • Expecting a project Owner to bypass the deny policy (GCP). IAM deny policies are evaluated before allow policies, whatever role the principal holds.