Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
lsthompson committed Jan 14, 2023
2 parents 816f6e0 + c9bf80f commit cd7dd5c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 70 deletions.
Binary file removed .DS_Store
Binary file not shown.
80 changes: 25 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,35 @@
# (WHMCS Addon Module) CSF Unblocker for WHM
# (WHMCS Addon Module) Firewall Unblocker for CSF

This extension provides the ability to self-service Unblock IPs from within WHMCS.

### Pre-requisites for usage:
### Pre-requisites for Usage:

- software-ConfigServer-csf (Reseller ACL in WHM needs this)
- whmuser:0:USE,ALLOW,DENY,GREP,UNBLOCK (/etc/csf/csf.resellers)
- `software-ConfigServer-csf` (Reseller ACL in WHM needs this enabled)
- `whmuser:0:USE,ALLOW,DENY,GREP,UNBLOCK` (/etc/csf/csf.resellers)

### Problems that need resolving:
### Installing the WHMCS Module:

- Client Area Output doesn't have necessary tokens; made elsewhere
- cPanel XML-API (deprecated 2017-2018) used, consider JSON-API
- Download the latest version of the module from the repository
- Upload the unblockip/ folder into WHMCS_WEBROOT/modules/addons/
- Visit WHMCS Admin > Settings > Addon Modules > enable the Module
- From there, it will be visible in the Admin and Client interfaces

### Documentation for old/new APIs:
### What the Module does for you:

- https://github.com/CpanelInc/xmlapi-php
- https://api.docs.cpanel.net/whm/introduction

### Client Area - problematic code:

The breadcrumb, template, and other keys that you need to display the client area output are returned by the `unblockip_clientarea()` function in the `unblockip.php` file. These keys are returned as an array which includes 'pagetitle', 'breadcrumb', 'templatefile', 'requirelogin', and 'vars'. These keys are used by the WHMCS system to render the client area output.

In order to fix the issue with the missing keys, you need to make sure that the `unblockip_show()` function in the `hooks.php` file is calling the `unblockip_clientarea()` function in the `unblockip.php` file, and that it is passing the correct variables to it. Once that is done, you can use the returned array of keys to display the client area output.

ie.

function unblockip_show($vars) {
search_for_ip_block($vars);
$returned_values = unblockip_clientarea($vars); // call the unblockip_clientarea function and store the returned value
if (!empty($returned_values)) {
$smarty = new Smarty();
$smarty->assign($returned_values);
$smarty->caching = false;
$smarty->compile_dir = $GLOBALS['templates_compiledir'];
$output = $smarty->fetch(dirname(__FILE__) . '/templates/clientareaoutput.tpl');
} else {
$output = "";
}
return $output;
}

### Feature sets for the original:

- Allow your customers to easily unblock their ip from your cPanel and DirectAdmin servers CSF firewall.
- Allow your customers to easily unblock their IP from your cPanel and DirectAdmin servers' CSF firewall.
- Checks for an IP Block across every cPanel and DirectAdmin server that is associated with an active service of the WHMCS Client.
- Uses a smarty template file to easily change look/feel of the addon.
- Uses a Smarty template file to easily change look/feel of the addon.
- Only shows the link to the module in your menu if the client has an active cPanel service.
- Displays the csf log entry so the client can see the reason why the ip was blocked.
- Logs successful unblocks in the whmcs client log.
- For added security you can set maximum number of unblocks a client can issue in a configurable minute time period.
- Quickly search for and unblock an IP address from all active cPanel servers from the WHMCS admin area.
- Automatically check for and remove an ip block when upon client login to WHMCS (Optional, disabled by default).
- Free and open source under the BSD Modified License.
- Easy installation

### System Requirements (update!)

- WHMCS 5.0.3 or later
- cPanel properly configured in WHMCS
- CSF 5.40 or later

### CSF Implementation Method

- cpsess##########/cgi/configserver/csf.cgi?action=kill&ip=103.103.103.103
- Displays the CSF log entry so the client can see the reason why the IP was blocked.
- Logs successful Unblocks in the WHMCS client log.
- For added security, you can set maximum number of Unblocks a client can issue in a configurable minute time period.
- Quickly search for and Unblock an IP Address from all active cPanel servers from the WHMCS admin area.
- Automatically check for and remove an IP Block when upon client login to WHMCS (Optional, disabled by default).
- Easy installation!

### System Requirements:

- Server Integrated OK
- WHMCS v8.x latest
- CSF 14.x latest
- PHP# latest
19 changes: 4 additions & 15 deletions unblockip/README.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
By using this software you agree to the BSD Modified license.

Copyright (c) 2023, The Network Crew Pty Ltd (TNC)
All rights reserved.

Copyright (c) 2012-2018, Hosting Playground Inc
All rights reserved.

This module code was forked from the UnblockMe CSF WHMCS Module 2.0 by Franksworld Solutions, LLC
Copyright (c) 2012, Franksworld Solutions, LLC
All rights reserved.


** INSTALLATION **


-CSF v12 or later is required to be on your servers in order for this plugin to work.
-WHMCS 7.x or later is required for this version of UnblockIP.
-Copy the entire unblockip folder to your WHMCS instances modules/addons folder.
-Ensure the files and folder have the proper ownership/permissions for your web server.
-Active the module by logging into the WHMCS Admin area. Click Setup->Addon Modules, then click Active next to the UnBlockIP Addon.
-Next, click configure and change any options and grant access to the admin interface accordingly.
-You will now be able to access the unblockip module from the client area by going to index.php?m=unblockip or if you are using the six theme, you will see a link to this module under Support.
-You can also access a search function from the WHMCS admin area under Addons->UnBlockIP which will search for an IP accross all active cPanel and DirectAdmin servers.
-A Menu item under Support is automatically added for your customers to access this module.

https://github.com/LEOPARD-host/WHMCS-Firewall-Unblocker-CSF/

0 comments on commit cd7dd5c

Please sign in to comment.