migrate sites to an other server fails

Bug Report Template

Description

I want to migrate sites to an other server.

Steps to Reproduce

(first did stage=0) (a while ago)
apnscp_php /usr/local/apnscp/bin/scripts/transfersite.php --stage=1 -s <ip> --all

Environment

ApisCP version: cpcmd misc:cp-version

cpcmd misc:cp-version
revision: dc17cacc523c77f0ec582ddf21e3c292f0911e5c
timestamp: 1745540622
ver_maj: 3
ver_min: 2
ver_patch: 47
ver_pre: ''
dirty: false
debug: false

Operating System: uname -r

uname -r
5.4.293-1.el8.elrepo.x86_64
beginning migration: <domainname> (stage 1)
ERROR  : unknown(): migration failed - unhandled exception
         0. Error_Reporter::add_error("migration failed - unhandled exception", )
            [/usr/local/apnscp/lib/log_wrapper.php:72]
         1. error("migration failed - unhandled exception")
            [/usr/local/apnscp/bin/scripts/transfersite.php:247]
unknown(): migration failed - unhandled exception

Re-run as env DEBUG=1 transfersite.php - what does this report?

Setting migration stage `1'
Setting server `<serverip>'
beginning migration: <domainname> (stage 1)
unknown(): migration failed - unhandled exception
DEBUG  : DEBUG: Setting migration stage `1'
DEBUG: Setting migration stage `1'
DEBUG  : DEBUG: Setting server `<serverip>'
DEBUG: Setting server `<serverip>'
DEBUG  : DEBUG: beginning migration: <domainname> (stage 1)
DEBUG: beginning migration: <domainname> (stage 1)
DEBUG  : ERROR: unknown(): migration failed - unhandled exception
DEBUG  : Transfer <domainname> (error) Failed
ERROR  : unknown(): Error encountered during <domainname> migration. Migration                                                                                           is incomplete!
         0. Error_Reporter::add_error("Error encountered during %s migration. Mi                                                                                          gration is incomplete!", ["<domainname>"])
            [/usr/local/apnscp/lib/log_wrapper.php:72]
         1. error("Error encountered during %s migration. Migration is incomplet                                                                                          e!", "<domainname>")
            [/usr/local/apnscp/bin/scripts/transfersite.php:268]

Full backtrace is available to the address defined in [migration] => status_email, by default the email address is “apnscp” which delivers to root:

cpcmd scope:get cp.config migration status_email
# To change:
cpcmd scope:set cp.config migration status_email me@somewhere.com

To view mail delivered to “root”, run mutt to pull up email on the server. Look for the email titled, “Migration Error (EX)”. This will contain the origin of the unhandled exception.

e-mail message:

Reason: SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://<ip>:2083/apnscp.wsdl' : failed to load external entity "https://<ip>:2083/apnscp.wsdl"

         0. SoapClient->__construct("https://<ip>:2083/apnscp.wsdl", [connection_timeout:30, location:"https://<ip>:2083/soap?authkey=7ac1cd0a07363efdf5fe3ef1cefde99c84fb5a42af7de20b4f18d8110fb91203", uri:"urn:net.apnscp.api", trace:true, stream_context:stream-context])
            [/usr/local/apnscp/lib/Util/API.php:71]
         1. Util_API::create_client("7ac1cd0a07363efdf5fe3ef1cefde99c84fb5a42af7de20b4f18d8110fb91203", "192.168.11.112:2083")
            [/usr/local/apnscp/lib/CLI/Transfer.php:545]
         2. CLI_Transfer->_api_key_valid()
            [/usr/local/apnscp/lib/CLI/Transfer.php:515]
         3. CLI_Transfer->_create_api_client()
            [/usr/local/apnscp/lib/CLI/Transfer.php:147]
         4. CLI_Transfer->process()
            [/usr/local/apnscp/bin/scripts/transfersite.php:233]


array (
  0 =>
  array (
    'message' => 'Setting migration stage `1\'',
    'severity' => 1,
    'caller' => 'unknown',
    'bt' => NULL,
  ),
  1 =>
  array (
    'message' => 'Setting server `192.168.11.112\'',
    'severity' => 1,
    'caller' => 'unknown',
    'bt' => NULL,
  ),
  2 =>
  array (
    'message' => 'beginning migration: <domainname> (stage 1)',
    'severity' => 1,
    'caller' => 'CLI_Transfer::log',
    'bt' => NULL,
  ),
)

Import the target migration server’s certificate into the source server’s trusted certificates.

Migration fails because it’s performing API calls against https://<TARGET-IP>:2083/, which isn’t a hostname in the certificate SNI set.