• DevOps
    Case Study

    How we built a resilient multi-account, multi-cloud solution for a Health Tech service provider!

    READ CASESTUDY
    icon

    24/7 DevOps as a Service

    Round-the-clock DevOps for uninterrupted efficiency.

    icon

    Infrastructure as a Code

    Crafting infrastructure with ingenious code.

    icon

    CI/CD Pipeline

    Automated CI/CD pipeline for seamless deployments.

    icon

    DevSecOps

    Integrated security in continuous DevOps practices.

    icon

    Hire DevOps Engineers

    Level up your team with DevOps visionaries.

    icon

    Consulting Services

    Navigate success with expert DevOps consulting.

  • TechOps
    Case Study

    How we built a scalable Odoo solution for a Travel Tech service provider!

    READ CASESTUDY

    WEB HOSTING SUPPORT

    icon

    HelpDesk Support

    Highly skilled 24/7 HelpDesk Support

    icon

    Product Support

    Boost your product support with our expertise.

    MANAGED SERVICES

    icon

    Server Management

    Don’t let server issues slow you down. Let us manage them for you.

    icon

    Server Monitoring

    Safeguard your server health with our comprehensive monitoring solutions.

    STAFF AUGMENTATION

    icon

    Hire an Admin

    Transform your business operations with our expert administrative support.

    icon

    Hire a Team

    Augment your workforce with highly skilled professionals from our diverse talent pool.

  • CloudOps
    Case Study

    How we helped a Private Deemed University in India, save US $3500/m on hosting charges!

    READ CASESTUDY
    icon

    AWS Well Architected Review

    Round-the-clock for uninterrupted efficiency

    icon

    Optimize

    Efficient CloudOps mastery for seamless cloud management

    icon

    Manage

    Automated CI/CD pipeline for seamless deployments

    icon

    Migrate

    Upgrade the journey, Migrate & Modernize seamlessly

    icon

    Modernize

    Simplify compliance complexities with our dedicated services

    icon

    FinOps as a Service

    FinOps as a Service

  • SecOps
    Case Study

    How we built a scalable Odoo solution for TravelTech service provider!

    READ CASESTUDY
    icon

    VAPT

    Vulnerability Assessment and Penetration Testing

    icon

    Source Code Review

    Ensuring source code security ans safe practices to reduce risks

    icon

    Security Consultation

    On demand services for improving server security

    icon

    System Hardening

    Reduced vulnerability and proactive protection

    icon

    Managed SoC

    Monitors and maintains system security. Quick response on incidents.

    icon

    Compliance as a Service

    Regulatory compliance, reduced risk

  • Insights
    Case Study

    How we helped a Private Deemed University in India, save US $3,500/m on hosting charges!

    READ CASESTUDY
    icon

    Blog

    Explore our latest articles and insights

    icon

    Case Studies

    Read about our client success stories

    icon

    Flipbook

    Explore our latest Flipbook

    icon

    Events

    Join us at upcoming events and conferences

    icon

    Webinars

    Watch our educational webinar series

  • Our Story
  • Contact Us

Interested to collaborate?

Get in touch with us!

Ready to elevate your business with certified cloud expertise? Contact us today to learn how our team can help you leverage cloud technology to drive growth, streamline operations, and enhance security.

  • AWSAWS
  • Azure CloudAzure Cloud
  • Google CloudGoogle Cloud
  • Akamai CloudAkamai Cloud
  • OVHOVH
  • Digital OceanDigital Ocean
  • HetznerHetzner
  • Kubernetes Consultancy Services
  • K8s & Cloud native Solutions
  • 24/7 Infrastructure Monitoring
  • DevOps as a Service
  • Cloud CI/CD Solutions
  • White Labeled MSP Support
  • Our story
  • Life@SupportSages
  • Insights
  • Careers
  • Events
  • Contact Us

Connect with us!


LinkedInFacebookXInstagramYouTube

