OneNym.idDiscuss deployment
English

THE HARDENED STACK / Chapter 6

Securing the Cloud (Azure and AWS)

Most cloud incidents are not break-ins but settings left wrong on the customer's side. This chapter asks which parts of an Azure or AWS estate are still yours to secure, and how a small team can keep them right.

This page summarises the chapter. The full text is in the book.

Shared responsibility as a working list

The chapter opens with a storage account in Meridian's Azure subscription that had allowed anonymous public read access for eighteen months, exposing a spreadsheet of loyalty members from an old prize draw. Nothing was hacked; a box had been ticked in a hurry and never unticked. The book uses this to make the point that the provider secures the data centres, hardware and managed plumbing, while the customer owns identities, network exposure, data, patching of anything run on virtual machines, and logging.

Managed services move more work to the provider, which is why they suit small teams, but they never take over access grants, internet exposure or logging. The practical question for any new service is therefore not how much the provider covers, but what remains yours on that service. The author narrows the usual causes of cloud incidents to five: over-permissioned identities, long-lived access keys, storage and databases exposed to the internet, network rules opened too wide, and logging that is switched off.

Identity: roles instead of keys, least privilege instead of convenience

In the cloud every action is an authenticated API call that can be made from anywhere, so identity is the perimeter. Long-lived keys, such as an AWS access key and secret or an Azure client secret, behave like passwords that never expire and tend to end up in scripts, pipeline variables and repositories. The book recommends assumed roles and short-lived credentials instead, so a leak has a short window and there is no stored secret to lose.

Least privilege means naming the specific actions and resources an identity needs rather than granting wildcards. The chapter shows an AWS IAM policy that allows only reading one bucket, and contrasts the bounded damage of that identity being compromised with the account-wide damage of an administrator role. Two habits make this sustainable: build policies from the permissions an identity has actually used, which both clouds can report, and separate production from non-production in different subscriptions or accounts. The author also notes that teams widen permissions when narrowing them is slow, so the precise grant must be made as quick as the broad one. At Meridian, an access-analyser review found a deployment identity with administrator rights that used about six actions; the highest-risk identities were narrowed first and a quarterly review was scheduled.

Finding misconfigurations before someone else does

Because people under time pressure will tick wrong boxes, the chapter argues for checking continuously and automatically, the practice known as cloud security posture management (CSPM). Commercial tools help at scale, but a small team can start with read-only command-line queries against its own accounts: listing S3 buckets without a public-access block, AWS security groups that allow inbound traffic from 0.0.0.0/0, and Azure storage accounts that allow public blob access.

These scripted checks complement the clouds' native posture services rather than replacing them: they are transparent, portable and free to run often. The book also asks readers not to fix findings silently. A public bucket is evidence of a route around your controls, such as a portal click with no owner and no guardrail, and closing that route prevents the next ten.

Guardrails, infrastructure as code and policy-as-code

Defining resources in Terraform, Bicep or CloudFormation makes every change reviewable and recorded in version control. Policy-as-code adds automatic gates that reject changes breaking your rules, such as public storage or missing owner tags. The chapter's Terraform example for an Azure storage account disables nested public access, enforces HTTPS-only traffic and TLS 1.2, and carries owner and data-classification tags that tie back to the asset inventory of Chapter 2.

The advice for adoption is to start with a few guardrails that match the incidents you fear and to run them in warning mode before blocking, because a guardrail that blocks legitimate work on its first day tends to be switched off. An expert section distinguishes preventive guardrails, which stop bad changes on the deployment path, from detective ones, which scan everything that exists however it was created. Each covers the other's blind spot, so mature teams run both.

Logging that can answer the breach question

After a misconfiguration is found, the first question is whether anyone accessed the data, and only logs can answer it. The control-plane audit log, CloudTrail in AWS and the Activity log in Azure, should be on account-wide from the start and written to a destination that everyday identities cannot delete. Data-access logging on stores holding reportable data is worth its cost, because it shows whether files were actually read.

To manage cost, the book suggests never trimming the control-plane log, targeting data-access logging at sensitive stores, and keeping retention long enough to cover the weeks or months that often pass before an incident is discovered. Logs do not prevent anything, but they turn every other control into something you can prove.

KEY POINTS

Key points

  • Run a read-only sweep for public storage in every cloud account and review anything not locked down.
  • Review every security group or network rule that allows inbound traffic from 0.0.0.0/0 on sensitive ports.
  • Use the access analyser to find over-permissioned identities, narrow the riskiest first, and schedule a quarterly review.
  • Replace long-lived access keys with assumed roles and short-lived credentials.
  • Add a policy-as-code guardrail that blocks public storage and requires owner and data-classification tags.
  • Confirm CloudTrail or the Azure Activity log is on account-wide and written to a protected destination.

QUESTIONS

Common questions

What is the most common cause of security incidents in Azure and AWS?
According to The Hardened Stack, most cloud incidents come from misconfiguration rather than break-ins: a setting left wrong on the customer's side that exposes data to the internet. The provider secures its data centres and platform, but identities, network exposure, data and logging remain the customer's responsibility. The common culprits are over-permissioned identities, long-lived keys, public storage, overly open network rules and disabled logging.
Why should cloud workloads use roles instead of access keys?
A long-lived access key works like a password that never expires, and it often ends up in scripts, CI/CD variables or code repositories where it can leak. Letting a workload assume a role gives it temporary credentials that expire in minutes or hours, so a leak has a short window and there is no stored secret to find. The book treats this as the default choice wherever a workload currently uses a key.
How can a small team find public storage buckets and open security groups?
Run read-only command-line queries against your own accounts on a schedule: check each S3 bucket's public-access block, list security groups that allow inbound traffic from 0.0.0.0/0, and list Azure storage accounts with public blob access enabled. These checks change nothing and complement the cloud's native posture services. Wire them to an alert so a misconfiguration is found the day it appears rather than months later.
What is the difference between preventive and detective cloud guardrails?
Preventive guardrails block a non-compliant change before it exists, for example a policy check that fails a Terraform deployment. They only protect the path they sit on, so portal changes or bypassing identities can slip past. Detective guardrails continuously scan what actually exists, catching problems however they arose but only after a delay, so the book recommends running both.
Which cloud logs should always be turned on?
The control-plane audit log, CloudTrail in AWS and the Activity log in Azure, should be enabled account-wide from day one and sent to a protected destination that everyday identities cannot delete. Data-access logging should be added for storage that holds data you would have to report on, because only it shows whether files were actually read. Retention should cover the weeks or months that can pass before an incident is discovered.