Commit Graph
57 Commits
Author SHA1 Message Date
Jakub Nyckowski 0ee91f6c37 Enable GCI linter (#17894) 2022-10-28 20:20:28 +00:00
Krzysztof Skrzętnicki fe78fdc374 tsh ssh --forward and --dynamic-forward: graceful error handling (#14745)
* `tsh ssh`: graceful error handling for forwarding.

Both regular and dynamic port forwarding will now:
-  continue to accept connections even if an error occurred
   for whatever reason (e.g., invalid proxy protocol.)
- log richer information
- shut down the listen loop on parent context closure
2022-07-26 15:08:29 +00:00
Russell Jones f87c2b11c2 Refactor tests under client package.
Refactored all tests under "lib/client" to use testify instead
of gocheck.
2022-07-15 08:09:08 -07:00
rosstimothy e5c745f331 Add manual tracing instrumentation to tsh (#13204)
Create spans for all public facing TeleportClient,
ProxyClient, and NodeClient methods. This makes
correlating spans easier to reason about when
looking at `tsh` traces. As a result of creating
spans, some additional context propagation is
required as well to ensure that spans are linked
properly.

This also removes the unused `quiet` argument from
`ConnectToCluster`. It's usage was not consistent
by existing callers, and it was ignored, so in order
to avoid confusion in future calls, it was removed.

#12241
2022-06-11 15:34:40 +00:00
Zac Bergquist c8af176828 Remove more deprecated code (#13132)
* Remove more deprecated code

In the case where we were using the PostalCode, StreetAddress,
and Province fields rather than ASN.1 extensions we could have
removed more code, but I opted for a phase approach where we stop
populating the fields in v10 (but still accept them), and then
stop reading them entirely in v11.

* Fix lints and remove more unused code

* Restore StreetAddress / PostalCode

We don't yet have dedicated extensions for these
2022-06-07 03:38:33 +00:00
rosstimothy 9f094aaef6 Add tracing instrumentation for ssh clients/servers (#12434)
* Add tracing instrumentation for ssh clients/servers

Add tracing context to the existing ProxyHelloSignature to provide
span information across ssh connections. To add span context per
ssh session on top of new connections, the same tracing context is
passed in the first global request of the session.

In order to ensure that tracing context is pulled from and inserted
into the proper context.Context, some interfaces and methods were
changed to take one as the first argument.
2022-05-25 12:24:02 +00:00
Zac Bergquist 55cbd0ac97 Remove use of deprecated ioutil package (#11296)
* Remove use of deprecated ioutil package
* Add lint rule to check for ioutil imports
2022-03-21 18:00:34 +00:00
Tim Buckley 01acea141a Add support for tsh ssh on Windows (#7790)
* Add support for `tsh ssh` on Windows

This adds Windows session support to tsh, taking advantage of ANSI
terminal support and VT emulation added in recent versions Windows
10. On supported Windows versions (Windows 10 1607+), `tsh ssh`
should work as expected in `cmd.exe`, PowerShell, and the new
Windows Terminal app.

* Address a few review comments

* Remove significant chunks of unnecessary tncon code.

Removes the global buffer, `GetVTSeqFromKeyStroke`, and several
ancillary headers and functions that aren't needed for our (current)
use-case. Also removes mouse and focus events.

* Refactor OS-specific terminal handling

This significantly simplifies OS-specific terminal behavior:
 * Move OS specific terminal code into a new `terminal` package
 * Remove `session_windows.go` in favor of an OS-independent
   `session.go`, defer to terminal package for OS specific
   functionality.
 * Remove ConPTY since it's not needed.
 * Always wait for the terminal and ssh session to fully close before
   quitting.
 * Refactor tncon; ensure the raw reader can be closed and reopened,
   remove lots of unnecessary C code.

* Revert dependency changes

* Use WindowsOS constant.

* Fix `tsh play` on Windows

This fixes `tsh play` on Windows by using the new `terminal` module to
initialize the terminal for raw input in a cross-platform way.

Additionally, this simplifies `terminal.New()` since in practice we never
want interactive mode at init time, and  fixes a broken unit test.

* Use correct log library

* Fix `tsh play` player controls on Windows

This fixes the console player controls on Windows as well as the timestamp
writer.

* Clean up lints

* Add missing license header

* Fix broken unit test

* Fix cross-compile builds on Linux/Docker

We need windows.h, which is not capitalized in the mingw packages
(and is case insensitive on Windows).

* Address code review feedback

 - Rename `Terminal.InitInteractive` to `Terminal.InitRaw`
 - Ensure goroutines terminate on close
 - Fix outdated godoc comments
 - Ensure Terminal event subscribers are cleared (and their channels
   are closed)
 - Ensure terminal output mode is reset on error in initTerminal
 - Bubble up errors in Terminal.Close()
 - Add author notice to tncon.c re: our changes
 - Add go-ansiterm as a direct dependency
 - Run `make update-vendor`

* Add constants and a small player.go TODO.

* Clear linter warning
2021-09-16 15:53:08 -06:00
Russell Jones 43fc9f6de6 Added support for a cancelable Accept.
Added support for a cancellation Accept to allow port forwarding listener to be
closed upon cancellation of the passed in context.
2021-01-28 16:56:07 -08:00
Andrew Lytvynov 4c098cb3a9 Ensure that disconnects propagate through port-forwarded tunnel
When a client terminates, it should propagate over to the server on
remote host without it attempting to write. The defered cleanup wasn't
closing all the right connections to make this happen.

When a server terminates, re-execed teleport might not notice until
client sends new data. Re-execed teleport should exit on first observed
error in either direction and not wait for both ends.

Fixes #3749
2020-06-11 17:37:07 +00:00
Andrew Lytvynov 3ba6502a05 tsh: add --no-enable-escape-sequences flag
In case our escape sequence support is buggy, let users opt out of it to
mitigate. By default escape sequences are enabled.
2020-06-02 00:29:36 +00:00
Andrew Lytvynov 84af6958fc Extract identity file formatting/parsing into a package
Identity file formatting (former `client.MakeIdentityFile`) will soon
support writing a `kubeconfig` file.

`lib/kube/kubeconfig` depends on `lib/client`, if calls to
`kubeconfig.Update` were added to `client.MakeIdentityFile`, we'd have
an import cycle:
tool/tctl -> lib/client -> lib/kube/kubeconfig -> lib/client

To break the cycle, I extract the identity file formatting (and parsing)
code into a standalone package. It's logically isolated functionality
anyway.

Now the imports will be:
tool/tctl┬─> lib/client
         ├─> lib/kube/kubeconfig ─> lib/client
         ╰─> lib/client/identity ┬─> lib/client
                                 ╰─> lib/kube/kubeconfig -> lib/client
2020-04-21 23:12:38 +00:00
Andrew Lytvynov 97908e2885 Report actual files written by client.MakeIdentityFile
The path passed in is used as a base, different output formats generate
different file sets based on it. To make things less confusing, return
the list of filepaths written and report it to the user.
2020-04-21 23:12:38 +00:00
Russell Jones 6f96595e99 Send UUIDv1 session IDs to legacy servers.
Before establishing a session, request the server version. If the server
replies false, that means it does not support that request type and is
an older server version which needs UUIDv1 format session IDs.
2019-09-11 13:50:00 -07:00
Sasha Klizhentas a1116b7783 Set some defaults from identity file.
This commit reduces the amount of typing some users have
to do when using identity file:

* Teleport user is set from the certificate
* Auth preference is set to local

In addition it fixes several UX problems:

* Commands `tctl auth sign` and `tsh login -o`  now include
trusted CA keys in the identity file.

* Command `tsh ssh -i` is now noninteractive and only
uses identity file for authentication, in case
if identity file can not authenticate, no other interactive
or non-interactive authentication methods will be used.
Before this commit, tsh tried to fallback to interactive
login mode or read the keys from agent socket.
2018-09-13 16:47:14 -07:00
Russell Jones 97074076cb Split public_addr into web_proxy_addr and ssh_proxy_addr. 2018-08-31 16:33:54 -07:00
Russell Jones a56b0870a7 Added the ability to generate host certificates to tctl. 2017-12-09 19:37:49 +00:00
Ev Kontsevoy 6150216653 Changes to how TSH deals with identity files
- Renamed "dir" format to "openssh"
- Replaced self-made key fingerprinting function with a standard one
- Changed fingerprinting from legacy md5 to sha256
2017-08-18 17:31:32 -07:00
Ev Kontsevoy 3b9b78ff19 Polish CLI client integration into web terminal 2017-02-03 17:35:52 -08:00
Ev Kontsevoy a8889271c6 Finished polish of tsh login
This commit:

* Improves on the previous commit on better name resolution by the proxy
  (and fixes a bug introduced by the previous commit)

* Removes 'host_login' from tsh client profile. Closes #729
2017-01-29 17:52:42 -08:00
Ev Kontsevoy 06ff8f81aa Bugfixes in the new tsh code 2016-02-28 14:22:52 -08:00
Alex Lyulkov bd61f6793f Changed limiter initialization 2016-02-26 16:59:35 +03:00
Alex Lyulkov 45654a0ddb rebased 2016-02-25 22:46:30 +03:00
Alex Lyulkov 07c0ca47f9 Fixed tsh tests, changed tests ports 2016-02-25 20:30:44 +03:00
klizhentas 71a5dbc2c4 refactor 2016-02-24 17:58:22 -08:00
Alex Lyulkov eec2217e56 Fixed client test, fixed srv test, minor changes 2016-02-22 22:38:37 +03:00
Alex Lyulkov a66bcb3580 Fixed tests 2016-02-22 18:05:06 +03:00
Alex Lyulkov 2ebb3d07a2 Added tests for hangouts 2016-02-20 01:54:42 +03:00
klizhentas 278420174f refactor roles and certificates handling 2016-02-18 18:07:43 -08:00
Alexander Klizhentas c151d064be Merge pull request #144 from gravitational/alex/share-rebased2
Added Hangouts
2016-02-18 13:38:20 -08:00
klizhentas 7012d465bc list active nodes, fixes #129 2016-02-18 12:22:44 -08:00
Alex Lyulkov 5741526bf4 Merged from alex/share-rebased 2016-02-18 22:10:34 +03:00
klizhentas 9fcc861e09 Replace dependencies with code.google.com paths, remove unused code
* Remove usage of lemma/secret and gravitational/session
* Replace deps using code.google.com with alternatives
* Vendor test keys to the code base
2016-02-17 18:36:52 -08:00
klizhentas 6cdaba2ef6 user mappings should be deleted if user is deleted, fixes #116
This commit includes refactoring and cleanup of cert authority sybsystem:

* User keys methods are deleted
* Authorities CRUD is simplified
* Lots of code removed
2016-02-17 15:29:01 -08:00
Alex Lyulkov d0fd7b26d3 Hangouts: everything works 2016-02-16 20:06:25 +03:00
Alex Lyulkov f35f74cb46 working on tsh share 2016-02-12 18:25:54 +03:00
Alex Lyulkov c2b6d96485 Fixed OS username in tests 2016-02-06 15:15:01 +03:00
Alex Lyulkov d2f50cf4b6 Fixed tests logging 2016-02-05 17:09:21 +03:00
Alex Lyulkov ed3a5088e8 Merged: added user mapping 2016-02-05 03:29:49 +03:00
alexlyulkov 21add23175 Merge pull request #101 from gravitational/alexander/fix-split
fix use case when username contains @ character
2016-02-04 20:43:39 +03:00
alexlyulkov 470b185bd0 Merge pull request #83 from gravitational/alex/fast-login
Added precompiled auth key-pairs to reduce login time
2016-02-04 20:42:55 +03:00
Alex Lyulkov acd9cf4943 Added user mapping, web shell restarts after exit 2016-02-04 20:19:42 +03:00
Ev Kontsevoy 83f2d30d12 Replaced our own logger with logrus 2016-02-02 17:53:21 -08:00
klizhentas 787b40be04 fix use case when username contains @ character 2016-02-02 17:07:09 -08:00
Alex Lyulkov 67bcda7b82 Added init encryption keys for auth backend config, backend configs are JSON now, all complex env configs are JSON now 2016-01-29 19:17:12 +03:00
Alex Lyulkov b38a6236ef Fixed precalculation, fixed the tests affected by additional parallel calculations 2016-01-26 20:29:45 +03:00
Alex Lyulkov ebb25f0f88 Fixed new account creation, added Error page for website 2016-01-22 22:05:46 +03:00
Alex Lyulkov a56b5236ac Moved to go1.5 vendoring 2016-01-20 18:52:25 +03:00
Alex Lyulkov e9a1a04ddf Added parallel scp, moved Download and Upload functions from client app to api 2016-01-19 23:54:46 +03:00
Alex Lyulkov 20e15fe7c6 Client app: added scp command, added multiplexing 2016-01-18 20:09:37 +03:00