aws partneraws advanced partner
SupportSages

Copyright © 2008 – 2026 SupportSages Pvt Ltd. All Rights Reserved.
Privacy PolicyLegal TermsData ProtectionCookie Policy

How To Configure CSF To Prevent DDoS Attacks

Navesh M N

  • 4 min read
How To Configure CSF To Prevent DDoS Attacks

Generating audio, please wait...

What is DDOS?

Before discussing how to control DDoS attack using CSF, let me explain what is DDOS attack and how it affects the smooth functioning of a server. DDoS stands for Distributed Denial of Service. It is an attempt to make an online service unavailable by traffic flooding from multiple sources. This makes it impossible to stop the attack by blocking a single IP and also it is difficult to find out the legitimate user from the traffic.

Controlling DDoS attack using CSF

Most of the cPanel servers will use Config Server Firewall(CSF) settings to prevent their servers. Here, I am going to provide some steps to manage a DDoS attack by tweaking the features in the CSF settings.

To check server is under DDoS attack:

You can run the below commands to check whether the server is under attack or not.

To show the number of connections and IP address,


netstat -alpn | grep :80 | awk '{print $4}' |awk -F: '{print $(NF-1)}' |sort | uniq -c | sort -n

If the server has more IP address configured in it, then the above result will help you to find which server IP is under attack.

For example, if the result is huge such as 1000, then you can suppose that the server is under DDoS attack

Tweaking the CSF settings:

1) Open CSF config file.


vi /etc/csf/csf.conf

2) Restricting number of simultaneous connections from a single IP would be quite effective in managing DDOS attacks. So reduce the value of CT_Limit to a reasonable range. Here I am changing it to 50


CT_LIMIT=50

It means that the maximum number of connections from an IP is 50. However the value is not an arbitrary one, you should change the value in accordance with your settings.

3) Change the connection tracking interval CT_INTERVAL


CT_INTERVEAL=30

Here, the connection tracking value is set to 30 seconds which is recommendable. If you decrease the interval to some lower value, then there will be a chance to generate false positives and will block legit connections.

4) To enable protection for a particular port, you can specify them in the configuration variable ‘CT_PORTS’. For eg. In majority of the cases, DDOS will be targeted to the web server and DNS server.  So the port numbers to be specified in such instances for a default installation are 80 and 53.

In the below example I am tweaking the protection for web server both for normal and SSL connections


CT_PORTS=80,443

5) By default, SYNFLOOD (SYNFLOOD = “0”) is disabled in CSF. If the server is under SYNFLOOD attack, you make it enable temporarily as below.

 SYNFLOOD = “1" 
SYNFLOOD_RATE = “30/s” 
SYNFLOOD_BURST = “30" 

If 30 connections are received from an IP/sec for 30 times, then it will block the concerned IP. You can adjust the SYNFLOOD_BURST rate depends on your server.

6. You can set a limit for the number of connections to particular port by altering the value “CONLIMIT”.

 CONNLIMIT = 80;20,443;15 

The above value will limit only 20 connections to the port 80 and 15 connections to the port 443 from single IP

7 ) Now the modifications are complete. In order to make them effective, we need to restart the CSF service with the new configuration parameters.

 /etc/init.d/csf restart

or

csf -r 

I hope, the above measure will help you to prevent the server from DDoS. Thank you for your time 🙂

Get Dedicated Webhosting Support Team

  • Linux
How To Configure CSF To Prevent DDoS Attacks

Anatomy of Root Name Servers and Domain Names

Anatomy of Root Name Servers and Domain Names
  • General
  • Training
logo

Domain Name Resolution Process

Domain Name Resolution Process
  • General
  • Linux
  • Training
logo

Posts by Navesh M N

Navesh is working as a sysadmin at SupportSages. He also contributing his SEO knowledge in business development. Apart from this, he is a keen observer of National and International politics. He is also a die-hard football fan.