Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - vanthoi

Pages: [1]
1

I sent an error message before, but it hasn't been fixed yet. I've had to manually configure it before. The error I describe here:
https://forum.centos-webpanel.com/index.php?topic=9263.0

Up to today I update to add a new client I discovered a new bug. It is after saving it creates a strange string behind the drive parameters.

Code: [Select]
policy goi_2GB

        group caodat {

        cpu {
            cpu.cfs_quota_us = 500000;
            cpu.cfs_period_us = 100000;
          }

        memory {
             memory.limit_in_bytes = 2G;
             memory.memsw.limit_in_bytes = 2G;
        }

        blkio {
             blkio.throttle.read_bps_device = "8:336Jun53Sep151Jun215Nov151Sep234Jul151Jun151Jul151Jun792Nov4096Nov165Dec 20000000";
             blkio.throttle.write_bps_device = "8:336Jun53Sep151Jun215Nov151Sep234Jul151Jun151Jul151Jun792Nov4096Nov165Dec 20000000";
         }

    }

If I delete the parameters behind. Then everything is working fine.

Code: [Select]
policy goi_2GB

        group caodat {

        cpu {
            cpu.cfs_quota_us = 500000;
            cpu.cfs_period_us = 100000;
          }

        memory {
             memory.limit_in_bytes = 2G;
             memory.memsw.limit_in_bytes = 2G;
        }

        blkio {
             blkio.throttle.read_bps_device = "8:32 20000000";
             blkio.throttle.write_bps_device = "8:32 20000000";
         }

    }

Hopefully development will fix this.

2
Hello
Can you please tell me which is the language of your browser? here may be your problem

Yes. Exactly the error is due to the browser language is Vietnamese. If I change the language to English there is no error. I think a web UI cannot set the language according to the browser UI in case the language is not supported. For me personally, it doesn't matter. But most of my clients use Vietnamese. You can fix this?

3
don't see that issue anywhere, maybe something related to your browser ?

I don't know if the country region affects the display.  I come from Vietnam.  I have tried it on many different browsers and devices.  But all of them are not showing up.  Although I have tried the demo page provided by CWP itself.  Or you can press ctrl f5 to see if it updates the same as mine..

4
Well, that's a small screenshot!  :o
Sorry! I not edit topic.
Screenshot new :


5
I have submitted an error report to support. But 3 months have not seen it fixed. So now I post it here.
When you visit the user login page. The texts are not displayed, all are blank cells with no text attached.

Inside the console everything is normal. I have installed a new CWP on a brand new 7 centos with the same situation. Even I have access to the demo of CWP itself. They also don't show text in the user login page.


6
hi try to remove cgroup then install it again.

Sorry for the late reply.
Recently, I was taking care of my wife, who gave birth to a baby, so I could not answer immediately.

I have done a clean uninstall of Cgroup then reinstalled.
But everything still hasn't changed, the drive limitation still fails.
The installation log does not detect any other errors.
You can set up testing on an esxi virtual machine to test.

7
I am performing tests with Cgroups.
I found out that this module has taken the wrong disk parameters. Specifically the MAJ: MIN part of the drive
Config on CWP:
Code: [Select]
blkio {
             blkio.throttle.read_bps_device = "8:33 20971520";
             blkio.throttle.write_bps_device = "8:33 20971520";
         }
In the case of lscgroup error:

Code: [Select]
Error: failed to set /sys/fs/cgroup/blkio/vanthoi/blkio.throttle.read_bps_device: Invalid argument
Error: failed to set /sys/fs/cgroup/blkio/vanthoi/blkio.throttle.write_bps_device: Invalid argument

After searching on google, I found an error caused by MAJ: MIN.
For example, my / home partition is / dev / sdc1 with MAJ: MIN 8:33

Code: [Select]
cat / proc / partitions | grep sdc
   8 32 262144000 sdc
   8 33 262142976 sdc1

But to limit the read / write speed on the hard disk, you need to use MAJ: MIN of the non-partition drive.

Config manal:
 
Code: [Select]
blkio {
             blkio.throttle.read_bps_device = "8:32 20971520";
             blkio.throttle.write_bps_device = "8:32 20971520";
         }

