Jump to content

UnBlockIP - Free CSF Unblock Module for WHMCS


Recommended Posts

I am wondering if there is a way to flag dedicated or VPS clients to allow them access to the module

 

we have dedicated and vps clients that have managed cpanel installs that dont have root access (they have reseller access) but we cant set them in whmcs to be identified as a cpanel server (because of provisioning modules in use)

 

has anyone seen a way to show the module to these clients... perhaps by having an if statement or something?

Link to comment
Share on other sites

Sorry if this was posted already, did not have time to read 11 pages :)

 

I have CSF set with LF_SELECT = 1 so I get:

 

tcp|in|d=2096|s=xx.yy.ww.zz # 'lfd: (cpanel) Failed cPanel login from xx.yy.ww.zz: 5 in the last 3600 secs' - Mon Oct 7 11:48:10 2013

 

This line does not get recognized. However, if I manually add a new line with the same IP only, and try to unblock with the addon BOTH lines get removed from the blocked IP list.

 

Please verify this

 

csf v6.36

WHMCS 5.2.8

UnBlockIP 1.91

Link to comment
Share on other sites

Sorry if this was posted already, did not have time to read 11 pages :)

 

I have CSF set with LF_SELECT = 1 so I get:

 

tcp|in|d=2096|s=xx.yy.ww.zz # 'lfd: (cpanel) Failed cPanel login from xx.yy.ww.zz: 5 in the last 3600 secs' - Mon Oct 7 11:48:10 2013

 

This line does not get recognized. However, if I manually add a new line with the same IP only, and try to unblock with the addon BOTH lines get removed from the blocked IP list.

 

Please verify this

 

csf v6.36

WHMCS 5.2.8

UnBlockIP 1.91

 

If you are using "Advanced Allow/Deny Filters" in CSF this addon won't work.

 

I had reported this, check the link http://forum.whmcs.com/showthread.php?49558-UnBlockIP-Free-WHMCS-CSF-Unblock-Module-from-ServerPing-net&p=239846#post239846

Link to comment
Share on other sites

  • 2 weeks later...
If you are using "Advanced Allow/Deny Filters" in CSF this addon won't work.

 

I had reported this, check the link http://forum.whmcs.com/showthread.php?49558-UnBlockIP-Free-WHMCS-CSF-Unblock-Module-from-ServerPing-net&p=239846#post239846

 

Well I don't see a reason why it does not work :)

 

For example, the $data variable in the search_for_ip function returns:

 

Chain            num   pkts bytes target     prot opt in     out     source               destination         

DENYIN           30       0     0 DROP       tcp  --  !lo    *       62.48.35.136         0.0.0.0/0           tcp dpt:2077 
DENYIN           31       0     0 DROP       tcp  --  !lo    *       62.48.35.136         0.0.0.0/0           tcp dpt:2078
DENYIN           32       0     0 DROP       tcp  --  !lo    *       62.48.35.136         0.0.0.0/0           tcp dpt:2082
DENYIN           33     209 17532 DROP       tcp  --  !lo    *       62.48.35.136         0.0.0.0/0           tcp dpt:2083
DENYIN           34       0     0 DROP       tcp  --  !lo    *       62.48.35.136         0.0.0.0/0           tcp dpt:2086
DENYIN           35       0     0 DROP       tcp  --  !lo    *       62.48.35.136         0.0.0.0/0           tcp dpt:2087
DENYIN           36       0     0 DROP       tcp  --  !lo    *       62.48.35.136         0.0.0.0/0           tcp dpt:2095
DENYIN           37       0     0 DROP       tcp  --  !lo    *       62.48.35.136         0.0.0.0/0           tcp dpt:2096
DENYIN           38       0     0 DROP       all  --  !lo    *       62.48.35.136         0.0.0.0/0


ip6tables:

Chain            num   pkts bytes target     prot opt in     out     source               destination         
No matches found for 62.48.35.136 in ip6tables

Temporary Blocks: IP:62.48.35.136 Port: Dir:in TTL:3600 (test)

 

So IMHO one preg_match (DENYIN) is needed to resolve this

Link to comment
Share on other sites

CSF may have been updated recently to support this but in the past a CSF grep command would not properly return if you are using Advanced Allow/Deny Filters which our module uses to check for blocks.

 

If you have a support plan with us you can send us an email and we can look into this further again to see if this is something CSF has changed.

Link to comment
Share on other sites

  • 3 weeks later...

