Bobcares

Block IP of Brute Force by CSF on DirectAdmin

by | Oct 31, 2021

Let us discuss how to block IP of Brute Force by CSF on DirectAdmin.

As part of our Server Management Services, we assist our customers with several DirectAdmin queries.

Today, let us see how we can perform this in Linux VPS Servers and Dedicated Linux Servers.

 

Block IP of Brute Force by CSF on DirectAdmin

For automatic IP blocking of Brute Force by CFS, our Support Techs recommend the steps below:

1. Initially, we go to the path below:

cd /usr/local/directadmin/scripts/custom/

2. In order to begin, we back up the block_ip.sh and unblock_ip.sh files:

cp block_ip.sh block_ip.sh.bak cp unblock_ip.sh unblock_ip.sh.bak

In some case the above files may not exist in the “usr / local / directadmin / scripts / custom” path.

Then, we will encounter the said error.

However, this will not cause any problems in the continuation of the process.

cp: cannot stat `block_ip.sh': No such file or directory cp: cannot stat `unblock_ip.sh': No such file or directory

3. We need to download the appropriate version using the following commands:

cd /usr/local/directadmin/scripts/custom/ wget -O block_ip.sh http://files.plugins-da.net/dl/csf_block_ip.sh.txt wget -O unblock_ip.sh http://files.plugins-da.net/dl/csf_unblock_ip.sh.txt wget -O show_blocked_ips.sh http://files.plugins-da.net/dl/csf_show_blocked_ips.sh.txt chmod 700 block_ip.sh show_blocked_ips.sh unblock_ip.sh

4. Then to create the files, blocked_ips, and exempt_ips in the root path, we run:

touch /root/blocked_ips.txt touch /root/exempt_ips.txt

So far, the IPs do not block automatically by the CSF. Instead, it creates a button in the brute Force Monitor for the admin to block the desired IP.

Now, let us see how our Support Techs block IPs automatically.

To do so, we need to install the following script and follow the next steps.

5. Then to automatically block the IP we run the following command:

cd /usr/local/directadmin/scripts/custom wget -O brute_force_notice_ip.sh http://files.directadmin.com/services/all/brute_force_notice_ip.sh chmod 700 brute_force_notice_ip.sh

6. In order to not overwrite the roles and roles of iptables with CSF, we turn off the execution of this service with the help of the following commands on the server.

chkconfig iptables off chkconfig ip6tables off mv /etc/init.d/iptables /etc/init.d/iptables~moved echo -e '#!/bin/bash\nexit 0;' > /etc/init.d/iptables chmod 755 /etc/init.d/iptables chkconfig iptables on chkconfig ip6tables on service iptables start

7. Once done, we make sure the IPs are blocked correctly.

For that, we can try the following command:

csf –g IP

[Stuck in between? We are here for you]

 

Conclusion

In short, we saw how our Support Techs fix the DirectAdmin error for our customers.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

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

Never again lose customers to poor
server speed! Let us help you.