Skip to content

Commit f17dc9b

Browse files
committed
Add server-side auth-agent
1 parent 2283929 commit f17dc9b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,8 @@ You can find more examples in the `examples` directory of this repository.
901901

902902
* **forwardOut**(< _string_ >boundAddr, < _integer_ >boundPort, < _string_ >remoteAddr, < _integer_ >remotePort, < _function_ >callback) - _boolean_ - Alert the client of an incoming TCP connection on `boundAddr` on port `boundPort` from `remoteAddr` on port `remotePort`. `callback` has 2 parameters: < _Error_ >err, < _Channel_ >stream. Returns `false` if you should wait for the `continue` event before sending any more traffic.
903903

904+
* **openssh_authAgent**(< _function_ >callback) - _boolean_ - Alert the client of an incoming `ssh-agent` socket connection. `callback` has 2 parameters: < _Error_ >err, < _Channel_ >stream. Returns `false` if you should wait for the `continue` event before sending any more traffic.
905+
904906
* **openssh_forwardOutStreamLocal**(< _string_ >socketPath, < _function_ >callback) - _boolean_ - Alert the client of an incoming UNIX domain socket connection on `socketPath`. `callback` has 2 parameters: < _Error_ >err, < _Channel_ >stream. Returns `false` if you should wait for the `continue` event before sending any more traffic.
905907

906908
* **rekey**([< _function_ >callback]) - _boolean_ - Initiates a rekeying with the client. If `callback` is supplied, it is added as a one-time handler for the `rekey` event. Returns `false` if you should wait for the `continue` event before sending any more traffic.
@@ -949,7 +951,7 @@ You can find more examples in the `examples` directory of this repository.
949951

950952
* **name** - _string_ - The signal name (e.g. `SIGUSR1`).
951953

952-
* **auth-agent**(< _mixed_ >accept, < _mixed_ >reject) - The client has requested incoming ssh-agent requests be forwarded to them. `accept` and `reject` are functions if the client requested a response and return `false` if you should wait for the `continue` event before sending any more traffic.
954+
* **auth-agent**(< _mixed_ >accept, < _mixed_ >reject) - The client has requested incoming ssh-agent requests be forwarded to them. `accept` and `reject` are functions if the client requested a response.
953955

954956
* **shell**(< _mixed_ >accept, < _mixed_ >reject) - The client has requested an interactive shell. `accept` and `reject` are functions if the client requested a response. `accept()` returns a _Channel_ for the interactive shell. `reject()` Returns `false` if you should wait for the `continue` event before sending any more traffic.
955957

lib/server.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,11 @@ Client.prototype.forwardOut = function(boundAddr, boundPort, remoteAddr,
648648
return openChannel(this, 'forwarded-tcpip', opts, cb);
649649
};
650650

651+
Client.prototype.openssh_authAgent = function(cb) {
652+
var opts = {};
653+
return openChannel(this, 'auth-agent@openssh.com', opts, cb);
654+
};
655+
651656
Client.prototype.openssh_forwardOutStreamLocal = function(socketPath, cb) {
652657
var opts = {
653658
socketPath: socketPath
@@ -1123,6 +1128,8 @@ function openChannel(self, type, opts, cb) {
11231128
ret = sshstream.forwardedTcpip(localChan, initWindow, maxPacket, opts);
11241129
else if (type === 'x11')
11251130
ret = sshstream.x11(localChan, initWindow, maxPacket, opts);
1131+
else if(type == "auth-agent@openssh.com")
1132+
ret = sshstream.openssh_authAgent(localChan, initWindow, maxPacket);
11261133
else if (type === 'forwarded-streamlocal@openssh.com') {
11271134
ret = sshstream.openssh_forwardedStreamLocal(localChan,
11281135
initWindow,

0 commit comments

Comments
 (0)