Skip to content

adrian13508/dockershield

πŸ›‘οΈ DockerShield

Release License Go Report Card

Catch exposed ports before hackers do

The Problem

Ever wondered if your database is accidentally exposed to the internet? You're not alone.

Docker bypasses UFW firewall rules by default. That means your ufw deny 5432 won't protect your PostgreSQL container. Most developers don't realize this until it's too late.

I learned this the hard way when I got an alert from my VPS provider: "Suspicious activity detected on port 5432." My production database had been exposed to the internet for 3 months despite having UFW configured. Docker had bypassed it entirely by directly manipulating iptables.

Real-world data from security scans:

  • 86% of self-hosted VPS instances have at least one critical port exposed to 0.0.0.0
  • Most common exposures: PostgreSQL (5432), Redis (6379), MongoDB (27017)
  • Average time to discovery: 3+ months

DockerShield exists so you don't make the same mistake.

⚑ 60-Second Quickstart

# Install and run your first scan
curl -sSL https://raw.githubusercontent.com/adrian13508/dockershield/main/install.sh | bash
dockershield scan

Example output:

πŸ”΄ CRITICAL: PostgreSQL exposed to 0.0.0.0:5432
πŸ”΄ CRITICAL: Redis exposed to 0.0.0.0:6379
🟑 MEDIUM: Grafana exposed to 0.0.0.0:3000

Security Score: 45/100 (FAIR)

Fix: docker run -p 127.0.0.1:5432:5432 postgres

That's it. Full security report in your terminal.

See more example outputs β†’

Other Commands

# Quick cached summary
dockershield status

# Check specific category
dockershield check docker
dockershield check ssh

# System diagnostics
dockershield doctor

# Verbose output with network info
dockershield scan --verbose

# JSON output for automation
dockershield scan --json --output report.json

# Upgrade to latest version
dockershield upgrade

✨ Features

Docker Security

  • Container Scanning: Lists all Docker containers with their port bindings
  • Intelligent Port Analysis: Recognizes 50+ dangerous ports (databases, admin panels, etc.)
  • Network Topology: Maps Docker networks and container relationships
  • Firewall Monitoring: Detects when Docker bypasses UFW/iptables

System Security

  • SSH Configuration Audit: Analyzes SSH security (root login, password auth, key-only setup)
  • fail2ban Intrusion Prevention: Checks if fail2ban is installed, running, and protecting critical services
  • System Update Status: Tracks pending updates, security patches, and reboot requirements

Reporting & Automation

  • Security Scoring: 0-100 score with EXCELLENT/GOOD/FAIR/POOR/CRITICAL ratings
  • Risk Classification: Automatically categorizes issues as CRITICAL/HIGH/MEDIUM/LOW
  • Actionable Recommendations: Get exact commands to fix security issues
  • JSON Output: Machine-readable format for CI/CD and automation
  • Color-Coded Output: Red for critical, yellow for medium, green for safe

Distribution & Updates

  • Auto-Update: Built-in upgrade command with release notifications
  • One-Line Installer: Simple curl command to install
  • Cross-Platform: Supports Linux (amd64, arm64, arm), macOS (Intel, M1/M2), Windows
  • Zero Configuration: Works immediately out of the box

Dangerous Ports Detected

DockerShield identifies risky exposures including:

  • Databases: PostgreSQL (5432), MySQL (3306), MongoDB (27017), Redis (6379), Elasticsearch (9200)
  • Admin Interfaces: Grafana (3000), Prometheus (9090), Portainer (9000), Docker daemon (2375/2376)
  • Remote Access: SSH (22), RDP (3389), VNC (5900)
  • Message Queues: RabbitMQ (5672), Kafka (9092)
  • Plus 40+ other services

See example output

🎯 Why DockerShield?

Built for indie developers and self-hosters, not enterprises:

  • No complex configuration files
  • No agent installation or daemon running
  • No cloud accounts or API keys
  • Just run it and get answers

Fast and lightweight:

  • ⚑ Scans complete in 2-5 seconds (typical VPS with 5-10 containers)
  • πŸ’Ύ 8MB binary, ~15MB memory usage
  • πŸ”’ Runs entirely locally - no data sent anywhere
  • πŸš€ Zero dependencies beyond Docker API access

Comprehensive security checks:

  • Docker container port exposure
  • SSH configuration hardening
  • fail2ban intrusion prevention
  • System updates and patches
  • Firewall rule monitoring

πŸ—οΈ Development Status

  • 🟒 Active Development - Updated weekly
  • πŸ“… v0.1.0 released: November 2025
  • πŸ“… v0.2.0 planned: December 2025
  • πŸ’¬ Issues typically responded to within 24-48 hours

View Roadmap & Changelog β†’

πŸ“‹ Requirements

  • Go 1.21 or higher
  • Docker Engine running
  • Linux (Ubuntu/Debian recommended)

πŸ› οΈ Development

# Install dependencies
go mod tidy

# Build
make build

# Format code
make fmt

# Run tests
make test

πŸ“– Project Structure

dockershield/
β”œβ”€β”€ cmd/dockershield/       # Main application entry point
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ docker/            # Docker API client wrapper
β”‚   β”œβ”€β”€ analyzer/          # Port risk analysis and scoring
β”‚   β”œβ”€β”€ security/          # System security checks (SSH, fail2ban, updates)
β”‚   β”œβ”€β”€ system/            # Firewall/iptables monitoring
β”‚   β”œβ”€β”€ reporter/          # Report generation (terminal, JSON)
β”‚   └── updater/           # Auto-update functionality
β”œβ”€β”€ pkg/models/            # Shared data types
└── Makefile               # Build automation

🎯 Goals

DockerShield helps you answer critical security questions like:

  • Are any of my database ports exposed to the internet?
  • Is Docker bypassing my firewall (UFW/iptables)?
  • Is my SSH configuration secure (key-only auth, no root login)?
  • Is fail2ban protecting my server from brute-force attacks?
  • Are there critical security updates I need to install?
  • Which containers are on which networks?

Perfect for indie developers running 1-10 VPS instances who need comprehensive security visibility without enterprise-grade complexity or cost.

πŸ“ License

Apache License 2.0 - see LICENSE file for details

🀝 Contributing

Contributions are welcome! We're actively looking for:

  • πŸ› Bug reports and fixes
  • ✨ Feature suggestions and implementations
  • πŸ“š Documentation improvements
  • πŸ§ͺ Test coverage expansion
  • 🌍 Translations and internationalization

Getting Started:

  1. Check out good first issues
  2. Read our Contributing Guide
  3. Review the Code of Conduct
  4. Fork, code, and submit a PR!

Development Setup:

git clone https://github.com/adrian13508/dockershield.git
cd dockershield
go mod tidy
make build
make test

See CONTRIBUTING.md for detailed guidelines.

πŸ”’ Security

Found a security vulnerability? Please read our Security Policy for responsible disclosure guidelines.

πŸ“š Documentation

πŸ’¬ Support


Version: 0.1.0 License: Apache 2.0 Status: Active Development 🟒

Made with ❀️ for the self-hosting community

About

Catch exposed ports before hackers do

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published