I then proceeded to correct MAJ: MIN in the configuration so that everything was resolved.

Send developers to fix this module in the next update.
I am running on CentOS Linux release 7.8.2003
Kernel Version: 3.10.0-1127.13.1.el7.x86_64

8
New Modules / Re: Limit server resources (cgroups)
« on: June 29, 2020, 10:22:50 PM »
I came across your diary.
It looks like the Disk I/O section of your server is not working.
Common errors on virtual servers such as vmware or kvm.
You want to use the drive speed limiter.
You must fix Disk I/O errors on your system.

Where you still want to use cgroups.
In the installation of Cgroup, put a checkmark in the disk I/O section
Save and restart the service will work.

9
New Modules / Re: [module] WHMCS (Fix)
« on: June 28, 2020, 05:21:08 AM »
HI IHOS

i have added some code from github for auto login from client area for user panel

pls check this out
Code: [Select]
<?php
/**
 * Created by IntelliJ IDEA.
 * User: Vinicius Assis
 * E-mail: viniciusassisnascimento@gmail.com
 * Company: IHOS T.I.
 * Date: 10/03/2019
 * Time: 23:41
 *
 * Changelog
 * #############################
 * Date: 16/03/2019
 * Version Release: 1.0.1
 * + Added function ihoscwp7_LoaderFunction
 * #############################
 * Date: 13/03/2019
 * Version Release: 1.0.0
 * # Fix/Revised methods CreateAccount, SuspendAccount, UnsuspendAccount, TerminateAccount, ChangePassword, ChangePackage
 * + Added detailed success and error logs in all methods
 * + Added Verification on file for not directly accessing
 * + Added exception handling
 * #############################
 */

if (!defined("WHMCS")) {
    die(
"This file cannot be accessed directly");
}

/**
 * @return array
 */
function ihoscwp7_MetaData()
{
    return array(
        
'DisplayName' => 'IHOS CWP7',
        
'APIVersion' => '1.1'// Use API Version 1.1
        
'RequiresServer' => true,
        
'DefaultSSLPort' => '2304'// Default SSL Connection Port
        
'ServiceSingleSignOnLabel' => 'Login to Panel as User',
        
'AdminSingleSignOnLabel' => 'Login to Panel as Admin',
    );
}

/**
 * @return array
 */
function ihoscwp7_ConfigOptions()
{
    return array(
        
'PACKAGE-NUMBER' => array(
            
'Type' => 'text',
            
'Loader' => 'ihoscwp7_LoaderFunction',
            
'SimpleMode' => true,
            
'Description' => 'Package ID'
        
),
        
'Inode' => array(
            
'Type' => 'text',
            
'Default' => '0',
            
'SimpleMode' => true,
            
'Description' => 'Limit Inodes, 0 for unlimited'
        
),
        
'Nofile' => array(
            
'Type' => 'text',
            
'Default' => '100',
            
'SimpleMode' => true,
            
'Description' => 'Limit number of Open Files for account'
        
),
        
'Nproc' => array(
            
'Type' => 'text',
            
'Default' => '40',
            
'SimpleMode' => true,
            
'Description' => 'Limit number of Processes for account, don\'t use 0 as it will not allow any processes'
        
)
    );
}

/**
 * @param array $params
 * @return mixed|string
 */
