some random ip from india is trying to ssh into my ip all day??

May 18, 2017 162 views
Firewall Ubuntu

I've setup fail2ban according to the tutorial but this indian ip kept trying to authenticate in today after it was banned several times to the point where i increased the ban time for anyone trying to connect after 1 failed attempt to max?

What's the deal though, this is bad for me. If i make one mistake on my password i'm locked out. Is this guy trying to have me?

2 Answers

hi @ariziragoran ,

You can do many things to improve your security for example:

  • Setup OpenVPN server and use it to access your droplet using the private IP address and disable SSH on the public IP address.
  • You can use knockd to increase your security using a port koncking sequence to open your firewall just for your IP address.
  • You can change SSH port to a non-standard port.
  • You can try to setup firewall to block access from all IP addresses in India.

Hope any of these help you, contact me if you need help with any of them.

by Justin Ellingwood
Port knocking is a method of protecting your services behind a firewall until connection attempts are made to a specific sequence of ports in a certain amount of time. The firewall rules are then modified to allow access to the service and the user can connect as normal. In this article, we will discuss how to implement port knocking to add an extra layer of protection to your SSH daemon in order to dissuade attackers.

@ariziragoran

If you're on a MacBook, I'd recommend Algo as it'll handle setting up a VPN for you in a matter of just a few minutes -- pretty much hassle free.

https://github.com/trailofbits/algo

If you're not, or if you'd prefer to handle configuring the VPN on your own, there's a guide here that details how to go about setting up StrongSwan (which is what Algo uses).

https://www.digitalocean.com/community/tutorials/how-to-set-up-an-ikev2-vpn-server-with-strongswan-on-ubuntu-16-04

...

Algo will run on Linux and Windows, though my experience with it is limited to OS X / MacOS right now. They do provide instructions on how to set it up on the GitHub page though.

...

Once a VPN is setup, you'd simply firewall off Port 22 and only allow the static IP of your VPN to connect using:

ufw allow from VPN_IP to any port 22

Where VPN_IP is the IP address of your VPN. Just make sure you're connected to the VPN when you try to connect :-).

For example, if our VPN IP was 11.222.33.44, we'd run:

ufw allow from 11.222.33.44 to any port 22

Keep in mind, if you disconnect from the VPN, you won't be able to login. If you delete the Droplet that your VPN is on, you'll lock yourself out.

A virtual private network, or VPN, allows you to securely encrypt traffic as it travels through untrusted networks, such as those at the coffee shop, a conference, or an airport. IKEv2, or Internet Key Exchange v2, is a...
  • I'm on windows sadly, i got PIA for VPN and OpenSSH client. My VM is Ubuntu 16.04, i'll reply more after i try the link you posted. Thanks :D

  • I must have done something wrong because i followed the step by step instructions and i can authenticate in still to the public ip and i can use any ip to authenticate into the vpn even thought i limited it to my personal home ip.

Have another answer? Share your knowledge.