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

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.
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-costsWhen you've made your changes, run ./verify.sh. Remove lab resources with ./teardown.sh.
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
Solved it?
Read the Official Root Cause Analysis & Certification Roadmap on opsbreakfix.com
Continue to opsbreakfix.com ↗