Csf Unblock ip

urgido

Verified User
Joined
Oct 28, 2008
Messages
425
Location
MX
Hi
how is possible unblock an ip blocked by csf through directadmin?
we using curl and root hash in the past with cpanel and CodeIgniter as our crm framework.


Thanks
 
Or install the brute-force manager from Poralix (click) which is designed to work with DA and DA's BFM combined with CSF.
It's totally free and this way you can also unblock an ip from the DA panel.

Not via Codeigniter I guess, but you can unblock it via DA.
 
@Richard G, But can you unblock a IP on user level with the script from Poralix? I think what @urgido want is for the user to be able to unblock a IP, because admin can already unblock a IP directly using CSF.
 
@Richard G, But can you unblock a IP on user level with the script from Poralix? I think what @urgido want is for the user to be able to unblock a IP, because admin can already unblock a IP directly using CSF.
You are right!

This post and replies are misunderstanding my requirement.

I just need a code example (perl, python, c, c++ whatever else) to adapt it to PHP (CI) to give the facility to my team to unblock any customer's ip from our CRM.

Currently, we are able to unblok any IP using curl to communicate with root access hash of cpanel but with DA I don't know How I can improve this.

Thanks!
 
Last edited:
I have not tested UnBlockIP WHMCS module yet. But it is supposed to work on DirectAdmin. One of the reason I have not tested it yet, is because I do not feel sure about future development of the module, and I want to avoid starting to use it, if it only will be a few years before it might not work anylonger if it no longer is active maintained/supported. But when I get time, I am planning to test it. Generally I am afraid of using third party modules from companies I do not know, as I am afraid they will stop supporting it in the future. :)
 
This post and replies are misunderstanding my requirement.
Ok but then you should have been more clear with your question. ;)
how is possible unblock an ip blocked by csf through directadmin?

The rest was about the past with cpanel, not that you were looking for the same now too. ;)

Hope that module can fix things for you.
 
You can enable unblock with recaptcha on CSF

Just follow the instruction for the option at the csf config file

Blocked users will see white page with recaptcha and an text to solve it to unblock....

Unblock with recaptcha page is pretty ugly than Imunify one but that is an easy fix I just do not tested it if it rewritten on update
 
Last edited:
Hello everyone. The UnBlockIP module does not work in DirectAdmin.

It shows that IP is not blocked even though IP is blocked. By Debug nothing is returned.

<!doctype html>
<html class="vue-app">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8;">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>158.x.x.x - DirectAdmin v1.59.1</title>
<link rel="shortcut icon" href="/images/favicon.png" type="image/x-icon" />
<link href="/assets/css/app.css?ver=f2495d24f15b41652e3604215b518b3befa7f12e" type="text/css" rel="stylesheet"/>
</head>
<body class="preloader">
<div id="root" v-cloak>
<App>
<app-plugin-page slot="page:content" />
</App>
</div>

<!-- Foot scripts -->
<div id="foot" style="display: none">
<script type="text/javascript" src="/assets/preloader.js?ver=f2495d24f15b41652e3604215b518b3befa7f12e"></script>
<script type="text/javascript" src="https://cdn.polyfill.io/v2/polyfill.min.js?features=default-3.4,NodeList.prototype.@@iterator,Array.prototype.find,Array.prototype.findIndex,Array.prototype.includes"></script>
<script type="text/javascript" src="/assets/vendors.js?ver=f2495d24f15b41652e3604215b518b3befa7f12e"></script>
<script type="text/javascript" src="/assets/app.js?ver=f2495d24f15b41652e3604215b518b3befa7f12e"></script>
</div>
</body>
</html>
 
On what page the IP is shown as not blocked? On what page do you try to unblock it?
 
On what page the IP is shown as not blocked? On what page do you try to unblock it?

The error occurs in the UnBlockIP plugin for WHMCS. The DirectAdmin page in debug is returned without any other errors.

