ISPConfig Mail Import

Discussion in 'General' started by davefrooney, Apr 28, 2016.

  1. davefrooney

    davefrooney Member

    Hey, I am trying to migrate my mail users from and old ispconfig server to a new one. I have created the remote user on the old server and checked the relevant boxes. I have added these details in the Import tool on the new server but I am getting the the following error

    ERROR

    1. Could not connect to host

    I have looked through the logs but there are no errors.
    Can anyone advise on this issue?
    Thanks in advance
     
  2. florian030

    florian030 Well-Known Member HowtoForge Supporter

    There are some reasons why the API-Connect fails (wrong details, selfsigned ssl-cert, maintaince-mode). You can try the script below to see the error:
    Code:
    <?php
    $conf['remote_uri'] = 'http://example.com:8080/remote/';
    $conf['remote_user'] = 'remote';
    $conf['remote_password'] = 'secret';
    $remote = new SoapClient(null, array(  'location' => $conf['remote_uri'].'index.php',
    'uri'  => $conf['remote_uri'],
    'trace' => 1,
    'exceptions' => 1));
    try {
    $session_id = $remote->login($conf['remote_user'], $conf['remote_password']);
    } catch (SoapFault $e) {
    $error .= print_r($e,true);
    $error .= $remote->__getLastResponse();
    }
    if($error != '') {
    echo $error;
    }
    ?>
    
     
  3. davefrooney

    davefrooney Member

    Hi Florian, thanks for getting back to me. I ran your script and I received the following output
    Code:
    PHP Notice:  Undefined variable: error in /tmp/isp.php on line 12
    SoapFault Object
    (
      [message:protected] => Could not connect to host
      [string:Exception:private] =>
      [code:protected] => 0
      [file:protected] => /tmp/isp.php
      [line:protected] => 10
      [trace:Exception:private] => Array
      (
      [0] => Array
      (
      [function] => __doRequest
      [class] => SoapClient
      [type] => ->
      [args] => Array
      (
      [0] => <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://my.server.com:8080/remote/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:login><param0 xsi:type="xsd:string">myuser</param0><param1 xsi:type="xsd:string">mypass</param1></ns1:login></SOAP-ENV:Body></SOAP-ENV:Envelope>
    
      [1] => https://my.server.com:8080/remote/index.php
      [2] => https://my.server.com:8080/remote/#login
      [3] => 1
      [4] => 0
      )
    
      )
    
      [1] => Array
      (
      [file] => /tmp/isp.php
      [line] => 10
      [function] => __call
      [class] => SoapClient
      [type] => ->
      [args] => Array
      (
      [0] => login
      [1] => Array
      (
      [0] => myuser
      [1] => mypass
      )
    
      )
    
      )
    
      [2] => Array
      (
      [file] => /tmp/isp.php
      [line] => 10
      [function] => login
      [class] => SoapClient
      [type] => ->
      [args] => Array
      (
      [0] => myuser
      [1] => mypass
      )
    
      )
    
      )
    
      [previous:Exception:private] =>
      [faultstring] => Could not connect to host
      [faultcode] => HTTP
    )
    
    It is telling me that the fault code is HTTP. I don have a self-signed certificate but I made changes to my php.ini based on this post
    Is there anything else I can try?
     
  4. davefrooney

    davefrooney Member

    Update
    Disabling https on the remote server allowed me to access the mail import over http. After a lot of reading, the issue seems to lie in the self-signed certificate on ISPConfig. This seems to only occur in PHP 5.6 +.
    I tried doing the following, but this had no effect
    Code:
    cp /usr/local/ispconfig/interface/ssl/ispserver.crt /usr/local/share/ca-certificates/
    update-ca-certificates
    
    Then add the following to /etc/php5/*/php.ini under the openssl section
    Code:
    [openssl] 
    openssl.cafile=/etc/ssl/certs/ca-certificates.crt
    
    Is there another solution to allow the connection using a self-signed certificate?
     

Share This Page