Hi. Is there a similar module for CPHulk inside of WHMCS? I have a travel agency client with lots of agent email addresses. They end up blocking themselves in CPHulk every week or two, and of course it's a panic if they can't pickup their mail. I'm looking for a way for them to get into their WHMCS client area, and to clear themselves out of CPHulk. Thank you.

Link to comment
Share on other sites

  • 3 weeks later...
Unless something has changed recently the instructions explain it.

http://projects.serverping.net/projects/unblockip/wiki/Installation_Instructions

 

thank you for your reply, all seems ok i have followed the instructions, it appered in the correct client menu part, but when i click the unblock ip menu the page is correct but client menu does not exist.

 

turbo.JPG

Link to comment
Share on other sites

Unless something has changed recently the instructions explain it.

http://projects.serverping.net/projects/unblockip/wiki/Installation_Instructions

 

thank you for your reply, all seems ok i have followed the instructions, it appered in the correct client menu part, but when i click the unblock ip menu the page is correct but client menu does not exist.

 

[ATTACH=CONFIG]5582[/ATTACH]

Link to comment
Share on other sites

Unless something has changed recently the instructions explain it.

http://projects.serverping.net/projects/unblockip/wiki/Installation_Instructions

 

thank you for your reply, all seems ok i have followed the instructions, it appered in the correct client menu part, but when i click the unblock ip menu the page is correct but client menu does not exist.

 

[ATTACH=CONFIG]5582[/ATTACH]

Link to comment
Share on other sites

Unless something has changed recently the instructions explain it.

http://projects.serverping.net/projects/unblockip/wiki/Installation_Instructions

 

thank you for your reply, all seems ok i have followed the instructions, it appered in the correct client menu part, but when i click the unblock ip menu the page is correct but client menu does not exist.

 

[ATTACH=CONFIG]5582[/ATTACH]

Link to comment
Share on other sites

the problem is when you press the menu item, the client menu is missing, please check the photo

 

- - - Updated - - -

 

please check the below image.

 

turbo.JPG

 

- - - Updated - - -

 

please check the below image.

 

turbo.JPG

 

- - - Updated - - -

 

please check the below image.

 

turbo.JPG

Link to comment
Share on other sites

  • 3 months later...

Could you give some instructions on how this addon works as far as referencing the template files? For me it does not seem to reference any .tpl file and it seem to skip part of my header, which break the design quite badly...I would appreciate some pointerns on how to modify the way this addon reference the .tpl files of the current theme or advice on how to fix the situation?

Link to comment
Share on other sites

  • 1 month later...
  • 3 months later...

Does this addon still works?

 

WHMCS 5.3.8

DirectAdmin 1.45.4

CSF 7.07

 

I installed this addon and always got the message: 'The IP xxx.xxx.xxx.xx is not blocked on any active server.'

I tried it with both: IP's that are temporarily and permanent blocked in CSF.

I always got the same message.

 

Seems not working anymore.

Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...

Hi,

 

This addon is just great, thank you for the contribution.

 

I had a problem saying the IP was not blocked (when it was) but I realised that I was not using a root access in WHMCS, hence the error.

 

However, the addon works perfectly fine with the latest WHMCS version (5.3.10)

Edited by sitesme
Link to comment
Share on other sites

  • 2 months later...

When Directadmin users have problems with this module? I've managed it to work again after some head banging hours ;-)

Its seems the Curl connect is using $srv_ip variable in the Directadmin urls.

 

But If you have SSL activated in Directadmin together with this feature below (it redirects from ip to forced hostname.)

http://www.directadmin.com/features.php?id=917 it doesn't work anymore (all servers are showing no blocks)

 

to change this behavior change following files with functions..

 

changes in functions.php

 

