SecOps Observer
← All labs

Azure network security / Intermediate / 20–35 min

The Azure SSH rule open to everyone

Investigate an overly broad SSH rule on an unattached Azure network security group and narrow its source.

LAB IDsecops-01-azure-unrestricted-sshTRACK / secops.observer
Security analyst monitoring alerts beside a server rack

The scenario

A lab network security group allows SSH from any source. It is not attached to any subnet or interface and creates no internet-facing VM. Review and narrow the rule to the exercise's designated private network.

Mission objectives

  • Inspect the real Azure network security group and its SSH rule.
  • Use Terraform to restrict the rule to the lab's designated private CIDR.
  • Verify Azure's rule and clean up the isolated resources.

Lab README

Azure SSH security rule

This exercise creates a real Azure network security group containing a deliberately permissive inbound SSH rule. It is unattached: there is no VM, interface, subnet or public IP. Never attach it to any resource. Restrict its source to the designated example private network 10.77.0.0/16; this example is not a prescription for a production network.

An empty resource group and an unattached network security group normally have no direct usage charge, but Azure pricing and policies vary. Use an isolated subscription with known safe guardrails and remove lab resources promptly. No real network traffic or SSH exposure is exercised.

Install Azure CLI, Terraform 1.5+, Python 3 and Bash on Linux. Log in and select the intended subscription. Microsoft.Resources and Microsoft.Network must already be registered. Use a private local Linux filesystem for Terraform state.

export AZURE_SUBSCRIPTION_ID="your-subscription-id"
./setup.sh "$AZURE_SUBSCRIPTION_ID" northeurope --accept-costs

Inspect the lab NSG and .lab-state, review Terraform plans before applying, then run ./verify.sh and ./teardown.sh. Teardown refuses unexpected group contents or attached network resources and retains private state on failure. Confirm the lab group is gone before removing .lab-state.

View Markdown source ↗

Get the lab

Download and inspect the installer before running it. It checks the archive's SHA-256 digest and refuses to overwrite an existing lab directory.

curl -fsSLO https://devops.download/labs/secops-01-azure-unrestricted-ssh.sh
less secops-01-azure-unrestricted-ssh.sh
bash secops-01-azure-unrestricted-ssh.sh
cd labs/secops-01-azure-unrestricted-ssh
./setup.sh "$AZURE_SUBSCRIPTION_ID" northeurope --accept-costs

When you've made your changes, run ./verify.sh. Remove lab resources with ./teardown.sh.

Download the archive instead ↗

Need a nudge?

Hint #1

Inspect the source of the inbound SSH rule and whether the network security group is attached.

Hint #2

The input controlling the rule is in .lab-state/access.auto.tfvars.json. Review the Terraform plan before applying changes.

Hint #3 · Deep Dive Runbook on opsbreakfix.com

Read the deep dive runbook ↗

Solved it?

Read the Official Root Cause Analysis & Certification Roadmap on opsbreakfix.com

Continue to opsbreakfix.com ↗

One ecosystem.
Many perspectives.

Follow the connection from a hands-on lab to the knowledge and tools behind it.