function ihoscwp7_CreateAccount(array $params)
{
    try {

        if (
$params['server'] == 1) {

            
$postvars = array(
                
'package' => $params['configoption1'],
                
'domain' => $params['domain'],
                
'key' => $params['serveraccesshash'],
                
'action' => 'add',
                
'username' => $params['username'],
                
'user' => $params['username'],
                
'pass' => $params['password'],
                
'email' => $params['clientsdetails']['email'],
                
'inode' => $params['configoption2'],
                
'nofile' => $params['configoption3'],
                
'nproc' => $params['configoption4'],
                
'server_ips' => $params['serverip']
            );

            
$postdata http_build_query($postvars);

            
$url 'https://' $params['serverhostname'] . ':' $params['serverport'] . '/v1/account';

            
$curl curl_init();
            
curl_setopt($curlCURLOPT_URL'https://' $params['serverhostname'] . ':' $params['serverport'] . '/v1/account');
            
curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
            
curl_setopt($curlCURLOPT_SSL_VERIFYPEERfalse);
            
curl_setopt($curlCURLOPT_SSL_VERIFYHOSTfalse);
            
curl_setopt($curlCURLOPT_CUSTOMREQUEST'POST');
            
curl_setopt($curlCURLOPT_POSTtrue);
            
curl_setopt($curlCURLOPT_POSTFIELDS$postdata);
            
$response curl_exec($curl);

            
logModuleCall(
                
'ihoscwp7',
                
__FUNCTION__,
                
$url '/?' $postdata,
                
$response
            
);

            
$response json_decode($responsetrue);
            if (
$response['status'] == 'OK') {
                
$result 'success';
            } else {
                
$result $response;
            }

        }

    } catch (
Exception $e) {
        
logModuleCall(
            
'ihoscwp7',
            
__FUNCTION__,
            
$params,
            
$e->getMessage(),
            
$e->getTraceAsString()
        );

        return 
$e->getMessage();
    }

    return 
$result;
}

/**
 * @param array $params
 * @return mixed|string
 */
function ihoscwp7_SuspendAccount(array $params)
{
    try {

        if (
$params['server'] == 1) {

            
$postvars = array(
                
'key' => $params['serveraccesshash'],
                
'action' => 'susp',
                
'user' => $params['username']
            );

            
$postdata http_build_query($postvars);

            
$url 'https://' $params['serverhostname'] . ':' $params['serverport'] . '/v1/account';

            
$curl curl_init();
            
curl_setopt($curlCURLOPT_URL'https://' $params['serverhostname'] . ':' $params['serverport'] . '/v1/account');
            
curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
            
curl_setopt($curlCURLOPT_SSL_VERIFYPEERfalse);
            
curl_setopt($curlCURLOPT_SSL_VERIFYHOSTfalse);
            
curl_setopt($curlCURLOPT_CUSTOMREQUEST'POST');
            
curl_setopt($curlCURLOPT_POSTtrue);
            
curl_setopt($curlCURLOPT_POSTFIELDS$postdata);
            
$response curl_exec($curl);

            
logModuleCall(
                
'ihoscwp7',
                
__FUNCTION__,
                
$url '/?' $postdata,
                
$response
            
);

            
$response json_decode($responsetrue);
            if (
$response['status'] == 'OK') {
                
$result 'success';
            } else {
                
$result $response;
            }

        }

    } catch (
Exception $e) {
        
logModuleCall(
            
'ihoscwp7',
            
__FUNCTION__,
            
$params,
            
$e->getMessage(),
            
$e->getTraceAsString()
        );

        return 
$e->getMessage();
    }

    return 
$result;
}

/**
 * @param array $params
 * @return mixed|string
 */
function ihoscwp7_UnsuspendAccount(array $params)
{
    try {

        if (
$params['server'] == 1) {

            
$postvars = array(
                
'key' => $params['serveraccesshash'],
                
'action' => 'unsp',
                
'user' => $params['username']
            );

            
$postdata http_build_query($postvars);

            
$url 'https://' $params['serverhostname'] . ':' $params['serverport'] . '/v1/account';

            
$curl curl_init();
            
curl_setopt($curlCURLOPT_URL'https://' $params['serverhostname'] . ':' $params['serverport'] . '/v1/account');
            
curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
            
curl_setopt($curlCURLOPT_SSL_VERIFYPEERfalse);
            
curl_setopt($curlCURLOPT_SSL_VERIFYHOSTfalse);
            
curl_setopt($curlCURLOPT_CUSTOMREQUEST'POST');
            
curl_setopt($curlCURLOPT_POSTtrue);
            
curl_setopt($curlCURLOPT_POSTFIELDS$postdata);
            
$response curl_exec($curl);

            
logModuleCall(
                
'ihoscwp7',
                
__FUNCTION__,
                
$url '/?' $postdata,
                
$response
            
);

            
$response json_decode($responsetrue);
            if (
$response['status'] == 'OK') {
                
$result 'success';
            } else {
                
$result $response;
            }

        }

    } catch (
Exception $e) {
        
logModuleCall(
            
'ihoscwp7',
            
__FUNCTION__,
            
$params,
            
$e->getMessage(),
            
$e->getTraceAsString()
        );

        return 
$e->getMessage();
    }

    return 
$result;
}

