You set up your home server. Installed Docker, spun up some containers, maybe even got a reverse proxy working. You feel pretty good about it.
Then you check your SSH logs and see 10,000 failed login attempts from the last 24 hours.
I've been hardening home servers for years, and I consistently see the same gaps — even from experienced developers. Here's the checklist I run through on every new setup.
SSH Hardening (The Basics Everyone Skips)
You already disabled password auth and use keys, right? Good. But did you also:
# Change the default SSH port (stops 90% of automated scans)
sudo sed -i 's/#Port 22/Port 2222/' /etc/ssh/sshd_config
# Disable root login entirely
sudo sed -i 's/#PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config
# Limit SSH to specific users
echo "AllowUsers yourusername" | sudo tee -a /etc/ssh/sshd_config
# Set idle timeout (disconnects idle sessions after 5 minutes)
echo "ClientAliveInterval 300" | sudo tee -a /etc/ssh/sshd_config
echo "ClientAliveCountMax 0" | sudo tee -a /etc/ssh/sshd_config
sudo systemctl restart sshd
Install fail2ban — it's non-negotiable:
sudo apt install fail2ban -y
sudo systemctl enable --now fail2ban
The default config bans IPs after 5 failed attempts for 10 minutes. For SSH, I bump it to 3 attempts and a 1-hour ban.
The Docker Firewall Bypass (Most People Don't Know About)
This is the one that gets people. Docker modifies iptables directly, which means:
If you expose a container port with
-p 8080:80, that port is accessible from the internet even if UFW is blocking port 8080. Docker's iptables rules take precedence.
The fix:
# Create or edit /etc/docker/daemon.json
sudo tee /etc/docker/daemon.json <<'EOF'
{
"iptables": false
}
EOF
sudo systemctl restart docker
Then manage Docker container access through your reverse proxy instead of exposing ports directly. Never use -p 0.0.0.0:PORT:PORT on an internet-facing server.
Reverse Proxy: Your Single Point of Entry
Every service should be behind a reverse proxy. My preference is Caddy (automatic HTTPS, zero-config TLS), but Nginx works too.
The key principle: containers bind to localhost only, and the reverse proxy is the only thing listening on ports 80/443.
# docker-compose.yml
services:
myapp:
ports:
- "127.0.0.1:8080:80" # localhost only, NOT 0.0.0.0
Automated Backups (That You've Actually Tested)
The backup you haven't tested restoring is not a backup. It's a hope.
# Install restic
sudo apt install restic -y
# Initialize a backup repo
restic init --repo /mnt/backup/server
# Backup your important directories
restic backup /home /etc /opt/docker-data --repo /mnt/backup/server
# Test the restore (do this monthly)
restic restore latest --target /tmp/restore-test --repo /mnt/backup/server
The Full 50-Point Checklist
This article covers the highlights, but the complete checklist includes:
- Container security (read-only filesystems, user namespaces, resource limits)
- Monitoring stack setup (Grafana + Loki + Prometheus)
- Unattended security updates configuration
- Cloudflare Tunnel as an alternative to port forwarding
- Network segmentation with VLANs
- Log aggregation and alerting
What's your home server security setup look like? Drop your must-have hardening steps in the comments.