Gold CSF Auto Unblock

SiteAutoBackup.Com

INSTALLATION

PART 1 - Admin Area Installation

  1. Download your copy of Gold CSF Auto Unblock from your WHMCS Gold client area
  2. Unzip the files and upload everything inside the WHMCS folder into your WHMCS installation folder
  3. Log in to your WHMCS admin area
  4. Go to UTILITIES > Addon Modules
  5. Click on Gold-Csfunblock
  6. Enter your WHMCS Gold license key there
  7. Follow the on screen installation guide and define all required parameters on the configuration page

The configuration page is self explanatory and should be very easy to configure.

Important Note: This plugin use the hostname of each server you set in WHMCS in order to know which IP to unblock on which server. You must provide correct server hostname on your WHMCS server configuration exactly as the server hostname is set on your physical server.

How to find out your server's actual hostname:

Just log in to your server using SSH and type hostname

 

PART 2 - The Servers

On each of the server you setup in your WHMCS, do this step.

  1. Log in to SSH as root and type hostname and make sure the hostname matches the one you setup in WHMCS
  2. Open up the whmcs_update.php and whmcs_unblock.php files and update the files with your WHMCS database connection settings.
  3. Go to /etc/csf and place these two files there: whmcs_update.php and whmcs_unblock.php
    •      whmcs_update.php - this file updates your WHMCS database with the list of IPs that is being blocked on this server
    •      whmcs_unblock.php - this file will perform actions to unblock/whitelist/flush the IPs that needs to be worked on and restarts CSF everytime an update has been implemented on your CSF list files.
  4. Setup a cronjob for these two files to run. We recommend running whmcs_update.php every 5 minutes and whmcs_unblock every 15 minutes.
    •      */5 * * * * php -q /etc/csf/whmcs_update.php > /dev/null 2>&1
    •      */15 * * * * php -q /etc/csf/whmcs_unblock.php > /dev/null 2>&1

The two files you need to place on your /etc/csf on each server is NOT encoded (open source) so you can see what these two scripts are doing.You are welcome to modify the scripts, but we will not support modified scripts.

 

PART 3 - The WHMCS Client Area

Open up your WHMCS client area product details template folder (the one you use), for example: /templates/portal/clientareaproductdetails.tpl

Just after {if $username} place this code:

 

<table cellpadding="4" cellspacing="4" align="center"><tr><td>

<center><font color="red"><strong>Can't Connect? Gain Access Below</strong></font></center><br />

We enforce a strict security and firewall systems on all of our servers to prevent abuse and attacks from outside of our network. If you are unable to connect to your server/account at the moment, please click on the UNBLOCK ME button below and we will unblock your computer from our firewall.

<br /><br />You should be able to access the server within 15 minutes of clicking the button below. Please make sure you do not have any FAILED log in attempt afterwards. Our firewall trace every single failed log in attempt to your account. This includes, failed attempt to access FTP, cPanel, even your Mails.<br /><br />

<center>

<form method="post" action="csf.php">

<input type="hidden" value="{$username}" name="hosting_username">

<input type="submit" value="UNBLOCK ME NOW">

</form>

</center>

</td></tr></table>

 

 

Pay close attention to the form elements as they are required to be just like that. Do not alter it. You can change everything else.

That's it. You're now set. Every time a client clicks on the UNBLOCK ME button, their IP will automatically unblocked within the time frame you set your whmcs_unblock.php cron to run (if you set to 15 minutes, your client needs to wait 15 minutes or less).

 

HOW TO AUTOMATICALLY SYNCRONIZE CSF RULES BETWEEN SERVERS

You don't need a module to do just this. All you need to do is to run a cron which will syncronize your csf.conf file between all servers and that's it. Here is an example:

  1. Setup a Master Server which has your master CSF configuration which gets updated every now and then. For the sake of this example, let's assign this master server's IP as 127.0.0.77
  2. Then from all the other servers which want to "copy" the CSF rules (csf.conf) of this master server simply run a cron job, say every day, ever hour, or whatever time frame you want to use and run this cron (in this example every day)

127.0.0.77 is the Master Server's IP Address where you want to syncronize CSF rules from

ftp_user is the FTP Username which has access to your /etc/csf folder - make a new FTP account for this

ftp_pwd is the FTP Password

That's it. The file will only be updated when there is a new version, otherwise wget will not get the file if it's just the same file. That is why we use option -N -P