/**
 * @param array $params
 * @return mixed|string
 */
function ihoscwp7_TerminateAccount(array $params)
{
    try {

        if (
$params['server'] == 1) {

            
$postvars = array(
                
'key' => $params['serveraccesshash'],
                
'action' => 'del',
                
'user' => $params['username'],
                
'email' => $params['clientsdetails']['email']
            );

            
$postdata http_build_query($postvars);

            
$url 'https://' $params['serverhostname'] . ':' $params['serverport'] . '/v1/account';

            
$curl curl_init();
            
curl_setopt($curlCURLOPT_URL$url);
            
curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
            
curl_setopt($curlCURLOPT_SSL_VERIFYPEERfalse);
            
curl_setopt($curlCURLOPT_SSL_VERIFYHOSTfalse);
            
curl_setopt($curlCURLOPT_CUSTOMREQUEST'POST');
            
curl_setopt($curlCURLOPT_POSTtrue);
            
curl_setopt($curlCURLOPT_POSTFIELDS$postdata);
            
$response curl_exec($curl);

            
logModuleCall(
                
'ihoscwp7',
                
__FUNCTION__,
                
$url '/?' $postdata,
                
$response
            
);

            
$response json_decode($responsetrue);
            if (
$response['status'] == 'OK') {
                
$result 'success';
            } else {
                
$result $response;
            }

        }

    } catch (
Exception $e) {
        
logModuleCall(
            
'ihoscwp7',
            
__FUNCTION__,
            
$params,
            
$e->getMessage(),
            
$e->getTraceAsString()
        );

        return 
$e->getMessage();
    }

    return 
$result;
}

/**
 * @param array $params
 * @return mixed|string
 */
function ihoscwp7_ChangePassword(array $params)
{
    try {

        if (
$params['server'] == 1) {

            
$postvars = array(
                
'key' => $params['serveraccesshash'],
                
'action' => 'udp',
                
'user' => $params['username'],
                
'pass' => $params['password']
            );

            
$postdata http_build_query($postvars);

            
$url 'https://' $params['serverhostname'] . ':' $params['serverport'] . '/v1/changepass';

            
$curl curl_init();
            
curl_setopt($curlCURLOPT_URL$url);
            
curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
            
curl_setopt($curlCURLOPT_SSL_VERIFYPEERfalse);
            
curl_setopt($curlCURLOPT_SSL_VERIFYHOSTfalse);
            
curl_setopt($curlCURLOPT_CUSTOMREQUEST'POST');
            
curl_setopt($curlCURLOPT_POSTtrue);
            
curl_setopt($curlCURLOPT_POSTFIELDS$postdata);
            
$response curl_exec($curl);

            
logModuleCall(
                
'ihoscwp7',
                
__FUNCTION__,
                
$url '/?' $postdata,
                
$response
            
);

            
$response json_decode($responsetrue);
            if (
$response['status'] == 'OK') {
                
$result 'success';
            } else {
                
$result $response;
            }

        }

    } catch (
Exception $e) {
        
logModuleCall(
            
'ihoscwp7',
            
__FUNCTION__,
            
$params,
            
$e->getMessage(),
            
$e->getTraceAsString()
        );

        return 
$e->getMessage();
    }

    return 
$result;
}

/**
 * @param array $params
 * @return mixed|string
 */
