fix: ipv6 scp should use -6 flag

This commit is contained in:
Andras Bacsai
2024-10-02 08:15:03 +02:00
parent 73e38ff951
commit 4d86b556a4
2 changed files with 8 additions and 1 deletions

View File

@@ -94,7 +94,9 @@ class SshMultiplexingHelper
$muxPersistTime = config('constants.ssh.mux_persist_time'); $muxPersistTime = config('constants.ssh.mux_persist_time');
$scp_command = "timeout $timeout scp "; $scp_command = "timeout $timeout scp ";
if ($server->isIpv6()) {
$scp_command .= '-6 ';
}
if (self::isMultiplexingEnabled()) { if (self::isMultiplexingEnabled()) {
$scp_command .= "-o ControlMaster=auto -o ControlPath=$muxSocket -o ControlPersist={$muxPersistTime} "; $scp_command .= "-o ControlMaster=auto -o ControlPath=$muxSocket -o ControlPersist={$muxPersistTime} ";
self::ensureMultiplexedConnection($server); self::ensureMultiplexedConnection($server);

View File

@@ -1221,4 +1221,9 @@ $schema://$host {
return instant_remote_process($commands, $this, false); return instant_remote_process($commands, $this, false);
} }
public function isIpv6(): bool
{
return str($this->ip)->contains(':');
}
} }