Jump to content
  • 0

Problem with CWP Provisioning


Danieliazzz

Question

Hi,

I had a problem with provisioning while on cwp. After Clicking Checkout on the blesta client portal, the page becomes unresponsive and returns error 500.

 

Upon Reviewing Blesta Logs, this is what's it is pertaining to:

 

Upon Checking line 70, this is what it contains:

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_TIMEOUT, 30);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
        curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        $data = $this->parseResponse(curl_exec($ch));
        curl_close($ch);

Specifically Line 70 is:  $data = $this->parseResponse(curl_exec($ch));

 

Note that this is a new installation of blesta and ioncube is properly working.

Using PHP 7.2 with Ioncube.

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0
43 minutes ago, Amit Kumar Mishra said:

is curl to url working properly

also what about the firewall? not sure, but you may check

Curl to URL scripts seems to be working in all of other scripts i am running with this machine.

Firewall is open ports for 2304 which is required for the api.

:) Thanks

Link to comment
Share on other sites

  • 0
9 hours ago, Tyson said:

What's in the log that indicates it is a problem with executing cURL? Typically, a 500 or cURL error is due to a server misconfiguration, like a closed port. Are ports 2030 and 2031 open?

Hi,

2031, and 2030 is open because without port 2031 i cannot access the admin panel. Also in a new update 2304 is the one used in API Commands. Maybe cwp itself is blocking the command due to that a different port is used?

I'll try to modify the port in the cwp modules to check and see.

Link to comment
Share on other sites

  • 0
On 6/27/2019 at 11:59 AM, Mr Genius said:

did modifying the port work fine for you?

It did not, upon looking at the CWP Module for Blesta included with the latest version. It is clearly different to what is currently implemented.

/home/webytely/public_html/dashboard/components/modules/centoswebpanel/apis/centoswebpanel_api.php

   public function apiRequest($function, array $params = [])
    {
        // Set api url
        $protocol = ($this->use_ssl ? 'https' : 'http');
        $port = ($this->use_ssl ? '2031' : '2030');

        $url = $protocol . '://'
            . $this->hostname . ':' . $port
            . '/api/?key=' . $this->key
            . '&api=' . $function
            . '&' . http_build_query($params);

        // Send request
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_TIMEOUT, 30);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
        curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        $data = $this->parseResponse(curl_exec($ch));
        curl_close($ch);

        return $data;
    }

 

And what CWP Provided as an Example:

$data = array(“key => MYKEY”,”action”=>’add’, domain”=>’MY_DOMAIN’, user”=>’USER’, pass”=>’PASSWORD’, email”=>’email@account’, package”=>’PACKAGE_NAME’, inode”=>’0’,”limit_nproc”=>’40’,”limit_nofile”=>’0’,”server_ips”=>’MY_IP_SERVER’);
$url = https://IPSERVERAPI:2304/v1/account”;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, POST”);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt ($ch, CURLOPT_POST, 1);
$response = curl_exec($ch);
curl_close($ch);

 

Based on the new revisions provided here: 

https://docs.control-webpanel.com/docs/developer-tools/api-manager/functions/function-api-account/add

 

So Essentially, this made the Error 500 problem since the server isnt responding due to a wrong api method being used. Not even using port 2304 on the latest blesta update.

 

Can we get this bumped to a developer at blesta to take a look.

 

Thanks :)

 

 

Link to comment
Share on other sites

  • 0

Yea this module was built a couple years ago.  I believe at that time they were still in the process of developing their current API.  You can see that the endpoint structure is completely different between the examples, so the module must be working off of an old API.  I'll go ahead and create a task to look into updating the module to use the new API.  CORE-3217

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
Answer this question...

×   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.

Loading...
×
×
  • Create New...