function ihoscwp7_ChangePackage(array $params)
{
    try {

        if (
$params['server'] == 1) {

            
$postvars = array(
                
'key' => $params['serveraccesshash'],
                
'action' => 'udp',
                
'user' => $params['username'],
                
'package' => $params['configoption1']
            );

            
$postdata http_build_query($postvars);

            
$url 'https://' $params['serverhostname'] . ':' $params['serverport'] . '/v1/changepack';

            
$curl curl_init();
            
curl_setopt($curlCURLOPT_URL$url);
            
curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
            
curl_setopt($curlCURLOPT_SSL_VERIFYPEERfalse);
            
curl_setopt($curlCURLOPT_SSL_VERIFYHOSTfalse);
            
curl_setopt($curlCURLOPT_CUSTOMREQUEST'POST');
            
curl_setopt($curlCURLOPT_POSTtrue);
            
curl_setopt($curlCURLOPT_POSTFIELDS$postdata);
            
$response curl_exec($curl);

            
logModuleCall(
                
'ihoscwp7',
                
__FUNCTION__,
                
$url '/?' $postdata,
                
$response
            
);

            
$response json_decode($responsetrue);
            if (
$response['status'] == 'OK') {
                
$result 'success';
            } else {
                
$result $response;
            }

        }

    } catch (
Exception $e) {
        
logModuleCall(
            
'ihoscwp7',
            
__FUNCTION__,
            
$params,
            
$e->getMessage(),
            
$e->getTraceAsString()
        );

        return 
$e->getMessage();
    }

    return 
$result;
}

/**
 * @param array $params
 * @return string
 */
function ihoscwp7_ClientArea(array $params)
{
      
$postvars = array('key' => $params["serveraccesshash"],'action' => 'list','user' => $params["username"],'timer'=>5);
    
$postdata http_build_query($postvars);
    
$curl curl_init();
    
curl_setopt($curlCURLOPT_URL'https://' $params["serverhostname"] . ':2304/v1/user_session');
    
curl_setopt($curlCURLOPT_RETURNTRANSFER,true);
    
curl_setopt($curlCURLOPT_SSL_VERIFYPEERfalse);
    
curl_setopt($curlCURLOPT_SSL_VERIFYHOSTfalse);
    
curl_setopt($curlCURLOPT_POSTtrue);
    
curl_setopt($curlCURLOPT_POSTFIELDS$postdata);
    
$answer curl_exec($curl);
    
$arry=(json_decode($answer,true)); //die;
    
$link=$arry['msj']['details'];
    
$linkautologin="https://{$params["serverhostname"]}:2083/{$link[0]['user']}/?user_session={$link[0]['token']}";
    
//logModuleCall('cwpwhmcs','centoswebpanel_LoginLink','https://' . $params["serverhostname"] . ':2304/v1/user_session'.$postdata,$answer);


    
$code '<form action="'.$linkautologin.'" method="GET" target="_blank">
        <input type="submit" value="Login to Control Panel" />
        <input type="hidden" id="user_session" name="user_session" value="'
.$link[0]['token'].'" />
        <input type="button" value="Login to Webmail" onClick="window.open(\'https://'
.$params["serverhostname"].'/webmail\')" />
        </form>'
;
    return 
$code;
}

/**
 * @param $params
 * @return string
 */
function ihoscwp7_AdminLink($params)
{
    
$code '<input type="button" value="Admin Control Panel" onClick="window.open(\'https://' $params['serverhostname'] . ':2031/login/index.php\')" />';

    return 
$code;
}

/**
 * @param $params
 */
function ihoscwp7_LoginLink($params)
{
   
$postvars = array('key' => $params["serveraccesshash"],'action' => 'list','user' => $params["username"],'timer'=>5);
    
$postdata http_build_query($postvars);
    
$curl curl_init();
    
curl_setopt($curlCURLOPT_URL'https://' $params["serverhostname"] . ':2304/v1/user_session');
    
curl_setopt($curlCURLOPT_RETURNTRANSFER,true);
    
curl_setopt($curlCURLOPT_SSL_VERIFYPEERfalse);
    
curl_setopt($curlCURLOPT_SSL_VERIFYHOSTfalse);
    
curl_setopt($curlCURLOPT_POSTtrue);
    
curl_setopt($curlCURLOPT_POSTFIELDS$postdata);
    
$answer curl_exec($curl);
    
$arry=(json_decode($answer,true)); //die;
    
$link=$arry['msj']['details'];
    
$linkautologin="https://{$params["serverhostname"]}:2083/{$link[0]['user']}/?user_session={$link[0]['token']}";
    
logModuleCall('cwpwhmcs','centoswebpanel_LoginLink','https://' $params["serverhostname"] . ':2304/v1/user_session'.$postdata,$answer);

    echo 
"<a href=\"{$linkautologin}\" target=\"_blank\" style=\"color:#cc0000\">Control Panel</a>";
}

