• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Startup Hero

The Official Blog Of Name Hero

Learn To Fly Above The Competition Get Started
  • HomeWelcome
  • CoursesVideo Training Center
  • About UsWhat is StartupHero?
  • BlogGet the latest
  • Start HereStartup 101
  • SpeakingPodcast & Media
  • ResourcesTools to help You
    • Reselling WordPress Hosting
    • Resell Hero
    • How To Start A Blog
  • NameHeroCloud Web Hosting

How To Prevent Simple DDoS Attacks On A VPS

By Bhagwad Park on November 28, 2022 0

How To Prevent Simple DDoS Attacks On A VPS

For ordinary people, VPS security measures need to start with preventing the most frequent threats and only later focus on the rare ones. A true DDoS attack can be impossible to mitigate for a single server – merely processing each request uses some resources, and a full-fledged attack can quickly cripple a server. For example, a recent Cloudflare DDoS attack reached a peak of 26 million requests per second! If something like that were to target your VPS server, there’s no defense.

But we can focus on the smaller, more common attacks. These are also very easy to orchestrate and so demand a response using regular security mechanisms. Luckily, VPS owners have the ConfigServer Firewall to deal with this.

ConfigServer Firewall Comes Pre-Installed on NameHero VPSs

All VPS purchases through NameHero are fully-managed. This means that the team takes care of basic security and installs and configures crucial software like web and mail servers. It also includes the ConfigServer Firewall (CSF) tool that makes monitoring and managing VPS security much easier than manually modifying IP tables.

Thanks to CSF’s easy management via a simple text file, you can block simple DDoS attacks automatically in just a few clicks. In this article, I’ll show you how to do this via the GUI instead of manually modifying text files.

Access the CSF Configuration Screen

The server I use with NameHero is InterWorx, though NameHero installs CSF on all its dashboards. For InterWorx, you can find the ConfigServer Firewall sub-section on the left-hand side. If you’re using cPanel/WHM, you should find it under the “Plugins” section. Open it and click “Firewall Configuration” like this:

ConfigServer Firewall Security Firewall Configuration
ConfigServer Firewall Security Firewall Configuration

This brings up the ConfigServer Firewall configuration screen.

Configure CSF to Block DDoS Attacks

Using your browser’s search function, search for “Connection Tracking”. Here are the variable values I use for my VPS:

CT_LIMIT = 150
CT_INTERVAL = 15
CT_BLOCK_TIME = 18000
CT_PORTS = 80,443

Here’s an explanation of what this means.

CT_LIMIT refers to the number of concurrent connections a particular IP address can have. If it’s higher than this number, then CSF will take action.

CT_INTERVAL is the time period in seconds at which CSF will check for the number of connections to any given IP. It’s possible that an IP address would have significantly bypassed the limit set by CT_LIMIT during this time. It can take a maximum of 15 seconds, in my case, before a DDoS attack can be stopped.

CT_BLOCK_TIME is the duration for which the relevant IP address is blocked.

CT_PORTS are the port numbers for which connections will be counted. I’ve set this to 80 and 443, reflecting HTTP and HTTPS connections. If you leave it blank, connections to ALL ports will be counted.

Save your changes and restart CSF.

Notification of Blocks

In the settings screen, you can also configure whether or not you’ll receive an e-mail notification when your server blocks an IP address via the CT_EMAIL_ALERT variable. I’ve set this to “On”, so when CSF blocks something, I get an email like this:

Email Message from lfd ConfigServer Firewall
Email Message from lfd ConfigServer Firewall

This email shows that this particular IP hit 277 connections before the CT_INTERVAL kicked in. You can see from the screenshot that the IP address was trying a bunch of ports, scanning for weaknesses. This is a classic example of the kind of DDoS attack that CSF was designed to handle. Simple to detect, easy to block, and easy to configure against.

You should get a dedicated security solution for anything more complicated than this. But when someone targets your IP address directly like this, even a reverse proxy like Cloudflare won’t help. So ensure you harden your server by enabling CSF’s DDoS protection to keep you safe!

Bhagwad Park Profile Picture
Bhagwad Park

I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Connect With Us!

Superhero Resources

Fix Common Issues

  • How To Setup Free And Automatic SSL Certificates
  • How To Setup Cloudflare With Railgun
  • How To Fix Memory Exhausted Errors In WordPress
  • How To Edit PHP Version/Upload Limit/Add Extensions
  • How To Move/Migrate Your Business To Name Hero

Free Guides

  • How To Setup NameHero Hosting
  • How To Create A Web Hosting Business With WordPress
  • How To Start A WordPress Blog
  • How To Migrate WordPress To A VPS
  • How To Speed Test And Optimize Your WordPress Website
  • Magento 2.X Installation Guide
  • How To Clean Up A WordPress Hack

Training

Recent Posts

  • The Best WordPress Plugin To Combat Plagiarism
  • Is It Time to Bring Back Blog Comments?
  • Two Filters That No Longer Work In Gutenberg (And Workarounds)
  • Migrating To The New Cloudflare Managed Rules Interface
  • How To Sort Posts By The “Last Modified” Date
  • How To Make WordPress Send E-mail From Another Address
Subscribe in a reader
  • Web Hosting
  • WordPress Hosting
  • Reseller Hosting
  • VPS Hosting
  • Twitter
  • Facebook
  • LinkedIn
  • YouTube
  • FTC Disclosure
  • Earnings Disclosure
  • Privacy Policy

Copyright © 2023 · Smart Passive Income Pro on Genesis Framework · WordPress · Log in