DEV Community

Hello, Worm!: Mapping SSH probes with a bash script

lbonanomi on May 08, 2019

Please note this is meant to be more fun than serious security advice Contributing to TLDR Pages has introduced me to tons of interesting and usef...
Collapse
 
ferricoxide profile image
Thomas H Jones II • Edited

I run fail2ban on any internet-facing systems I'm responsible for. This article mad me curious, so I did a quick scan of my failed logins log (on my personal VPS). Results are pretty grim:

  • logrotate had rotated the log earlier today ...so the following numbers are < 24 hours
  • 5732 attempts
  • 876 unique userids (used tr to convert them all to lowercase then ran that list through uniq)
  • 40,241 login failures cataloged by fail2ban
  • 12,433 IPs banned
  • 55 IPs within the ban-rotation window (1 hour for the ssh service, specifically)

The fail2ban stuff gets even more grim when extended to SMTP

Collapse
 
denisrasulev profile image
Denis Rasulev

+1 for fail2ban! Works like a charm. I've added ip-set to it lately and this has helped to reduce load significantly.

Collapse
 
ferricoxide profile image
Thomas H Jones II

Yeah. ip-set rules are great for ensuring across-boot persistence, too.

One of these days, I'll get around to integrating my deployment-configuration with a "phone home" hook that informs the configuration service, "when re-provisioning this host or provisioning new hosts, blacklist these IPs".

Collapse
 
lbonanomi profile image
lbonanomi

Thank you @bhilburn for the kind words and everyone for the warm reception!

Collapse
 
asto profile image
astodev

Looks like mapbox is down for now.. :/

Collapse
 
ferricoxide profile image
Thomas H Jones II

Unfortunately, as a consultant, I initiate connections from a wide variety of locations. Some of those locations block "weird" ports. So, moving to non-default port is generally not an option for me.