function 
ihoscwp7_LoaderFunction($params)
{
    try {

        if (
$params['server'] == 1) {

            
$postvars = array(
                
'key' => $params['serveraccesshash'],
                
'action' => 'list'
            
);

            
$postdata http_build_query($postvars);

            
$url 'https://' $params['serverhostname'] . ':' $params['serverport'] . '/v1/packages';

            
$curl curl_init();
            
curl_setopt($curlCURLOPT_URL$url);
            
curl_setopt($curlCURLOPT_RETURNTRANSFERtrue);
            
curl_setopt($curlCURLOPT_SSL_VERIFYPEERfalse);
            
curl_setopt($curlCURLOPT_SSL_VERIFYHOSTfalse);
            
curl_setopt($curlCURLOPT_CUSTOMREQUEST'POST');
            
curl_setopt($curlCURLOPT_POSTtrue);
            
curl_setopt($curlCURLOPT_POSTFIELDS$postdata);
            
$response curl_exec($curl);

            
logModuleCall(
                
'ihoscwp7',
                
__FUNCTION__,
                
$url '/?' $postdata,
                
$response
            
);

        }

        if (
curl_error($curl)) {
            throw new 
Exception('Unable to connect: ' curl_errno($curl) . ' - ' curl_error($curl));
        } elseif (empty(
$response)) {
            throw new 
Exception('Empty response');
        }

        
curl_close($curl);

        
$packages json_decode($responsetrue);

        
$packageNames = [];
        foreach (
$packages['msj'] as $key => $package) {
            
$packageNames[$package['id']] = ucfirst($package['package_name']);
        }

        if (
is_null($packageNames)) {
            throw new 
Exception('Invalid response format');
        }

    } catch (
Exception $e) {
        
logModuleCall(
            
'ihoscwp7',
            
__FUNCTION__,
            
$params,
            
$e->getMessage(),
            
$e->getTraceAsString()
        );

        return 
$e->getMessage();
    }

    return 
$packageNames;
}
Can you add this information to the User on CWP7?
Processor limits and file opening on missing CWP7 modules with WHMCS 7.10.2

10
Mod_Security / Re: Enable Mod_Security for Wordpress
« on: June 27, 2020, 11:17:07 AM »
If you encounter any errors, replace the "/wp-admin/post.php" line with the error line that will resolve the problem.
Code: [Select]
<IfModule mod_security2.c>
SecRuleEngine On
</IfModule>
<LocationMatch "/wp-admin/post.php">
  SecRuleRemoveById 300015 300016 300017 950907 950005 950006 960008 960011 960904 959006
  SecRuleRemoveById phpids-17
  SecRuleRemoveById phpids-20
  SecRuleRemoveById phpids-21
  SecRuleRemoveById phpids-30
  SecRuleRemoveById phpids-61
</LocationMatch>
<LocationMatch "replace path error permission">
  SecRuleRemoveById 300015 300016 300017 950907 950005 950006 960008 960011 960904 959006
  SecRuleRemoveById phpids-17
  SecRuleRemoveById phpids-20
  SecRuleRemoveById phpids-21
  SecRuleRemoveById phpids-30
  SecRuleRemoveById phpids-61
</LocationMatch>

11
I am having problems integrating CWP7 with WHMCS 7.10.2
I checked the API logs and WHMCS has no errors.
But when checking the newly created user information.
I don't see the info section of prossecc and open file limits!

12
New Modules / Re: Errors in WHMCS Module
« on: June 26, 2020, 03:12:55 PM »
Go to the CWP API, then edit the WHMCS api -> enable: list -> autologin
Then everything will be updated on WHMCS

Pages: [1]