[CentOS] [OT] odd network question

Mon Aug 5 07:50:31 UTC 2019
Jon LaBadie <jcu at labadie.us>

On Sat, Aug 03, 2019 at 04:50:05PM +0100, Giles Coochey wrote:
> On 02/08/2019 19:38, Jon LaBadie wrote:
> > On Fri, Aug 02, 2019 at 10:19:49AM -0400, mark wrote:
> > > Fred Smith wrote:
> > > > On Fri, Aug 02, 2019 at 09:28:23AM -0400, mark wrote:
> > > <MVNCH>
> I've been using fail2ban for some time, I have a number of ports open to the
> Internet - SSH, SMTP, IMAPS, HTTP and HTTPS on my external subnet.
> This thread made me look at how fail2ban was doing, and I noticed that it
> wasn't particularly working too well for SSH, as I have turned off password
> authentication, so I edited the filters a little, and found it started
> filtering some more IPs. I found on my firewall that there were something
> like 500 active connection states to SSH - it looked like a scanning tool
> was just hanging and sending many connections, the same thing for about
> three remote IPs - I put a manual block on these at the firewall.
> The firewall has a block feature, which allows me to enter URLs which point
> to lists of IPs (Blocklists) and block traffic from those IPs at the
> firewall.
> It's designed to use these types of IP feeds: http://iplists.firehol.org/
> Well, there's nothing stopping me running a cron-job on my Centos boxes to
> do the following:
> iptables -L -n | awk '$1=="REJECT" && $4!="" {print $4}' >
> /tmp/banned
> I can then transfer the banned file to a web-server and block the bad IP
> addresses completely from my network. I like this as if a system is
> brute-forcing my SSH server, I can now block it from all resources on the
> network, and stop the attempts even reaching the internal hosts.

I've found the default 10min bans hardly bother some attackers.
So I've added the "recidive" feature of fail2ban.  After the
second 10min ban, the attacker is blocked for 1 week.

Jon H. LaBadie                 jon at jgcomp.com
 11226 South Shore Rd.          (703) 787-0688 (H)
 Reston, VA  20190              (703) 935-6720 (C)