if (number_of_recent_unblocks($whmcs_client_id, $unblock_interval) < $max_recent_blocks) {
	$query = "SELECT DISTINCT(s.ipaddress), s.username, s.password, s.accesshash, s.secure, s.name, s.type[b], s.hostname[/b]
				FROM tblservers s, tblhosting h
				WHERE s.id = h.server AND h.userid = $whmcs_client_id AND (s.type = 'cpanel' or s.type = 'directadmin') and h.domainstatus = 'Active'";
	$mysql_data = mysql_query($query);

	while ($server = mysql_fetch_array($mysql_data)) {

		$srv_ip = $server[0];
		$srv_user = $server[1];
		$srv_pass = $server[2];
		$srv_hash = $server[3];
		$srv_secure = $server[4];
		$srv_type = $server['type'];
[b]$srv_host = $server['hostname'];[/b]

		$auth_valid = false;
		if ($srv_hash) {
			$authhash = preg_replace("'(\r|\n)'","",$srv_hash);
			$authmethod = "accesshash";
			$auth_valid = true;
		} elseif ($srv_pass) {
			$authmethod = "basic";
			$authhash = decrypt($srv_pass);
			$auth_valid = true;
		} else {
			$errors = $errors . $lang_file['cannot_connect']. " ". $server["name"];
		}

		if ($srv_secure) {
          if ($srv_type == "directadmin") {
            $url = "https://[b]$srv_host[/b]:2222/CMD_PLUGINS_ADMIN/csf/index.html";
          }
          else {	    
            $url = "https://$srv_ip:2087/cgi/configserver/csf.cgi";
          }
		} else {
          if ($srv_type == "directadmin") {
            $url = "http://[b]$srv_host[/b]:2222/CMD_PLUGINS_ADMIN/csf/index.html";
          }
          else {	    
            $url = "http://$srv_ip:2086/cgi/configserver/csf.cgi";
          }
        }

and unblockip.php

 

function process_admin_request($ip, $server_id) {
  $errors = "";
  $alerts = "";
  $block_found = false;
  $results = array();

  if ($server_id == "all") {
   $server_id = "";
  }
  else {
   $server_id = " AND id = ". (int)$server_id;
  }

  $query = "SELECT DISTINCT(s.ipaddress), s.username, s.password, s.accesshash, s.secure, s.name, s.type[b], s.hostname[/b]					FROM tblservers s
				WHERE (s.type = 'cpanel' or s.type='directadmin') and s.disabled = 0 $server_id";
  $mysql_data = full_query($query);

  while ($server = mysql_fetch_array($mysql_data)) {
    $srv_ip = $server[0];
 $srv_user = $server[1];
 $srv_pass = $server[2];
 $srv_hash = $server[3];
 $srv_secure = $server[4];
 $srv_type = $server['type'];
[b]$srv_host = $server['hostname'];[/b]

 $auth_valid = false;
 if ($srv_hash) {
   $authhash = preg_replace("'(\r|\n)'","",$srv_hash);
   $authmethod = "accesshash";
   $auth_valid = true;
  } 
  elseif ($srv_pass) {
   $authmethod = "basic";
   $authhash = decrypt($srv_pass);
   $auth_valid = true;
  } else {
    $errors = $errors . "Cannot connect to ". $server["name"];
  }

  if ($srv_secure) {
    if ($srv_type == "directadmin") {
      $url = "https://[b]$srv_host[/b]:2222/CMD_PLUGINS_ADMIN/csf/index.html";
    }
    else {	    
      $url = "https://$srv_ip:2087/cgi/configserver/csf.cgi";
    }
  } 
  else {
    if ($srv_type == "directadmin") {
      $url = "http://[b]$srv_host[/b]:2222/CMD_PLUGINS_ADMIN/csf/index.html";
    }
    else {	    
      $url = "http://$srv_ip:2086/cgi/configserver/csf.cgi";
    }
  }

  if ($auth_valid) {
    $reason = search_for_ip($ip, $url, $srv_user, $authhash, $authmethod);
	if ($reason != "") {
		  if ($srv_user != "root" && $srv_type == 'cpanel') {
			$query_url = $url.'?action=qkill&ip='.$ip;  
		  }
		  else {
   		    $query_url = $url.'?action=kill&ip='.$ip;  
		  }
		  $data = excecute_whm_csf_command($query_url, $srv_user, $authhash, $authmethod);
  	          if (!preg_match('/Unblock '.$ip.'/s', $data)) {
            $query_url = $url.'?action=kill&ip='.$ip;
  	        $data = excecute_whm_csf_command($query_url, $srv_user, $authhash, $authmethod);
             }

		  $alerts = $alerts . "IP Block was removed from server: " . $server["name"] . "<br>" . "Reason: ". $reason . "<br>";
		  logActivity("Unblocked the IP Address " . $ip . " from " . $server["name"]);
   	      $block_found = true;
		}
  	    } 		
  }   

 

Update:

its seems that the adding of the line "curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);" can also fix this redirect (not tested)

 

Above script code change is tested on:

 

WHMCS 5.3.11

CSF 7.62

Directadmin 1.47

 

 

Regards,

 

Marco

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated