22 lines
646 B
PHP
22 lines
646 B
PHP
<?php
|
|
|
|
namespace App\Services\Ssh;
|
|
|
|
/**
|
|
* A connected SSH session to a single host. Implementations are stateful:
|
|
* connect once, then run/putFile against that connection.
|
|
*/
|
|
interface RemoteShell
|
|
{
|
|
public function connectWithPassword(string $host, string $user, string $password): void;
|
|
|
|
public function connectWithKey(string $host, string $user, string $privateKey): void;
|
|
|
|
public function run(string $command): CommandResult;
|
|
|
|
public function putFile(string $remotePath, string $contents): void;
|
|
|
|
/** SSH host key fingerprint of the connected server (for pinning). */
|
|
public function hostKeyFingerprint(): string;
|
|
}
|