How do you handle invalid ssh logins?
Are you accepting SSH connections from the entire world? Why? If
you are accepting such connections from a limited number of hosts and
you have users on those "authorized" hosts that are rattling the keys,
then maybe you need to re-think the idea of allowing those hosts. (My
firewall allows connections through from a /22 and two /24s "outside"
because I can't see any reason to allow connections from you or anyone
else that I haven't approved in advance, and I really don't expect
authorized users to be connecting from Korea, Kenya, Kuwait or
Kazakhstan or a lot of other places either)
Why allow them in the first place? (I dislike auto-blocking
mechanisms like this, as they can be used to have you shoot your
own foot. Requiring four invalid logins [over how long?] to trigger
the response reduces, but does not eliminate the chance to self-DOS your system.)
That's a good technique, but your secret port-number selector needs work.
Set access rules that ONLY allow sftp access to those specific IP
addresses. Are you a "world traveler" who may suddenly travel to
some exotic locations and need access without being able to pre-allow
the appropriate addresses? Set up a 'port-knocking' function, where
you must first attempt a connection to some specific _closed_ port
[compton ~]$ ls -l | tail -200 | head -1 | awk '{ print $5 }'
6365
[compton ~]$
like 'telnet server 6365' and have your firewall then open a rule to
that source IP for a minute that allows you to connect to whatever
port you've hidden the server on. You then SSH/sftp/what-ever in, and
the firewall 'ESTABLISHED' rule maintains the connection after the one
minute period. Note to the whiners who think this is security by
obscurity, you STILL NEED TO AUTHENTICATE - it's not replacing the
existing authentication mechanism. All it's doing is ignoring those
who don't know how to even start to connect. Also. I'm showing use of
'telnet' to generate the 'knock' packet to the CLOSED port because
that client is easy to use - you could equally try using your web
browser if that's the only application you can use - but it doesn't
matter because no connection will be made. If you're worrying
about someone tripping over the knock port while port-scanning, you
can add firewall rules that close the temporarily opened port if they
hit a nearby port before hitting the one where the server is (which
means having your server on [say] 2019, and having "close it" sensors
on 2007 and 2030 in this example).
What connection attempts?
Old guy
|