Commit Graph

27 Commits

Author SHA1 Message Date
bfu4 23b99eba9c
man 2021-11-18 20:07:30 -05:00
Kaleb Elwert c9fc4412c4
Merge pull request #134 from vladimir-ch/session-docs-typo
Fix typo in Session docs
2021-06-28 00:39:05 -07:00
meislerj fb34512070
Register chan to Session to listen for break requests (#141)
Co-authored-by: Jacob Meisler <meislerj@amazon.com>
2020-10-07 09:30:10 -07:00
Kaleb Elwert a462277fdd Add subsystem support 2020-07-17 15:08:56 -07:00
Vladimír Chalupecký a7de8ac255 Fix typo in Session docs 2020-02-13 11:51:32 +01:00
Kaleb Elwert 5b6cc7030f
Merge pull request #110 from gliderlabs/belak/raw-cmd
Add Session.RawCommand()
2019-06-19 20:22:20 -07:00
Andrew Chambers 44274595c2 Add Session.RawCommand() 2019-06-19 00:20:00 -07:00
Kaleb Elwert dd61f8b0d5 Disable port forwarding by default
Fixes #68
2019-06-12 10:52:26 -07:00
Kaleb Elwert e5ece1489c Add SessionPolicyCallback (#80)
* Add SessionPolicyCallback

Closes #7

* Update docs related to the embedded sync.Locker in the Context

* Fix mutex in context
2019-02-22 20:11:43 -06:00
Jeff Lindsay cbabf54144
Remote forwarding (#88)
* context: fixed documentation to be more specific about ContextKeyConn being the key for a gossh.ServerConn

Signed-off-by: Jeff Lindsay <progrium@gmail.com>

* server: fixes handler setup, changed to interface based handlers, added global request handler map

* tcpip: working remote forwarding

Signed-off-by: Jeff Lindsay <progrium@gmail.com>

* context: docs typo

Signed-off-by: Jeff Lindsay <progrium@gmail.com>

* session: always reply to unblock clients trying something

Signed-off-by: Jeff Lindsay <progrium@gmail.com>

* tcpip: stop listening when ssh clients disconnect

Signed-off-by: Jeff Lindsay <progrium@gmail.com>

* Remote forwarding (#87)

* Update generateSigner key size to 2048 (#62)

Fixes #58

* Add syntax highlighting to readme (#67)

* small api updates (#69)

These updates make it easier to implement and pass custom Session and
Context implementations

No compatibilty breaking, all tests pass

* Move channelHandlers to avoid data race (#59)

* Update tests to work with go 1.10+ (#73)

Fixes #72

* Update shutdown to use a WaitGroup rather than sleeping (#74)

* Fix race condition in TestServerClose (#75)

In test server close, 3 things need to happen in order:

- Client session start
- Server.Close
- Client session exit (With io.EOF)

This fix ensures the client won't do anything until after the call to
close which ensure's we'll get io.EOF rather than a different error.

* Update circleci config to test multiple go versions

* Update CircleCI config to test 1.9 and the latest

The x/crypto/ssh library dropped support go < 1.9 as that's the first
version to have the math/bits library.

83c378c48d

* Wait for connections to finish when shutting down

PR #74 introduced a WaitGroup for listeners, but it doesn't wait for
open connections before closing the server. This patch waits until all
conns are closed before returning from Shutdown.

*  Support port forwarding of literal IPv6 addresses (#85)

* Support port forwarding of literal IPv6 addresses

To disambiguate between colons as host:port separators and as IPv6 address separators, literal IPv6 addresses use square brackets around the address (https://en.wikipedia.org/wiki/IPv6_address#Literal_IPv6_addresses_in_network_resource_identifiers).  So host ::1, port 22 is written as [::1]:22, and therefore a simple concatenation of host, colon, and port doesn't work.  Fortunately net.JoinHostPort already implements this functionality, so with a bit of type gymnastics we can generate dest in an IPv6-safe way.

* Support port forwarding of literal IPv6 addresses

To disambiguate between colons as host:port separators and as IPv6 address separators, literal IPv6 addresses use square brackets around the address (https://en.wikipedia.org/wiki/IPv6_address#Literal_IPv6_addresses_in_network_resource_identifiers).  So host ::1, port 22 is written as [::1]:22, and therefore a simple concatenation of host, colon, and port doesn't work.  Fortunately net.JoinHostPort already implements this functionality, so with a bit of type gymnastics we can generate dest in an IPv6-safe way.

* Reverse port forwarding callback added

* garbage removed
2018-11-13 10:04:02 -06:00
Manfred Touron 47df570d18 small api updates (#69)
These updates make it easier to implement and pass custom Session and
Context implementations

No compatibilty breaking, all tests pass
2018-01-09 12:15:16 -06:00
Jeff Lindsay 3eeacb7850
session: adding signal handling support (#44) 2017-11-01 18:03:54 -05:00
Shuanglei Tao 9ccc7bbb64 Document session context canceling (#50) 2017-07-31 13:53:11 -05:00
Mester f892d8d851 Added LocalAddr() to session interface (#48) 2017-07-20 17:09:24 -05:00
aerth 74da58b7bb check for nil interface before returning public key (#37) 2017-05-22 16:12:18 -05:00
Jeff Lindsay 1051a0d154 agent forwarding support (#31)
* agent: added agent forwarding support with an example
* context: encode session id to hex string
* agent: ensure conn doesn't change in closure as loop iterates
* tests: use HostKeyCallback in ClientConfig
* README: noting examples in _example
* agent: documented exported names, added constants for temp file creation

Signed-off-by: Jeff Lindsay <progrium@gmail.com>
2017-04-14 14:47:40 -05:00
Jeff Lindsay 9b56478e13 contexts (#29)
* context: working mostly tested context implementation and refactoring to go with it
* _example/ssh-publickey: updating new context based callbacks
* godocs related to public api changes for contexts
* context: converting []bytes to strings before putting into context

Signed-off-by: Jeff Lindsay <progrium@gmail.com>
2017-03-14 14:13:03 -05:00
Jeff Lindsay edf30fc0aa Fix short write (#28)
* session: pty normalization hack needs to return expected bytes written or chaos ensues, such as short write errors
* _example: renaming to avoid editors that auto-install from making docker binaries in your path that aren't docker
* session: keep extra calculations limited to pty case

Signed-off-by: Jeff Lindsay <progrium@gmail.com>
2017-02-16 15:59:07 -06:00
Jeff Lindsay a2a474964c fixed/finished basic pty support, added an example, and included tests (#25)
* fixed/finished basic pty support, added an example, and included tests
* session: make the window channel have buffer of 1 and send initial window size on it
* _example/docker: added an ssh to docker-run example
* changes from review: let Reply handle WantReply, only allow setting sess.pty once
* circle: hopefully a working circleci config
2017-02-15 18:08:25 -06:00
Jeff Lindsay 39bc88bc6d Merge pull request #15 from atlassian/belak/always-send-pty-response
Always respond to PTY requests
2017-02-03 18:42:23 -06:00
Jeff Lindsay d6ddd5d5dc Merge pull request #18 from atlassian/belak/ensure-exit-only-called-once
Ensure Session.Exit can only be called once
2017-02-03 18:19:25 -06:00
Kaleb Elwert 71d4b985d1 Ensure Session.Exit can only be called once 2017-02-03 16:00:28 -08:00
Kaleb Elwert b9687a28f0 Always respond to PTY requests
Fixes #13
2017-02-03 15:26:58 -08:00
Kaleb Elwert 8fb939fd33 Send the exec/shell reply before starting the session
Fixes #8
2017-02-03 15:25:07 -08:00
Jeff Lindsay c3f37d4334 more docs, license, readme.
Signed-off-by: Jeff Lindsay <progrium@gmail.com>
2016-11-30 16:06:57 -06:00
Jeff Lindsay 7f8cc2a19a docs and examples
Signed-off-by: Jeff Lindsay <progrium@gmail.com>
2016-11-29 17:23:42 -06:00
Jeff Lindsay adbd4da93a initial commit 2016-10-03 16:54:17 -05:00