Is there anywhere to see the reason for the problem or any log?
 
On what page the IP is shown as not blocked? On what page do you try to unblock it?

The module debug shows this:

<!doctype html>
<html class="vue-app">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8;">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>158.69.118.43 - DirectAdmin v1.59.4</title>
<link rel="shortcut icon" href="/images/favicon.png" type="image/x-icon" />
<link href="/assets/css/app.css?ver=266961f4264cf1d965046fc4d471bdef5f4989e3" type="text/css" rel="stylesheet"/>

</head>
<body class="preloader">
<div id="root" v-cloak>
<App>
<app-plugin-page slot="page:content" />
</App>
</div>

<!-- Foot scripts -->
<div id="foot" style="display: none">
<script type="text/javascript" src="/assets/preloader.js?ver=266961f4264cf1d965046fc4d471bdef5f4989e3"></script>
<script type="text/javascript" src="https://cdn.polyfill.io/v2/polyfill.min.js?features=default-3.4,NodeList.prototype.@@iterator,Array.prototype.find,Array.prototype.findIndex,Array.prototype.includes"></script>
<script type="text/javascript" src="/assets/vendors.js?ver=266961f4264cf1d965046fc4d471bdef5f4989e3"></script>
<script type="text/javascript" src="/assets/app.js?ver=266961f4264cf1d965046fc4d471bdef5f4989e3"></script>

</div>
</body>
</html>

And then informs:

No block found for IP.
 
A directadmin plugin for CSF/LFD is written by CSF/LFD developers. And you should contact them.
 
After sometime I decied to recover my pending job that tried to unblock an IP using curl.

Here is my output:
HTTP/2 200
content-type: text/html
server: DirectAdmin Daemon
vary: Accept-Encoding
x-frame-options: sameorigin
date: Sat, 09 Oct 2021 10:33:25 GMT

The request was made without a referer header and will not be immediately followed.
And this is the code:

PHP:
function getlog($ip,$username,$password,$cliente_ip) {
                $url = 'https://'.$ip.':2222';
            
                // set temp cookie
                $ckfile = tempnam ("/tmp", "CURLCOOKIE");
            
                // make list of POST fields
                $fields = array(
                    'referer' =>'/',
                    'username'=>$username,
                    'password'=>$password
                    );
                $ch = curl_init();
                curl_setopt($ch,CURLOPT_COOKIEJAR, $ckfile);
                curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
                curl_setopt($ch,CURLOPT_URL,$url.'/CMD_LOGIN');
                curl_setopt($ch,CURLOPT_POST,1);
                curl_setopt($ch,CURLOPT_POSTFIELDS,http_build_query($fields));
                curl_setopt($ch,CURLOPT_FOLLOWLOCATION, TRUE);
                curl_setopt($ch,CURLOPT_HEADER, 1);
                curl_setopt($ch,CURLOPT_VERBOSE, 1);
                curl_setopt($ch,CURLOPT_COOKIESESSION, true);
                curl_setopt($ch,CURLOPT_COOKIE, "CURLCOOKIE");
                $result = curl_exec($ch);
                if($result===false) {
                    die('CURL ERROR: '.curl_error($ch));
                } else {
                    curl_setopt($ch,CURLOPT_URL,$url.'/CMD_PLUGINS_ADMIN/csf/index.raw');
                    curl_setopt($ch,CURLOPT_COOKIEFILE, $ckfile);
                    curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
                    curl_setopt($ch,CURLOPT_POST,1);
                    curl_setopt($ch, CURLOPT_POSTFIELDS,"action=kill&ip=$cliente_ip");
                    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
                    
                    $result = curl_exec($ch);
                    curl_close($ch);
                    if($result===false) {
                        die('CURL ERROR: '.curl_error($ch));
                    } else {
                        return $result;
                    }
                }
            }

Can somebody guide me?
Thanks!
 
Back
Top