Skip to main content
Glama

portwhy

CI License: MIT Zero Dependencies SARIF 2.1.0 MCP Ready

Cross-platform zero-dependency listening socket tracer, docker-compose.yml static port scanner, and Docker-bypasses-UFW security auditor with SARIF 2.1.0 output and ready-to-apply DOCKER-USER / nftables remediation.

portwhy preview


Why Docker Silently Bypasses UFW

flowchart LR
  Internet["Public Internet"] --> PREROUTING["iptables PREROUTING NAT"]
  PREROUTING -->|"Published Container Port (0.0.0.0:5432)"| DOCKER["DOCKER Chain (BYPASSES UFW INPUT!)"]
  PREROUTING -->|"Host Socket"| UFW["UFW INPUT Rules (Enforced)"]
  DOCKER --> Guard["Fix: DOCKER-USER DROP or 127.0.0.1 Bind"]

Related MCP server: Docker MCP Guardian

Quickstart (Zero Install)

# Audit live listening sockets on Linux (ss/docker/ufw), macOS (lsof), or Windows (netstat)
npx portwhy

# Statically audit docker-compose.yml in CI/CD before deploy
npx portwhy compose docker-compose.yml --fail-on high

# Emit SARIF 2.1.0 for GitHub Code Scanning
npx portwhy compose docker-compose.yml --sarif > portwhy.sarif

# Print ready-to-apply /etc/ufw/after.rules DOCKER-USER or nftables rules
npx portwhy --ufw-fix
npx portwhy --nft-fix

MCP Mode & GitHub Action

{ "mcpServers": { "portwhy": { "command": "npx", "args": ["portwhy@1.2.0", "--mcp"] } } }
- uses: lostprotocol212/portwhy@v1
  with:
    compose-file: 'docker-compose.yml'
    fail-on: 'high'
    sarif-output: 'portwhy.sarif'

Interactive auditor + Network Designer export: serversareup.com/tools/docker-ufw-port-auditor.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables remote container security monitoring and management through Docker API and SSH connections. Provides real-time container monitoring, security analysis, event tracking, and comprehensive security scanning for containerized environments.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables local LLM agents to inspect Docker containers and optionally perform guarded restarts through MCP, with read-only defaults, credential redaction, canonical ID checks, denylists, and bounded daemon timeouts. It provides secure, zero-trust Docker daemon access for MCP clients.
      102
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables inspecting local listening ports, process owners, Docker mappings, and local LLM signatures, plus looking up or terminating the process that owns a specific port when write access is allowed. Mutating actions require confirmation and are blocked in dry-run mode.
      19 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      F
      maintenance
      Enables agents to inspect and operate Docker or Podman containers by checking daemon status, listing containers and images, reading logs, executing commands, running throwaway echo containers, and querying compose projects through a FastMCP stdio interface.
      Apache 2.0