You've got a VPS? That's cool! Whether you are hosting a website, game server, or just experimenting, you need to secure it. And guess what? Hackers prefer to target new or unsecured servers. Let me demonstrate some simple and best methods to secure a VPS from bruteforce and DDos attacks Close Unused Ports.
Here's how to arrange it:
So, finally, you should give your server the respect it deserves. Because it might be quite difficult to get it repaired if it breaks down.
Here are Methods to Secure a VPS from Bruteforce & DDoS?
Hackers will seek open ports as an entryway into your server. The fewer ports open, the less convenient it is for them.Here's what you do:
- Alter your SSH port (the one you login with). Don't use the standard 22. Choose a random number such as 2222.
- Utilize a firewall such as UFW. It allows you to block all the ports and only open the ones that you absolutely need.
- Want to get extra secure? Use port knocking. You "knock" on a secret method to allow your port for a few secons.
Why have the front door open when you don't have to?
Use SSH Keys Rather Than Passwords
Passwords may be guessed. SSH keys can't (not yet anyway).Here's how to arrange it:
- Create SSH key pairs on your machine.
- Paste the public key onto your VPS.
- Disable password login in your server configuration (PasswordAuthentication no).
Methods to Shield Against DDoS Attacks
A DDoS attack is when one person directs mountains of phony traffic to bring your VPS crashing down. It's like a jam on your server.Here's how to resist:
- Use Cloudflare. It obscures your VPS IP and prevents nasty traffic from reaching you.
- Install Fail2Ban. It monitors nasty login attempts and blocks those IPs.
- Use rate limiting to prevent one IP from sending a flood of requests too quickly.
Keep Everything Up to Date
Old software is like a broken window. Hackers can slide in.What to do:
- Run updates frequently using apt update && apt upgrade (or your system's command).
- Update tools such as SSH, Nginx, or Fail2Ban as well.
- Enable auto-updates to save you time.
So, finally, you should give your server the respect it deserves. Because it might be quite difficult to get it repaired if it breaks down.