Commit Graph
32 Commits
Author SHA1 Message Date
Hugo Shaka ab2f9a5a5e Support tsh login -i (#39024)
* Add tsh flatten command

* apply suggestions

* revert rogue checkout

* address feedback + add tests

* fix tests

* apply sugestions: allow overwriting existing profile + opportunistic proxy reuse from existing profile

* Convert `tsh flatten` into `tsh login -i`

* fix tests + address roman's feedback
2024-03-14 20:03:47 +00:00
Zac Bergquist 80b0912edf tsh: fix panic when loading profile (#38197)
When unmarshaling the profile YAML, it's possible for the unmarshal
to complete without error while not populating the profile struct,
which leads to a panic.

Fix the nil pointer dereference by unmarshaling into a Profile
instead of a *Profile, and further improve the error message
when this happens.

Fixes #38188
2024-02-15 20:53:30 +00:00
Brian Joerger a36d4d1e34 Configure custom PIV slot for hardware key support (#31732)
* Update RFD.

* Add custom PIV slot logic.

* Add custom piv slot to cluster auth preference.

* Fix error handling of parsing private key policy errors.

* Add new PIVSlot string type.
2023-10-11 01:36:22 +00:00
STeve (Xin) Huang 66f5b5510c Fix an issue kube local proxy requirement is wrong in separate port mode (#27634)
* Fix an issue kube local proxy requirement is wrong in separate port mode

* move kube local proxy requirement check to api/profile
2023-06-12 13:49:09 +00:00
Alex McGrath 8da636b44b Dont load ForwardedPorts from profile, only recieve them from the cli (#26823) 2023-06-01 14:13:43 +00:00
Zac Bergquist bfe8d77428 Fix tsh profile dir (#26010)
This fixes a bug introduced in #25950
2023-05-10 18:23:31 +00:00
Zac Bergquist c012ba14c6 User os.UserHomeDir where possible (#25950)
In #24156 we removed a lot of unnecessary calls to user.Current,
which can take a long time in Active Directory environments.

This commit removes a few other uses of user.Current where we were
doing a full user lookup only to find the user's home directory,
which is usually more readily available via the environment.
2023-05-09 20:25:56 +00:00
Andrew LeFevre 94baceef87 only call 'user.Current' when we really need to (#24156)
Calling 'user.Current' can be extremely slow in some instances, so avoid
it when possible.
2023-04-13 21:16:26 +00:00
STeve (Xin) Huang d22f78ceb0 ALPN handshake test improvements (#23348)
* ALPN connect test improvements

* fix typos

* remove extra period

* simplify error check

* fix func name typo

* add a few comments to clarify things

* fix lint
2023-03-29 16:50:39 +00:00
Brian Joerger 731acf9cb7 Hardware Key UX fixes (#20849)
* Save private key policy in profile.

* Fix tsh status/logout with yubikey unplugged; fix cluster alert on tsh status with hardware_key_touch.

* Set private key policy from ping response.

* Skip cluster alerts on tsh status.
2023-01-30 19:17:53 +00:00
Brian Joerger 488af75797 Client store generalization (#19420)
- Add a generalized client store made up of a key, profile, and trusted certs store. Each sub store can support different backends (~/.tsh, identity_file, in-memory). 
- Replace custom identity file handling with in-memory client store.
- Fix issues with trusted certs handling.
2023-01-06 01:34:04 +00:00
Jakub Nyckowski 0ee91f6c37 Enable GCI linter (#17894) 2022-10-28 20:20:28 +00:00
Tobiasz Heller a3a8495cff Store mfa-mode in profile 2022-10-14 09:59:24 +02:00
Andrew Burke db7fdff809 Add option for tsh to load all CAs (#15178)
This change adds an option to let tsh load CAs for all clusters when logging in, instead of just the current cluster.
2022-10-05 18:29:09 +00:00
Alan Parra a75fcc21d8 Update golangci-lint to 1.49.0 (#16507)
Update metalinter, fix a few lint warnings and replace deprecated linters.

`deadcode`, `structcheck` and `varcheck` are abandoned and now replaced by [`unused`][1].

Since 1.19, `go fmt` reformats godocs according to https://go.dev/doc/comment. I've done a bulk-reformatting of the codebase to keep the linter happy. Backporting is mostly harmless (the exception being `lib/services/role_test.go`, that for some reason breaks the _old_ linter using the new format).

[1]: https://golangci-lint.run/usage/linters/

* Bump golangci-lint version
* Replace abandoned linters
* Fix bodyclose on lib/auth/github.com
* Fix bodyclose on lib/kube/proxy/streamproto/proto_test.go
* Fix bodyclose on lib/srv/alpnproxy/proxy_test.go
* Fix bodyclose on lib/web/conn_upgrade_test.go
* Silence staticcheck on lib/kube/proxy/forwarder_test.go
* Silence staticcheck on lib/utils/certs_test.go
* Address BuildNameToCertificate deprecation warnings
* Run `go fmt ./...`
* Run `go fmt ./...` on api/
* Ignore formatting in role_test.go
* Remove redundant initializers in lib/srv/uacc/
* Update e/
2022-09-19 22:38:59 +00:00
Brian Joerger 3a5a285883 Generalize private keys in tsh (PIV integration) (#15334)
Primary Changes:
 - Remove reliance on Private Key PEM:
 - Update native and keygen packages to return PrivateKey instead of PEM key
 - Add new PrivateKey interface which implements crypto.Signer
 - Replace PEM encoded private key usage where possible
 - Replace calls to tls.(Load)X509KeyPair with keys.(Load)X509KeyPair in
client packages

Minor Changes:
 - Remove unused agent.AddedKey return from LoadKey
 - Simplify sshutils and removed unused code paths
 - Add ecdsa and ed25519 key support
2022-08-25 23:26:44 +00:00
Tobiasz Heller cf205b01a5 Store AuthConnector in profile (#15374) 2022-08-16 14:52:31 +02:00
Gus Luxton 51b3bc3dda tsh: Also create a PuTTY PPK-formatted keypair on login (#12733)
PuTTY uses its own keypair format which has the extension .ppk on Windows, hence PPK.
The specification for the file format is here: https://the.earth.li/\~sgtatham/putty/0.76/htmldoc/AppendixC.html\#ppk
2022-07-11 23:31:06 +00:00
Marek Smoliński dc09f6f2c2 Add support for backward compatible API Client behavior (#11567) 2022-04-01 14:38:28 +02:00
Alexey Kontsevoy 4d0c0b2c84 teleterm (alpha) 2022-04-01 13:02:56 +02:00
Zac Bergquist 3f507dfd06 Remove uses of deprecated ioutil package 2022-03-16 15:05:42 -06:00
Trent Clarke 61d2ae52d2 Adds Application certificate path to profile (#10043)
Adds Application certificate path to profile

Prior to this patch, the API Profile type had no way of exposing the
path to an application certificate. While this could be constructed
manually using the `keypaths` package, this was fragile and easy to miss
should the profile layout ever change.

This patch adds `GetAppCertPath()` to the API profile, providing a
centralised and integrated method for finding application
certificates.
2022-02-10 05:27:19 +00:00
Marek Smoliński fbd5a2aafd Fix tsh tctl do not load all CAS (#9357) 2022-01-31 13:35:15 +01:00
Marek Smoliński f906831e58 Add ability to run Mongo proxy on separate listener (#9194) 2021-12-14 14:26:14 +01:00
Marek Smoliński 17a5cadabb Add Proxy listener mode and proxy v2 configuration (#8511) 2021-10-21 14:45:47 +02:00
Marek Smoliński c142b656c8 ALPN SNI Proxy (#7524) 2021-09-13 11:54:49 +02:00
Brian Joerger 9b8b9d6d0c rollback - Upgrade api version. (#7751) 2021-07-30 15:34:19 -07:00
Brian Joerger c040aca4c1 Upgrade api version. (#7609) 2021-07-28 13:51:21 -07:00
Brian Joerger a6ed4d3d22 Update profile credential loader to work with tsh v6.0. (#7142) 2021-06-07 18:01:12 -07:00
Brian Joerger 5fbffaab80 keypaths package (#6848) 2021-05-27 10:31:05 -07:00
Roman Tkachenko d67e11ff2d Adding postgres_public_addr and mysql_public_addr (#6426) 2021-04-21 19:52:52 -07:00
Brian Joerger d830ed6db7 Refactor api package and docs to use pkg.go.dev effectively. (#6388) 2021-04-20 16:44:17 -07:00