Commit Graph
1131 Commits
Author SHA1 Message Date
Lisa Kim 8bb0636863 Partial delete deprecated code for "DELETE IN 11.0.0" and lower (#16947)
* Deleted 
   - GetAppServers
   - GetApplicationServers 
   - GetDatabaseServers 
   - GetKubeService 
   - UpsertAppServer
   - DeleteAppServer
   - DeleteAllAppServers
   - RotateUserTokenSecrets
* Delete list nodes fallback
* Use AppServer type for heartbeat test
2022-10-04 17:58:30 +00:00
Mike Wilson a4af8ae256 Revert "Ensure audit logging of tsh app login."
This reverts commit 31859e5d30.
2022-10-04 11:14:12 -04:00
Michael WilsonandRoman Tkachenko f9fb39206e Update tool/tsh/app.go
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
2022-10-04 10:53:20 -04:00
Mike Wilson 6b269b630e Fix unit test. 2022-10-04 10:53:20 -04:00
Michael WilsonandZac Bergquist 3dbe762526 Update tool/tsh/app.go
Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>
2022-10-04 10:53:20 -04:00
Mike Wilson 3321c45bf2 Remove cacert flag from curl output during tsh app login.
The cacert flag was removed from the curl output during the tsh app login as
most production Teleport clusters are likely to be using publicly trusted CAs,
and therefore wouldn't need the flag. If the user specifies an insecure login,
however, the cacert flag is included with the curl output as it used to be.

Additionally, some tests have been added for the formatAppConfig function. It
was discovered that the YAML output format was outputting two newlines, so a
small modification was made to remove this.

Addresses issue #7518.
2022-10-04 10:53:20 -04:00
Lisa Kim bc81db4655 Use field hostname for node resource for predicate expr using "name" identifier (#16902)
* Predicate expressions using the "name" identifier will now use
  field "hostname" when `ls` querying for nodes, as expected by
  the user
* Change predicate expression for access request that use
  name identifier to using the actual json field names
2022-10-04 00:20:04 +00:00
Christopher CooperandNic Klaassen b3800ca500 Ccooper/add proxy ls auth ls 12965 (#14701)
* check if proxy requested already has an active profile that is not expired before relogging the user in

maintain cert reissue

use site name

make client for currently logged in proxy

simplify if

remove cert reissue

simplify and add test

revert comment

explicitly save profile

add initial commands

add better output

* review comments

* Update tool/tctl/common/proxy_command.go

Co-authored-by: Nic Klaassen <nic@goteleport.com>

* Update tool/tctl/common/proxy_command.go

Co-authored-by: Nic Klaassen <nic@goteleport.com>

* remove stdout redirect for now

* lint

Co-authored-by: Nic Klaassen <nic@goteleport.com>
2022-10-03 19:01:37 -04:00
STeve (Xin) Huang d319ee2734 Azure Cache for Redis auto discovery (#16755) 2022-10-03 20:54:44 +00:00
Marek Smoliński 6a89687e7d Fix background database local proxy termination by SIGINT signal (#16875) 2022-10-03 09:52:33 +02:00
Brian Joerger ce20b20753 PIV login enforcement (#15874)
Add private key policy enforcement.

  - Add private key policy cert extensions and enforcement.

  - Add private key policy settings and attestation logic.

  - Wire attestation request through login endpoints.

  - Store attestation data for reissue requests.

  - Add private key policy discovery and logic.

  - Relogin on hardware key policy errors.

  - Include integration with Teleport Connect.
2022-09-30 23:27:48 +00:00
Zac Bergquist 09de0ba530 Revert "Remove [direct] dependency on go.uber.org/atomic (#16884)" (#16918)
This reverts commit 4f3aa9a3f2.

We're unable to build for 32-bit Linux due to
https://github.com/golang/go/issues/55152,
which looks like it will be fixed with Go 1.19.2 next week.

We'll re-evaluate with the next Go release and reintroduce this change
as soon as we can.
2022-09-30 22:41:45 +00:00
Yassine Bounekhla 09633dd47f Remove license feature flags for Moderated Sessions, Resource Access Requests, Machine ID (#16585) 2022-09-30 21:46:25 +00:00
Zac Bergquist 4f3aa9a3f2 Remove [direct] dependency on go.uber.org/atomic (#16884)
Go 1.19's sync/atomic package provides the same functionality
2022-09-30 20:39:05 +00:00
Mike Wilson 31859e5d30 Ensure audit logging of tsh app login.
Application sessions were previously only logged when launching an application
session via the UI, and not from the `tsh app login` command. This has been
corrected. The AppName and AppURI are now passed in as part of the gRPC
request to the auth server, which is then used to emit the audit event.
2022-09-30 12:53:13 -04:00
rosstimothy 86bc823231 Fix label based tsh when per session mfa is enabled via role (#16819)
Label based tsh was sending UUID:0 as the node name to the
IsMFARequired check. The server was checking this name against each
nodes name and uuid. However the port included in the name prevented
any matches from being found. Which resulted in the ssh session being
rejected with an access denied message by the node because mfa was
required but never performed.

This removes the :0 from the node name to the IsMFARequired check and
adds a test case to TestSSHOnMultipleNodes that uses role based
per session mfa.
2022-09-30 15:31:13 +00:00
Krzysztof Skrzętnicki af7cd0239d Elasticsearch: alternative clients (#16670) 2022-09-29 17:53:49 +00:00
Alex Fornuto 2754a513b8 typo correction (#16437) 2022-09-29 14:51:24 +00:00
Krzysztof Skrzętnicki b7ceede97c Implement tctl auth sign --format=elasticsearch (#16795) 2022-09-29 14:24:12 +00:00
Andrew LeFevre 77f8a4ef10 Switch underlying protocol used for 'tsh scp' to SFTP (#16601)
* switch underlying protocol used for 'tsh scp' to SFTP

* address TODO

* appease linter

* add method to make it easier for other callers to transfer files

* add tests

* print transfer progress with progress bar by default

Also allow a SIGINT to gracefully stop the SFTP connection. This is
necessary  because the progress bar will ignore signals and prevent the
process from exiting.

* address SFTP fork issues

* make tests less flakey

* fix specifying dir for dst not copying files to correct paths

* make tests less flakey (again)

* don't check file access times, often differs when run in CI

* few small fixes from review, simplify Create method now that HTTP FS isn't needed

* create dst files and dirs with src mode

* improved error messages when doing file operations

* expand home dirs in remote paths

* addressed more feedback

* add license to get_home_dir.go

* address minor feedback of tests, add home dir expansion test

* update sftp fork to point to latest commit on master branch

* addressed feedback

* don't cache home dir lookups, only one remote path can ever be used
2022-09-28 16:37:18 +00:00
Ryan Clark 806a568ada Introduce config v3, add auth_server and proxy_server, remove auth_addresses (#15761) 2022-09-28 15:30:15 +00:00
rosstimothy 649958b6e3 Reduce number of auth dials for tsh commands (#16367)
* Reduce number of auth dials for tsh commands

One of the major areas of latency for `tsh ssh` is creating multiple
auth clients. Since the auth client is lazy and only actually performs
the dial on first use we can create an auth client once and simply
reuse it. This is done by adding an `auth.ClientI` to `ProxyClient`
which is created via `connectToProxy`. All attempts to connect to
the current auth server via the `ProxyClient` will be given the
cached `auth.ClientI`.

The new method of retrieving the current auth client also allowed
to remove a number of calls to `GetSites` which were used to obtain
the current cluster name. The local profile already contains the name
of the cluster and calls to `GetSites` were unnecessary. All instances
which relied on the site name now retrieve from information that the
`ProxyClient` already has.

In an effort to reduce ambiguity and confusion `CurrentClusterAccessPoint`
and `ClusterAccessPoint` were also removed. AccessPoint denotes that
you are connecting to a cache, but the `ProxyClient` is always going
to be hitting the auth server directly. The two have been replaced
with `CurrentCluster` and `ConnectToCluster`, which they were merely
wrappers for anyhow.
2022-09-27 15:37:51 +00:00
Krzysztof Skrzętnicki ebb4155ec9 Hide --db-user/--db-name flags if they are not needed. (#16709) 2022-09-27 07:43:24 +00:00
Grzegorz Zdunek 6426500069 Change kube logged in message (#16368) 2022-09-26 15:31:22 +00:00
Brian Joerger 4c0a6ff5b1 tsh PIV login integration (#15335)
* Add Yubikey PrivateKey implementation for use by Teleport clients.

  - Add yubikey login logic, reusing previously stored private keys.

  - Fix identity file decoding with PIV keys, which sign ecdsa certificates.

  - Add libpcsclite-dev pre-req for building on linux.

  - Remove unnecessary keys.Signer interface and move its functionality to keys.PrivateKey.

  - Move retry and jitter utils to new api/utils/retryutils package.
2022-09-23 19:44:10 +00:00
Krzysztof Skrzętnicki 684956a06c Elasticsearch audit log support (#16191) 2022-09-23 11:46:15 +00:00
Jakub Nyckowski d6485de3de Add HostKeyAlgorithms to ssh_config (#16618) 2022-09-23 05:30:28 +00:00
Gavin Frazar 7e9e077485 Use teleport client sitename for sql server local proxy tunnel db cert lookup instead of active profile (#16613) 2022-09-21 22:59:45 +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
Gavin FrazarandSTeve Huang cac726f75a fix tctl insecure flag with remote proxy (#16125)
* Propagate tctl --insecure flag

* Move ExitCodeError into common package

* Add TryRun helper func to tctl for testing

* Return error instead of exiting directly

* Add test for tctl insecure with profile

* Remove debug println

* Update want err message

* Remove unnecessary errors.Is implementation for ExitCodeError

* Update error message for cert error in test

* Fix flaky TestHandlerConnectionUpgrade

* Test that TryRun error is assignable to ExitCodeError

* gofmt

* Fix import order

Co-authored-by: STeve Huang <xin.huang@goteleport.com>
2022-09-18 23:02:37 +00:00
STeve (Xin) Huang d58740e513 Fix issue "tsh db env" returns error when TLS routing enabled (#16252) 2022-09-16 13:03:44 +00:00
29e46a2a6a buddy: Fix incorrect use of loop variables (#16306)
* Fix incorrect use of loop variables

This commit fixes a few occurrences of loop variables being
incorrectly used in the context of Go-routines or (most frequently)
parallel tests. To fix the issues, we create a local copy of the range
variables before the parallel tests (or Go-routine), as suggested in
the documentation of the `testing` package:

https://pkg.go.dev/testing#hdr-Subtests_and_Sub_benchmarks

Issues were found using the `loopvarcapture` linter.

Signed-off-by: Roman Tkachenko <roman@goteleport.com>

* fix TestTraceProvider/spans_exported_with_gRPC+TLS

* run TestSSH serially

* operator: Conserve 'created_by' data in user spec

Signed-off-by: Roman Tkachenko <roman@goteleport.com>
Co-authored-by: Renato Costa <renato@cockroachlabs.com>
Co-authored-by: Tim Ross <tim.ross@goteleport.com>
Co-authored-by: Hugo Hervieux <hugo.hervieux@goteleport.com>
2022-09-14 14:31:56 +00:00
rosstimothy 43f14f1205 Dial by UUID for label based ssh (#16257)
Switches label based ssh to always use the node UUID instead of its
address. This prevents issues that occurred when dialing by address
if the public_addr isn't set correctly.

Closes #3214
2022-09-12 13:31:11 +00:00
Zac Bergquist 4f0c03b204 Unhide tctl alert create (#16271)
Also add optional --ttl and --severity flags.
This allows cluster administrators to set custom alerts
(during maintenance periods, for example).

Fixes #6442
2022-09-09 19:07:42 +00:00
Forrest Marshall 50762d7593 rework cmd registration 2022-09-09 11:13:41 -07:00
4fc0291365 fix tctl auth server flag (#16130)
* Fix flaky TestHandlerConnectionUpgrade

* Fix tctl --auth-server with logged in profile

* Export tctl applyConfig so we can test it from tsh/tctl tests

* Add test for tctl --auth-server w/ profile

* Update tool/tctl/common/tctl.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Update tool/tsh/tctl_test.go

Co-authored-by: Alan Parra <alan.parra@goteleport.com>

* Alan's suggestion to not use new()

* Add message to require.NotEmpty

Co-authored-by: STeve Huang <xin.huang@goteleport.com>
Co-authored-by: Alan Parra <alan.parra@goteleport.com>
2022-09-08 18:38:20 +00:00
Gavin FrazarandSTeve Huang 4a3f241e2a fixup untrusted cert errors (#16127)
* Add util helpers for untrusted cert errors

* Remove superfluous error checking

* Add helpful message on first time node join

* Cleanup cert error messages when connecting to auth service

* Add helpful certs message for tctl

* Fix flaky TestHandlerConnectionUpgrade

* Change long line back to the way it was before

Co-authored-by: STeve Huang <xin.huang@goteleport.com>
2022-09-07 22:49:20 +00:00
Garrett Watson 68524143ed Remove the "." from the end of the auth token generated by "tctl tokens add" command (#16157) 2022-09-07 10:00:48 +00:00
Tobiasz Heller 9394cc263e Fix running ssh command on multiple nodes with mfa per session (#15641) 2022-09-06 12:40:18 +00:00
44b89c75c0 Elasticsearch support (#15768)
Co-authored-by: Anton Miniailo <anton@goteleport.com>
Co-authored-by: Marek Smoliński <marek@goteleport.com>
2022-09-05 18:58:21 +02:00
STeve (Xin) Huang 29f602a181 Forward flags to "tsh ssh" and "tsh aws" (#16058) 2022-09-02 14:20:06 +00:00
Noah Stride 5be324c89d Make tctl bots add display the proxy address (#16045)
* Make `tctl bots add` return the proxy address rather than the auth server address

* Remove CA pins from `tctl bots add`
2022-09-02 10:12:55 +00:00
Krzysztof Skrzętnicki 374acff806 Add support for --browser none to tctl sso test. (#15959) 2022-09-02 09:48:02 +02:00
STeve (Xin) Huang 8394f4fb48 ALPN connection upgrade for MySQL behind ALB (#15669) 2022-09-01 16:05:03 +00:00
Forrest Marshall 7c9f26457a upgrade notifications 2022-08-31 12:09:30 -07:00
STeve (Xin) Huang 8debabb2b2 Fix "tsh aws" cannot load private key (#15964) 2022-08-31 12:45:19 +00:00
Alex McGrath 6bf2f18435 Allow for multiple installer scripts instead of a singleton (#15682)
* Allow for multiple installer scripts instead of using a singleton

* Resolve comments

- require name be provided to installer
- MetaNameClusterInstallerScript -> defaults.InstallerScriptName
- Require VerbList for GetInstallers

* Resolve comments

- Include the default installer in GetInstallers output
- Update how the scripts are prefixed

* resolve conflicts

* make the linters happy
2022-08-30 17:23:57 +00:00
Gabriel Corado a3a65e863b TLS routing ping for database protocols (#14887) 2022-08-26 16:42:23 +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
Gavin Frazar 66c010dce1 Add Azure resource ID to protos (#15673)
* Add Azure auto-discovery configuration fields

* Init databases if azure matchers are in config

* Use AzureMatchers in db service

* Use all azure subscriptions/resource groups if omitted in matcher

* Add azure config tests

* Update protobuf and fix database serialization

* Update azure database spec/status

* Change proto to use resource id string

* Fix database serialization test
2022-08-25 22:51:25 +00:00