Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
A simple tool to analyze which Docker container ports are exposed and cross-reference them with ufw-docker rules.
What it does
This script shows:
- Exposed but not protected: Docker ports bound to all interfaces without ufw-docker rules
- Protected: Ports that are both exposed and allowed by ufw-docker
- Orphaned rules: ufw-docker rules with no active containers
Example
--------------------------------------------------------------------------------
➜ ~ sudo $(which uv) run ufw-docker-recap.py
================================================================================
UFW-DOCKER PORT ANALYSIS
================================================================================
🚨 EXPOSED BUT NOT PROTECTED BY UFW-DOCKER
--------------------------------------------------------------------------------
Port 7090/TCP: prometheus
Port 7098/TCP: authelia
✅ EXPOSED AND ALLOWED BY UFW-DOCKER
--------------------------------------------------------------------------------
Port 3478/TCP: coturn
↳ Allowed by UFW rule(s) at 172.30.0.2
Port 3478/UDP: coturn
↳ Allowed by UFW rule(s) at 172.30.0.2
Port 8443/TCP: coturn
↳ Allowed by UFW rule(s) at 172.30.0.2
Port 21115-21116/TCP: hbbs
↳ Allowed by UFW rule(s) at 172.24.0.2
Port 21116/UDP: hbbs
↳ Allowed by UFW rule(s) at 172.24.0.2
Port 21117/TCP: hbbr
↳ Allowed by UFW rule(s) at 172.24.0.3
Port 21118/TCP: hbbs
↳ Allowed by UFW rule(s) at 172.24.0.2
Port 21119/TCP: hbbr
↳ Allowed by UFW rule(s) at 172.24.0.3
Port 49152-49162/UDP: coturn
↳ Allowed by UFW rule(s) at 172.30.0.2
================================================================================
Summary: 9 protected, 2 unprotected, 0 orphaned rules
================================================================================
Requirements
- Python 3.8+
- ufw-docker installed
sudoprivileges to run docker and ufw-docker commands
Usage
Run with:
sudo $(which uv) run ufw-docker-recap.pyFor verbose output:
sudo $(which uv) run ufw-docker-recap.py --verboseBuilt with
This README was created using Claude Code.