security/acme-client: set default SFTP/SSH port if unset, fixes #4363

This commit is contained in:
Frank Wall 2024-12-03 23:11:28 +01:00
parent ee2eda08ed
commit 636a1f18ba
3 changed files with 7 additions and 2 deletions

View file

@ -8,6 +8,11 @@ WWW: https://github.com/acmesh-official/acme.sh
Plugin Changelog
================
4.7
Fixed:
* SFTP/SSH automation results in fatal PHP error (#4363)
4.6
Added:

View file

@ -189,7 +189,7 @@ function runRemoteCommand(array $options, &$error): ?array
$identity_type = trim(($options["identity-type"] ?? ""));
$host = trim(($options["host"] ?? ""));
$host_key = ($options["host-key"] ?? "");
$port = $options["port"] ?? 22;
$port = !empty($options["port"]) ? $options["port"] : SSHKeys::DEFAULT_PORT;
$username = $options["user"] ?? false;
$command = $options["run"] ?? "";

View file

@ -317,7 +317,7 @@ function connectWithServer(array $options, &$error): ?SftpClient
$identity_type = trim(($options["identity-type"] ?? "")) ?: SSHKeys::DEFAULT_IDENTITY_TYPE;
$host = trim(($options["host"] ?? ""));
$host_key = ($options["host-key"] ?? "");
$port = $options["port"] ?? 22;
$port = !empty($options["port"]) ? $options["port"] : SSHKeys::DEFAULT_PORT;
$username = $options["user"];
$sftp = new SftpClient(configPath(), $identity_type);