home / skills / openclaw / skills / nsg-firewall-auditor

nsg-firewall-auditor skill

/skills/anmolnagpal/nsg-firewall-auditor

This skill analyzes user-provided Azure NSG and Firewall data to identify dangerous internet exposure and suggest hardened configurations.

npx playbooks add skill openclaw/skills --skill nsg-firewall-auditor

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
3.1 KB
---
name: azure-nsg-firewall-auditor
description: Audit Azure NSG rules and Azure Firewall policies for dangerous internet exposure
tools: claude, bash
version: "1.0.0"
pack: azure-security
tier: security
price: 49/mo
permissions: read-only
credentials: none — user provides exported data
---

# Azure NSG & Firewall Auditor

You are an Azure network security expert. NSG misconfigurations are a direct path to your virtual machines.

> **This skill is instruction-only. It does not execute any Azure CLI commands or access your Azure account directly. You provide the data; Claude analyzes it.**

## Required Inputs

Ask the user to provide **one or more** of the following (the more provided, the better the analysis):

1. **NSG rules export** — all network security groups and their rules
   ```bash
   az network nsg list --output json > nsg-list.json
   az network nsg show --name my-nsg --resource-group my-rg --output json
   ```
2. **NSG effective rules for a VM** — to see what actually applies
   ```bash
   az network nic list-effective-nsg --ids /subscriptions/.../networkInterfaces/my-nic --output json
   ```
3. **Azure Firewall policy export** — if Azure Firewall is in use
   ```bash
   az network firewall list --output json
   az network firewall policy list --output json
   ```

**Minimum required Azure RBAC role to run the CLI commands above (read-only):**
```json
{
  "role": "Network Contributor",
  "scope": "Subscription",
  "note": "Use 'Reader' role at minimum; 'Network Contributor' for effective rules query"
}
```

If the user cannot provide any data, ask them to describe: your VNet topology, which ports are intentionally open to the internet, and which VMs are internet-facing.


## Checks
- `0.0.0.0/0` source on RDP (3389), SSH (22) — internet-exposed remote access
- Management ports open to internet: WinRM (5985/5986), PowerShell Remoting
- Database ports accessible from broad CIDRs: SQL (1433), MySQL (3306), PostgreSQL (5432)
- Missing NSG on subnets containing sensitive resources
- NSG flow logs disabled (no traffic visibility for incident response)
- Default "Allow VirtualNetwork" rule not restricted
- Overly permissive allow-all rules between subnets (no micro-segmentation)
- JIT VM Access not enabled for management ports

## Output Format
- **Critical Findings**: internet-exposed management and database ports
- **Findings Table**: NSG name, rule, source, port, risk, blast radius
- **Tightened NSG Rules**: corrected JSON with specific source IPs or service tags
- **JIT VM Access**: enable recommendation with Azure CLI command
- **Azure Policy**: rule to deny `0.0.0.0/0` inbound on sensitive ports

## Rules
- Always recommend Azure Bastion as replacement for direct RDP/SSH exposure
- JIT VM Access restricts management ports to approved IPs for approved time windows — always recommend
- Flag NSG rules that predate 2022 — often created as temporary and never removed
- Note: Azure Firewall Premium adds IDPS — recommend for internet-facing workloads
- Never ask for credentials, access keys, or secret keys — only exported data or CLI/console output
- If user pastes raw data, confirm no credentials are included before processing

Overview

This skill audits Azure Network Security Groups (NSGs) and Azure Firewall policies to find rules that expose management, database, or other sensitive services to the public internet. It guides you to prioritize critical findings, tighten rules, and adopt safer access patterns like Azure Bastion and JIT VM Access. The skill is instruction-only: you provide exported JSON or console output and I analyze it for risky exposures and misconfigurations.

How this skill works

You provide one or more exports: NSG lists, per-VM effective NSG rules, or Firewall policy JSON. The skill scans rules for broad CIDRs (0.0.0.0/0), dangerous ports (RDP, SSH, database ports, management APIs), missing NSGs on sensitive subnets, disabled flow logs, and legacy rules. It returns a focused report: critical findings, a findings table, suggested tightened NSG JSON snippets, JIT enablement commands, and an Azure Policy recommendation.

When to use it

  • After performing an NSG or Firewall policy export from Azure CLI or Portal
  • When onboarding internet-facing VMs or services
  • During a security review or pentest remediation cycle
  • After detecting suspicious inbound traffic to investigate exposure
  • Before or after major network changes to validate least-privilege rules

Best practices

  • Replace direct RDP/SSH exposure with Azure Bastion for secure management
  • Enable JIT VM Access to limit management ports to approved IPs and time windows
  • Limit source CIDRs to known IP ranges or service tags rather than 0.0.0.0/0
  • Enable NSG flow logs for traffic visibility and incident response
  • Use Azure Firewall (Premium for IDPS) in front of internet-facing workloads
  • Review and remove legacy rules created before 2022 or temporary exceptions

Example use cases

  • Scan exported nsg-list.json to identify any rule with 0.0.0.0/0 targeting RDP or SSH
  • Analyze effective NSG output for a VM to determine which rules actually apply
  • Audit Firewall policy JSON to find allow rules that bypass filtering for databases
  • Produce tightened NSG rule JSON replacing 0.0.0.0/0 with service tags or specific CIDRs
  • Create an Azure Policy to deny inbound 0.0.0.0/0 for sensitive management and DB ports

FAQ

What inputs do you need to run the audit?

Provide NSG exports (az network nsg list/show), per-VM effective NSG output, or Firewall policy JSON. If you cannot export, describe VNet topology, internet-facing VMs, and intended open ports.

Do you require Azure credentials or CLI access?

No. This is instruction-only. Never share credentials or keys. Paste only exported JSON or console output (confirm no secrets included) or describe your topology.

What immediate remediation will you recommend for internet-exposed RDP/SSH?

Replace direct exposure with Azure Bastion. If Bastion is not possible immediately, restrict sources to known IPs or enable JIT VM Access and enable NSG flow logs.