Remote API fails after upgrade 3.1.15p2 -> 3.2.8p1

Discussion in 'Developers' Forum' started by Rafael Volpe, Jun 8, 2022.

  1. Rafael Volpe

    Rafael Volpe New Member

    Hi Guys,

    Im having some problems on remote api after upgrade ISPConfig Version: 3.1.15p2 to ISPConfig Version: 3.2.8p1.
    This is my script soap to exec a create customer/mail_domain:

    $soap_location = 'https://myserver/remote/index.php';
    $soap_uri = 'https://myserver/remote/';

    $client = new SoapClient(null, array('location' => $soap_location,
    'uri' => $soap_uri,
    'trace' => 1,
    'stream_context'=> stream_context_create(array('ssl'=> array('verify_peer'=>false,'verify_peer_name'=>false))),
    'exceptions' => 1));

    try {
    if ($session_id = $client->login($username, $password)) {

    }
    $params = array(
    'company_name' => $data['domain_www'],
    'contact_name' => $data['domain_contact'],
    'country' => 'US',
    'email' => $data['domain_contact_email'],
    'default_mailserver' => 1,
    'limit_maildomain' => 1,
    'limit_mailbox' => 10,
    'limit_mailalias' => 10,
    'limit_mailaliasdomain' => 0,
    'limit_mailforward' => 10,
    'limit_mailcatchall' => 0,
    'limit_mailrouting' => 0,
    'limit_mailfilter' => -1,
    'limit_fetchmail' => 0,
    'limit_mailquota' => $data['quota'],
    'limit_spamfilter_wblist' => -1,
    'limit_spamfilter_user' => -1,
    'limit_spamfilter_policy' => -1,
    'default_webserver' => 0,
    'limit_web_ip' => '',
    'limit_web_domain' => 0,
    'limit_web_quota' => 0,
    'web_php_options' => 'no,fast-cgi,mod',
    'limit_web_subdomain' => 0,
    'limit_web_aliasdomain' => 0,
    'limit_ftp_user' => 0,
    'limit_shell_user' => 0,
    'ssh_chroot' => 'no,jailkit,ssh-chroot',
    'limit_webdav_user' => 0,
    'default_dnsserver' => 0,
    'limit_dns_zone' => 0,
    'limit_dns_slave_zone' => 0,
    'limit_dns_record' => 0,
    'default_dbserver' => 0,
    'limit_database' => 0,
    'limit_cron' => 0,
    'limit_cron_type' => 'url',
    'limit_cron_frequency' => 5,
    'limit_traffic_quota' => 0,
    'username' => $data['domain_username'],
    'password' => $data['domain_pass'],
    'language' => 'en',
    'usertheme' => 'default',
    'template_additional' => '',
    'created_at' => 0
    );

    $client_id = $client->client_add($session_id, 0, $params);
    //Im receveing client_id correctly
    $params = array(
    'server_id' => 1,
    'domain' => $data['domain_www'],
    'active' => 'y'
    );

    $domain_id = $client->mail_domain_add($session_id, $client_id, $params);
    //Im receiving domain_id correctly

    $data = [$domain_id, $client_id];
    return $data;
    //returns $data correctly

    } catch (SoapFault $e) {
    echo $client->__getLastResponse();
    die('SOAP Error: ' . $e->getMessage());
    }
    }
    }


    So, every response looks fine and i can see the customer created correctly. The mail domain was created without a Customer defined. :(
    There is no one CP user and i cant login at ISPConfig panel too.

    I think something changed at API after this upgrade.
    Please, anyone can help?

    Regards.
     
  2. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    I know some options where added for mail_domains, so check if all possible values are passed to the API.
     
  3. Rafael Volpe

    Rafael Volpe New Member

    Hi @Th0m
    Thanks for your answer.
    How to properly check this options with current documentation offline?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Documentation of the API is not offline and never was, it is part of the ISPConfig tar.gz that you downloaded to install ISPConfig and the documentation can also be viewed online too: https://git.ispconfig.org/ispconfig/ispconfig3/-/tree/develop/remoting_client

    But what @Th0m probably meant is that you take a look at the database tables directly, in this case client and mail_domain, and compare the record that your script inserts with one that you created in ISPConfig GUI and adjust the parameters in $params array, which match the columns of the database table (just leave out the sys_* tables and the primary id column).
     
  5. Rafael Volpe

    Rafael Volpe New Member

    Hi Guys,

    thanks for your replies.

    Im back with more details.

    With the ISPCONFIG upgrade i also performed the UPGRADE from Ubuntu 18 -> 20.
    MYSQL has been updated from version 5.7 to 8 automatically.
    Everthyng looks fine and all permissions are ok inside of MYSQL. (postfix/dovecot/roundcube) are both running and connecting without problems.

    The problem specifically does not occur in the API but in the creation of the user when asked to create a new domain.
    MYSQL 8 is supported by ISPCONFIG?
    The problem was solved downgrading MYSQL to 5.7..

    Is there something im missing?
     
  6. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    So to confirm, the 'client_add' api call fails when using mysql 8, but works under 5.7 with exact same parameters?

    Did you look on the control panel node for errors from mysqld? Likely there is one generated when the failure happens.
     
  7. Rafael Volpe

    Rafael Volpe New Member

    Hi @Jesse Norell,

    No.
    The ISPCONFIG API returns with CLIENT ID and DOMAIN ID as expected without any error but when you check the domains list the client doesnt appear as owner of this domain.

    The client field is empty and no cpuser was created for this domain.

    With ISPCONFIG at DEBUG mode i cant see errors at log for this operation.
     
  8. Rafael Volpe

    Rafael Volpe New Member

    @Jesse Norell

    Yes, the same parameters.
    After downgrade to MYSQL 5.7 everything works again without problems.
     
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    MySQL 8 should generally work but we don't use it in any of our supported setups nor do we specifically test it, but it might be that you configured it with a too strict SQL mode.
     
  10. Rafael Volpe

    Rafael Volpe New Member

    hi @till

    Before downgrade MYSQL I thought it might be related to the strict mode.
    Tested with:

    sql_mode=

    at mysqld.cnf without successfull.
    This was the first change after upgrade because without this parameter i cant login at ISPCONFIG.
     
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    An empty SQL mode setting on MySQL 8 is probably already a stricter mode than what MySQL 5.7 uses as they tend to make defaults stricter with each major version.
     

Share This Page