New ISPConfig module for WHMCS

Discussion in 'Tips/Tricks/Mods' started by cwispy, Dec 11, 2014.

  1. boldbesusiax

    boldbesusiax New Member

    I am trying to be as polite as possible, but this isn't an easy issue to resolve, if you have the time and skill you should help us get to the bottom of why the API call that creates template zones seems to not work or doesn't work like we expect. cwispy's module was released gratis when cwispy could have easily put it up for sale.

    I will post a few questions in your thread (so we don't derail this one) that might get it pointed in the right direction. Post incoming on your thread.

    EDIT: Ack! I can't post in that forum! I will send you a message with a few questions that might get you in the right direction. However after reading the thread I strongly advise replacing XCache with APC, personally I have had nightmares with XCache in the past.

    This likely won't be the answer you want to hear but DNS zones for BIND9 based servers must be created manually via API calls. I have had customer projects that have prevented me from focusing on this issue but at the months end I will have a clear schedule to attack this problem again. Here is an example of how you can manually create a DNS zone similar to the ISPConfig default template.

    (Please DO NOT just copy and paste this into your script make sure the variable names are matching first! Also please note that the mail 'A' record likely won't be correct and may need to be changed!)

    Code:
    $ispconfigparams = array(
                            'server_id' => $defaultdnsserver,
                            'origin' => $domain.'.',
                            'ns' => $nameserver.'.',
                            'mbox' => 'webmaster.'.$domain.'.',
                            'refresh' => '7200',
                            'retry' => '540',
                            'expire' => '604800',
                            'minimum' => '3600',
                            'ttl' => '3600',
                            'active' => 'y'
                        );
                        $dns_id = $soap_client->dns_zone_add($soap_session_id,$client_id,$ispconfigparams);
                      
                        $ispconfigparams = array(
                            'server_id' => $defaultdnsserver,
                            'zone' => $dns_id,
                            'name' => $domain.'.',
                            'type' => 'A',
                            'data' => $params['serverip'],
                            'ttl' => '3600',
                            'active' => 'y'
                        );
                        $zone_id = $soap_client->dns_a_add($soap_session_id,$client_id,$ispconfigparams);
                      
                        $ispconfigparams = array(
                            'server_id' => $defaultdnsserver,
                            'zone' => $dns_id,
                            'name' => 'www',
                            'type' => 'A',
                            'data' => $params['serverip'],
                            'ttl' => '3600',
                            'active' => 'y'
                        );
                        $zone_id = $soap_client->dns_a_add($soap_session_id,$client_id,$ispconfigparams);
                      
                        $ispconfigparams = array(
                            'server_id' => $defaultdnsserver,
                            'zone' => $dns_id,
                            'name' => 'mail',
                            'type' => 'A',
                            'data' => $params['serverip'],
                            'ttl' => '3600',
                            'active' => 'y'
                        );
                        $zone_id = $soap_client->dns_a_add($soap_session_id,$client_id,$ispconfigparams);
                      
                        $ispconfigparams = array(
                            'server_id' => $defaultdnsserver,
                            'zone' => $dns_id,
                            'name' => $domain.'.',
                            'type' => 'MX',
                            'data' => $defaultmailservername.'.',
                            'aux' => '10',
                            'ttl' => '3600',
                            'active' => 'y'
                        );
                        $zone_id = $soap_client->dns_mx_add($soap_session_id,$client_id,$ispconfigparams);
                      
                        $ispconfigparams = array(
                            'server_id' => $defaultdnsserver,
                            'zone' => $dns_id,
                            'name' => $domain.'.',
                            'type' => 'NS',
                            'data' => $nameserver.'.',
                            'ttl' => '3600',
                            'active' => 'y'
                        );
                        $zone_id = $soap_client->dns_ns_add($soap_session_id,$client_id,$ispconfigparams);
                      
                        $ispconfigparams = array(
                            'server_id' => $defaultdnsserver,
                            'zone' => $dns_id,
                            'name' => $domain.'.',
                            'type' => 'NS',
                            'data' => $nameserverslave.'.',
                            'ttl' => '3600',
                            'active' => 'y'
                        );
                        $zone_id = $soap_client->dns_ns_add($soap_session_id,$client_id,$ispconfigparams);
                  
                        $ispconfigparams = array(
                            'server_id' => $defaultdnsserver,
                            'zone' => $dns_id,
                            'name' => $domain.'.',
                            'type' => 'TXT',
                            'data' => 'v=spf1 mx a ~all',
                            'ttl' => '3600',
                            'active' => 'y'
                        );
                        $zone_id = $soap_client->dns_txt_add($soap_session_id,$client_id,$ispconfigparams);
    
     
    Last edited: Dec 13, 2016
  2. radim_h

    radim_h Member HowtoForge Supporter

    Hello cwispy,
    i have two questions again :)
    1.
    When i click on "Login to Controlpanel" from WHMCS admin area, i'm redirected properly to ISPConfig
    When i "log as client" in WHMCS and then click CONTROLPANEL LOGIN from productdetail page, i'm forwarded to WHMCS index.php page ???

    2. What is the Site Pro api username and password for ?


    FYI: when trying to use module, user is created in ISPC, but now i have error message
    Module Command Error SOAP Error: Method ispconfig_version_get does not exist

    Regards
    RH
     
    Last edited: Dec 19, 2016
  3. cwispy

    cwispy Active Member

    Hi radim_h,
    1. You may need to apply the fix I posted earlier in this thread for the login issue.
    2. I did not write that code, but I imagine its your Site Pro login, if you have a Site Pro account to allow clients to use their make your own websites.

    Finally, you have not installed the class files into the ispconfig server as per the instructions in the remote.d/ directory on github.

    cwispy
     
  4. radim_h

    radim_h Member HowtoForge Supporter

    Hello,
    I think i din't catch something.
    So here https://github.com/cwispy/ispcfg3 is not the most up-to date version? Is there some link where i can download complete actual version ? Or do i have to aply patches tomain version somehow ?
    I also have no idea, where can i find remote.d/ dir.

    Thank you in advance for any info

    RH
     
  5. cwispy

    cwispy Active Member

  6. JuSt

    JuSt New Member

    Hello cwispy,

    First of all, great job with this plugin, i am having some troubles to deploy accounts in my ISPConfig.
    I have installed correctly the plugin and its working, but is not creating a DNS Zone, i also saw these errors, i dont know if are releated or not...

    [Wed Dec 21 18:25:21.810384 2016] [fcgid:warn] [pid 6985] [client 10.254.1.25:41566] mod_fcgid: stderr: PHP Warning: include_once(/usr/local/ispconfig/interface/lib/lang/.lng): failed to open stream: No such file or directory in /usr/local/ispconfig/interface/lib/classes/tform_base.inc.php on line 136
    [Wed Dec 21 18:25:21.810459 2016] [fcgid:warn] [pid 6985] [client 10.254.1.25:41566] mod_fcgid: stderr: PHP Warning: include_once(): Failed opening '/usr/local/ispconfig/interface/lib/lang/.lng' for inclusion (include_path='.:/usr/share/php') in /usr/local/ispconfig/interface/lib/classes/tform_base.inc.php on line 136
    [Wed Dec 21 18:25:21.810466 2016] [fcgid:warn] [pid 6985] [client 10.254.1.25:41566] mod_fcgid: stderr: PHP Warning: include(lib/lang/en_dns_soa.lng): failed to open stream: No such file or directory in /usr/local/ispconfig/interface/lib/classes/tform_base.inc.php on line 143
    [Wed Dec 21 18:25:21.810470 2016] [fcgid:warn] [pid 6985] [client 10.254.1.25:41566] mod_fcgid: stderr: PHP Warning: include(): Failed opening 'lib/lang/en_dns_soa.lng' for inclusion (include_path='.:/usr/share/php') in /usr/local/ispconfig/interface/lib/classes/tform_base.inc.php on line 143

    My installation of ISPConfig is in spanish....

    I have visited too these urls with no results:
    github.com/cwispy/ispcfg3/issues/10
    howtoforge.com/community/threads/new-ispconfig-module-for-whmcs.67824/page-12#post-334327

    Could you please give more information in case that is possible?

    Thank you very much for your help.
    Kind regards.
     
  7. cwispy

    cwispy Active Member

    I think I have found a fix for the Bind error. Its failing because the xfer field can not be NULL. This is not a field that gets passed through via the API, so it requires a small fix to this file

    /usr/local/ispconfig/interface/lib/classes/remote.d/dns.inc.php

    about line 117 you will see this code

    Code:
      if($vars['ttl'] == '') $error .= $app->lng('error_ttl_empty').'<br />';
    
      if($error == '') {
      // Insert the soa record
      $tmp = $app->db->queryOneRecord("SELECT userid,default_group FROM sys_user WHERE client_id = ?", $client_id);
    
    change it to this

    Code:
      if($vars['ttl'] == '') $error .= $app->lng('error_ttl_empty').'<br />';
      if($vars['xfer'] == NULL) $vars['xfer'] = '';
    
      if($error == '') {
      // Insert the soa record
      $tmp = $app->db->queryOneRecord("SELECT userid,default_group FROM sys_user WHERE client_id = ?", $client_id);
    
    Edit: The better option is probably to edit the field in MySQL to allow NULL.

    ALTER TABLE `dns_soa`
    CHANGE COLUMN `xfer` `xfer` VARCHAR(255) NULL DEFAULT NULL AFTER `active`;
     
    Last edited: Dec 26, 2016
  8. BenM

    BenM Member

    Just add xfer= x.x.x.x to your dns template in isp-config will do the job.
     
  9. JuSt

    JuSt New Member

    Thank you very much for your help, it works now!!!! :)
     
  10. cwispy

    cwispy Active Member

    I am trying to determine how I can integrate IP addresses into the module so that you could assign a static IP address to customers. But it is proving to be a bit more complex than I anticipated. I can see the following as items which need to be considered.

    Where is the list of IP addresses going to be stored?
    How to track the IP addresses that have been assigned / free?
    Validating the IP addresses prior to commissioning of a service.

    One option I have thought of, it writing an Addon Module for WHMCS that stores the IP addresses which the provisioning module queries to get its IP addresses from. The downside of this of course is that it is then an additional piece of code to maintain.

    So I am looking for any thoughts others may have. Also I am interested in any other features that you could see as being beneficial to the module and the wider community.
     
    JuSt likes this.
  11. JuSt

    JuSt New Member

    One question cwispy, in the layer of clientarea i see the button "Login to control panel" but it doesnt works properly, do you know any solution???

    i'll think too about the integration of IP addreses...its a little bit complicated to do that...why do you need this? if you give more information i can help you!!!

    Thanks for all and kind regards!!
     
  12. webguyz

    webguyz Active Member HowtoForge Supporter

    Most vendors implement IP address allocation as a Add-on in WHMCS. They let you allocate a block of IP's and then assign them as new sites are created.No vendor checks whether they are working or if there is an ip conflict. its the end users job to make sure the IP block exists and is not being used by some other device.
     
  13. the1matrix1

    the1matrix1 New Member

    I'm having the same issue too? just installed new ubuntu 16.10 in my new server with ISPconfig 3.1.2
    did any one figure it out?
     
    Last edited: Feb 7, 2017
  14. octa.ci

    octa.ci New Member

    Hello cwipsy,
    First of all let me thank you for this great module. I have a question as after update of Ispconfig to version 3.1 I can get it working properly. I'm using the latest ispcg3.php from .../cwispy/ispcfg3/tree/updates-for-ispconfig3.1 and when I try to accept the order in whmcs I receive the following error:
    SOAP Error: contact_error_empty<br /> email_error_isemail<br /> email_error_empty<br />
    Also bellow you can find an extras from the log:
    Code:
    Array
    (
        [whmcsVersion] => 6.3.2-release.1
        [accountid] => 2
        [serviceid] => 2
        [userid] => 2
        [domain] => test.test1
        [username] => testtest
        [password] => 8mpYm730cO
        [packageid] => 1
        [pid] => 1
        [serverid] => 5
        [status] => Pending
        [type] => hostingaccount
        [producttype] => hostingaccount
        [moduletype] => ispcfg3
        [configoption1] => [removed]
        [configoption2] => [removed]
        [configoption3] => 192.168.2.157:8080
        [configoption4] => on
        [configoption5] => 2
        [configoption6] => default
        [configoption7] => no,fast-cgi
        [configoption8] => jailkit
        [configoption9] => on
        [configoption10] => on
        [configoption11] =>
        [configoption12] => 1024
        [configoption13] =>
        [configoption14] => y,y,y,n,y,n
        [configoption15] => none
        [configoption16] => fast-cgi
        [configoption17] =>
        [configoption18] => on
        [configoption19] => ns1.hostname.ltd,ns2.hostname.ltd,webmaster,2,xxx.xxx.xxx.xxx,xxx.xxx.xxx.xxy
        [configoption20] => en
        [configoption21] => on
        [configoption22] => on
        [configoption23] => 3.1
        [configoption24] =>
        [customfields] => Array
            (
            )
    
        [configoptions] => Array
            (
            )
    
        [clientsdetails] => Array
            (
                [userid] =>
                [id] =>
                [uuid] =>
                [firstname] =>
                [lastname] =>
                [fullname] =>
                [companyname] =>
                [email] =>
                [address1] =>
                [address2] =>
                [city] =>
                [fullstate] =>
                [state] =>
                [postcode] =>
                [countrycode] =>
                [country] =>
                [phonenumber] =>
                [password] =>
                [statecode] =>
                [countryname] =>
                [phonecc] =>
                [phonenumberformatted] =>
                [billingcid] =>
                [notes] =>
                [twofaenabled] =>
                [currency] =>
                [defaultgateway] =>
                [cctype] =>
                [cclastfour] =>
                [securityqid] =>
                [securityqans] =>
                [groupid] =>
                [status] =>
                [credit] =>
                [taxexempt] =>
                [latefeeoveride] =>
                [overideduenotices] =>
                [separateinvoices] =>
                [disableautocc] =>
                [emailoptout] =>
                [overrideautoclose] =>
                [allowSingleSignOn] =>
                [language] =>
                [lastlogin] =>
            )
    
        [server] => 1
        [serverip] => 192.168.2.160
        [serverhostname] => db.hostname.ltd [modified]
        [serverusername] =>
        [serverpassword] =>
        [serveraccesshash] =>
        [serversecure] =>
        [serverhttpprefix] => http
        [serverport] =>
        [action] => create
    )
    
    The strange thing is that [clientsdetails] => Array is empty.
    I use multiserver config (1 hosts server, 1 mail server, 1 dbserver, 2 ns servers).

    Any help will be welcomed. Thank you.
     
  15. EckyBrazzz

    EckyBrazzz Member

    Hi,

    Is this compatible with WHMCS 7.1.2?

    The wiki page says copy the ispcfg3.php to the folder in the WHMCS/serveres/ ispcfg3 directory. I did and I can see the page back again in WHMCS.
    Maybe a silly question, but what do I do with the rest of the files from https://github.com/cwispy/ispcfg3/tree/updates-for-ispconfig3.1
    Now I copyed them all into the ispcfg3 directory, but thats not in the wiki.;
    I suggest that you update the wiki to avoid confusion.
     
  16. marcell

    marcell New Member

    for me says
    SOAP Error: no_server_error<br />

    Code:
    Array
    (
        [whmcsVersion] => 7.2.0-rc.1
        [accountid] => 491
        [serviceid] => 491
        [userid] => 4
        [domain] => bebro.xyz
        [username] => bebroxyzh
        [password] => C7i99qwz1M
        [packageid] => 99
        [pid] => 99
        [serverid] => 7
        [status] => Pending
        [type] => hostingaccount
        [producttype] => hostingaccount
        [moduletype] => ispcfg3
        [configoption1] => whmcs
        [configoption2] => Lya6DdeAEHj4_
        [configoption3] => brohosting.xyz:8080
        [configoption4] => on
        [configoption5] => 1
        [configoption6] => default
        [configoption7] => no
        [configoption8] => no
        [configoption9] => on
        [configoption10] => on
        [configoption11] => 3.1
        [configoption12] => 256
        [configoption13] => 100000
        [configoption14] => Letsencrypt
        [configoption15] => none
        [configoption16] => no
        [configoption17] =>
        [configoption18] => on
        [configoption19] => ns1.domain.tld,ns2.domain.tld,webmaster,1,153.92.208.177
        [configoption20] => en
        [configoption21] =>
        [configoption22] => on
        [configoption23] =>
        [configoption24] =>
        [customfields] => Array
            (
                [Domain] => bebro.xyz
            )
    
        [configoptions] => Array
            (
            )
    ...
    
         
     
  17. JuSt

    JuSt New Member

    Look the name of your server in hostname directive, then you need to point this hostname in /etc/hosts, the problem is that WHMCS doesnt know how to resolve the server.

    Kind regards!
     
  18. Jaco Minnaar

    Jaco Minnaar New Member

    Hi,

    I get the following error message:

    Module Create Failed - Service ID: 2 - Error: SOAP Error: error_origin_empty<br />error_ns_empty<br />error_mbox_empty<br />error_refresh_empty<br />error_retry_empty<br />error_expire_empty<br />error_minimum_empty<br />error_ttl_empty<br />

    How can I resolve this ?
     
  19. JuSt

    JuSt New Member

    Its not mapping the DNS template and you are getting this error...normaly the number of the first DNS template its 0, its already configured?

    Kind regards
     
  20. cwispy

    cwispy Active Member

    Just thought a few screen-shots of the current changes to the module might be liked. These changes are to the client area pf WHMCS allowing the client to manage some of the general settings without the need to log in to ISPConfig.

    This is the client area menu for the product
    Screenshot-2017-11-1 Client Area - 2000 Computers Networks Pty Ltd.png

    An example of the Database User and DB section
    Screenshot_2017-11-01_14-53-01.png

    This is the form for adding a new AliasDomain.
    Screenshot_2017-11-01_14-53-33.png

    There is still quite a bit of work to be done to complete this. I thought I was almost there until I realised that there was no checking to see if the clients account was suspended or cancelled, so now I have to go back through it all again to make sure that a user can not override the suspension / cancellation.
     
    webguyz likes this.

Share This Page