Skip to content

[bug]: Backup warm spare SSH restore ignores Filestore SSH port and fails after successful SFTP copy #84

@mobilebob

Description

@mobilebob

FreePBX Version

FreePBX 17

Issue Description

Warm Spare backup using "Connect Warm Spare Server Over: SSH" successfully creates the backup and successfully copies the .tar.gz file to the warm spare via the configured SSH/SFTP Filestore, but then fails when triggering the restore on the spare server.

The CLI backup job exits with code 0, but prints:

Warmspare enabled for this backup
We are running Restore command on Spare Server
Response from Warmspare Server
backup transactionid:6af4a9e8-8fe7-4a20-82e1-e7eaddbff856
Restorestatus :Error running Restore on Spare Server

In /var/www/html/admin/modules/backup/Backup.class.php, RunRestoreusingSSH() loads the SSH Filestore config and uses:

$key = $filestore['key'];
$user = $filestore['user'];
$host = $filestore['host'];
$sparefilepath = $filestore['path'];

but it does not appear to use the Filestore SSH port.

The restore command is hard-coded as:

$command = "ssh -tt -i $key -o StrictHostKeyChecking=no $user@$host '/usr/sbin/fwconsole backup --restore $path$filename --transaction=$transactionid'";

This means the SFTP copy can succeed using the configured Filestore port, but the restore trigger always attempts SSH on the default port 22.

In my environment, the Filestore SSH/SFTP port is 2222. Manual tests confirm:

ssh to host on port 22: Connection timed out
ssh to host on port 2222: works when using the correct key/path

So the restore trigger fails because it does not include -p .

Operating Environment

FreePBX Version

FreePBX 17.0.28

Module

Backup & Restore

Backup module version

17.0.5.71

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions