Documentation

Agent
in package
uses ReadBytes

Pure-PHP ssh-agent client identity factory

requestIdentities() method pumps out \phpseclib3\System\SSH\Agent\Identity objects

Tags
author

Jim Wigginton terrafrost@php.net

access

public

Table of Contents

Constants

FORWARD_ACTIVE  = 2
FORWARD_NONE  = 0
FORWARD_REQUEST  = 1
SSH_AGENT_FAILURE  = 5
Unused
SSH_AGENT_IDENTITIES_ANSWER  = 12
SSH_AGENT_SIGN_RESPONSE  = 14
SSH_AGENTC_REQUEST_IDENTITIES  = 11
SSH_AGENTC_SIGN_REQUEST  = 13

Properties

$expected_bytes  : int
Tracking the number of bytes we are expecting to arrive for the agent socket on the SSH data channel
$forward_status  : int
Agent forwarding status
$fsock  : resource
Socket Resource
$request_channel  : int
The current request channel
$socket_buffer  : string
Buffer for accumulating forwarded authentication agent data arriving on SSH data channel destined for agent unix socket

Methods

__construct()  : Agent
Default Constructor
forwardData()  : string
Forward data to SSH Agent and return data reply
readBytes()  : mixed
Read data
registerChannelOpen()  : mixed
On successful channel open
requestIdentities()  : array<string|int, mixed>
Request Identities
startSSHForwarding()  : bool
Signal that agent forwarding should be requested when a channel is opened
request_forwarding()  : bool
Request agent forwarding of remote server

Constants

FORWARD_ACTIVE

public mixed FORWARD_ACTIVE = 2

FORWARD_NONE

public mixed FORWARD_NONE = 0

FORWARD_REQUEST

public mixed FORWARD_REQUEST = 1

SSH_AGENT_FAILURE

Unused

public mixed SSH_AGENT_FAILURE = 5

SSH_AGENT_IDENTITIES_ANSWER

public mixed SSH_AGENT_IDENTITIES_ANSWER = 12

SSH_AGENT_SIGN_RESPONSE

public mixed SSH_AGENT_SIGN_RESPONSE = 14

SSH_AGENTC_REQUEST_IDENTITIES

public mixed SSH_AGENTC_REQUEST_IDENTITIES = 11

SSH_AGENTC_SIGN_REQUEST

public mixed SSH_AGENTC_SIGN_REQUEST = 13

Properties

$expected_bytes

Tracking the number of bytes we are expecting to arrive for the agent socket on the SSH data channel

private int $expected_bytes = 0
Tags
access

private

$forward_status

Agent forwarding status

private int $forward_status = self::FORWARD_NONE
Tags
access

private

$fsock

Socket Resource

private resource $fsock
Tags
access

private

$request_channel

The current request channel

private int $request_channel
Tags
access

private

$socket_buffer

Buffer for accumulating forwarded authentication agent data arriving on SSH data channel destined for agent unix socket

private string $socket_buffer = ''
Tags
access

private

Methods

__construct()

Default Constructor

public __construct([mixed $address = null ]) : Agent
Parameters
$address : mixed = null
Tags
throws
BadConfigurationException

if SSH_AUTH_SOCK cannot be found

throws
RuntimeException

on connection errors

access

public

Return values
Agent

forwardData()

Forward data to SSH Agent and return data reply

public forwardData(string $data) : string
Parameters
$data : string
Tags
throws
RuntimeException

on connection errors

access

public

Return values
string

Data from SSH Agent

readBytes()

Read data

public readBytes(int $length) : mixed
Parameters
$length : int
Tags
throws
RuntimeException

on connection errors

access

public

registerChannelOpen()

On successful channel open

public registerChannelOpen(SSH2 $ssh) : mixed

This method is called upon successful channel open to give the SSH Agent an opportunity to take further action. i.e. request agent forwarding

Parameters
$ssh : SSH2
Tags
access

private

requestIdentities()

Request Identities

public requestIdentities() : array<string|int, mixed>

See "2.5.2 Requesting a list of protocol 2 keys" Returns an array containing zero or more \phpseclib3\System\SSH\Agent\Identity objects

Tags
throws
RuntimeException

on receipt of unexpected packets

access

public

Return values
array<string|int, mixed>

startSSHForwarding()

Signal that agent forwarding should be requested when a channel is opened

public startSSHForwarding(SSH2 $ssh) : bool
Parameters
$ssh : SSH2
Tags
access

public

Return values
bool

request_forwarding()

Request agent forwarding of remote server

private request_forwarding(SSH2 $ssh) : bool
Parameters
$ssh : SSH2
Tags
access

private

Return values
bool

        
On this page

Search results