HeadlinesBriefing favicon HeadlinesBriefing.com

VPS Security: 2,331 Attacks Reveal Docker/UFW Weaknesses

DEV Community •
×

Running a VPS on a $5 plan feels empowering, but a recent post by Solomon Aboyeji shows that the illusion of security evaporates quickly. Within 30 days, attackers logged in 2,331 times, banning 235 IPs every 30‑60 minutes. The attacks exploited exposed MongoDB ports and the fact that Docker bypasses UFW rules for remote access sessions.

Aboyeji’s script tackles the problem in four steps. First, it installs ufw-docker to reorder iptables so UFW checks precede Docker’s chains, closing the firewall hole. Second, it defaults to deny all traffic, opening only 22, 80, 443, and 3000, keeping containers isolated from unauthorized access while maintaining service availability for legitimate users and developers internally.

The final two steps harden SSH: password logins are disabled, root access is blocked, and key‑based authentication becomes mandatory. Finally, fail2ban is installed, banning any host after three failed attempts for 24 hours. The GitHub repo, secure‑vps, lets operators test the hardening on a disposable server before deployment to ensure security post deployment and monitoring.