Commit Graph

20 Commits

Author SHA1 Message Date
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
Philipp C. Heckel
4b72c663cf Add DefaultServerConfigCallback option for create custom default (#95)
ServerConfigs
2019-02-21 13:57:56 -06:00
Aidan Steele
6dcd5356b5 Added Server.KeyboardInteractiveHandler 2019-01-06 15:25:33 +11: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
John Barnette
d3a6756290 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.
2018-05-07 16:10:55 -07:00
Kaleb Elwert
ef66069ab6 Update shutdown to use a WaitGroup rather than sleeping (#74) 2018-04-16 19:30:27 -05:00
phil-halley
d6295a6cbc Move channelHandlers to avoid data race (#59) 2018-04-04 13:06:36 -05: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
Anmol Sethi
c986e7ff5f fix timeout bug (#52)
Closes #51
2017-08-11 16:45:54 -05:00
Jeff Lindsay
48c9603bfc server: timeouts and context canceling on closed connections (#46)
Signed-off-by: Jeff Lindsay <progrium@gmail.com>
2017-07-24 16:25:45 -05:00
Jeff Lindsay
33ad2fe318 [proposal] ConnCallback (#36)
ConnCallback lets you wrap connection objects for timeouts and limiting
2017-07-12 12:27:56 -05:00
Matt Aitchison
b47c6daa4b server: first pass at Shutdown and Close (#34)
* server: first pass at Shutdown and Close
* server: remove unused struct field
* server: replace http reference in error

closes: #22
2017-05-22 16:11:06 -05:00
Mahmood Ali
20a454724d Support for local port forwarding (#38)
* Support local port forwarding
* refactor testSession to return ssh client as well
* Tests for local port forwarding
2017-04-28 17:54:12 -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
0922cadde6 fixing a type led to general cleanup. also added a comment.
Signed-off-by: Jeff Lindsay <progrium@gmail.com>
2017-02-14 18:30:43 -06:00
Kaleb Elwert
80be538d5c Add ServerVersion as an option in the config 2017-02-03 16:22:13 -08:00
Murilo Santana
42d6dfc2a9 fix argument name 2016-11-30 23:56:46 -02: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