Commit graph

8846 commits

Author SHA1 Message Date
Jakub Nyckowski c380f86bd9
Enable BPF tests in CI (#10933) 2022-07-15 00:16:56 +00:00
Nic Klaassen dd12a7f60e
Display helpful error when joining with invalid host ID for EC2 join method (#14404) 2022-07-14 22:34:51 +00:00
Tim Buckley ad12d71e20
Add Kubernetes Access support to Machine ID (#14269)
* Add Kubernetes Access support to Machine ID

This adds support for Kubernetes Access to Machine ID. Users can now
request access to a Kubernetes cluster with the new
`kubernetes_cluster` config field. When a request is configured, a
`kubeconfig.yaml` is generated which can be used to access the given
cluster.

As part of this, we also refactor a few parts of the bot code to help
cache various requests that config templates make frequently by
passing a new trivial `bot.B` interface to the `Render()` function.
For good measure, we also fix the `destination.Destination` stutter
by moving the interface to `bot.Destination`.

* Remove unused CLI param and fix docstring typo

* Cache cert authority requests

We now cache most cert authority requests from config templates and
purge the cache after each cert renewal.

* Move bot.B to config.Bot

* Add a matching marshaller for the KubernetesCluster type.
2022-07-14 22:03:34 +00:00
Matheus b787b9579f
Add UpgradeWindowStartUpdate audit event (#14433)
* Added event UpgradeWindowsUpdate

Co-authored-by: Rafał Cieślak <rafal.cieslak@goteleport.com>
2022-07-14 20:24:10 +00:00
David Boslee 27c04c5f94
Fix TestProxyTunnelStrategyAgentMesh flakiness (#14398)
Fixes an issue where the agentpool backoff channel would be redefined 
each time an event was received while waiting for the backoff to complete.
This could lead to a longer backoff period than expected.

Waits for each resource to connect individually by splitting up the test into
multiple runs ran in parallel
2022-07-14 10:49:11 -06:00
rosstimothy ac69da99fb
Ensure ListResources is accurate with denied resources (#14449)
* Ensure ListResources is accurate with denied resources

Prior to this tsh ls and the web UI were reporting different number
of resources when a user had role/roles that restricted access to
certain resources. This was caused by returning an incorrect
`NextKey` in the `ListResourcesResponse`.

In the event that `IterateResourcePages` was returning early due to
the callback requesting to stop iteration, the `NextKey` being returned
was the last key for the **current page** instead of the key for
the **next resource** in the page. This would cause N resources between
the last resource iterated on and the end of the page to be skipped.

To remedy this `IterateResourcePages` has been refactored to
`IterateResources`. This shifts the responsiblity of building the
`ListResourcesResponse` onto the caller and not the iterator. There
are no more pages to worry about, so the logic about what the next
key should be becomes simpler.

`TestListResources_WithRoles` was added to ensure that a user with
a set of roles that denies access is always returned the correct
resources from `ListResources` from both tsh and the web ui.
2022-07-14 15:58:39 +00:00
Steven Martin fcafa8abcd
Modify title for getting started in infrastructure case (#14466)
Modify title for getting started in infrastructure

title mentioned production deployment which this was more of a getting started.
2022-07-14 11:37:31 -04:00
Nic Klaassen 670210b22c
Properly print error when connection to cluster fails (#14403) 2022-07-14 14:38:25 +00:00
Noah Stride b433cdbace
Bundle tbot into the built docker images (#14308)
Bundle tbot into the built docker images
2022-07-14 12:35:49 +00:00
Edward Dowling 1600c8e52a
Add check that roles in given user exist (#14298) 2022-07-14 12:07:55 +00:00
Noah Stride 02b4f8575f
Configure linter to catch British 🇬🇧 spellings 🇺🇸 🦅 📖 (#14363)
* configure golangci-lint misspell to check for anglicized spellings

* Americanize spellings

* fix aws constant value with british spelling 🇬🇧

* update api types with americanized spellings

* use american spellings .cloudbuild/scripts
2022-07-14 10:51:23 +00:00
Zac Bergquist 90e66fdd00
bot: only dismiss reviewers if we have 2+ internal approvals (#14440)
This prevents an old approval from counting if the reviewer changes
their review state, and also ensures that multiple approvals from
the same author don't count as more than one approval.
2022-07-13 18:37:04 -07:00
Nic Klaassen 2692597b72
Fix Resource Requests for Desktops (#14436) 2022-07-14 00:20:11 +00:00
Gavin Frazar bf324aee5b
Update kubernetes_group to a group that has role binds by default (#14247) 2022-07-13 23:23:27 +00:00
Lisa Kim ee716b16a1
[auto] Update webassets in master (#14410)
cc88604b Add k8s to recordings and active sessions list (gravitational/webapps#972) https://github.com/gravitational/webapps/commit/cc88604b

[source: -w master] [target: -t master]
2022-07-13 21:20:53 +00:00
Nic Klaassen ce29a0c244
Fix Resource Request approvals (#14434) 2022-07-13 20:32:07 +00:00
STeve (Xin) Huang 6981f8e8ac
Add --format flag to "tsh proxy aws" (#13636) 2022-07-13 20:05:37 +00:00
Brian Joerger 991b25c3ea
Add SHA1 PubkeyAcceptedKeyTypes workaround to tsh config (#14215) 2022-07-13 19:41:25 +00:00
Brian Joerger ea87cb5730
X11 forwarding fixes for Mac and Windows (#14066) 2022-07-13 19:13:11 +00:00
fheinecke a82e241b16
Update docs for new APT repos (#12959)
* Updated docs for new APT repos

* Added upgrade notes

* Reworded upgrade details

* Update docs/pages/includes/install-linux.mdx

Co-authored-by: Roman Tkachenko <roman@goteleport.com>

* Added APT "legacy" docs

* Bumped major version

Co-authored-by: Roman Tkachenko <roman@goteleport.com>
2022-07-13 18:28:31 +00:00
Forrest Marshall 6c02a4efd9 improve semaphore retries and tests 2022-07-13 11:19:18 -07:00
Isaiah Becker-Mayer 0f96f38917
Solves a potential panic (#14323)
Splits `close()` into `close()` and `cleanup()`. `cleanup()` is only ever called when both the input and output streaming goroutines have returned, so panics due to using freed memory should no longer be possible
2022-07-13 17:57:06 +00:00
Noah Stride c18d914745
Machine ID CA rotation (#13231)
* start hashing out machine id CA rotation

* filter out incoming ca events by type

* support multiple trusted certificate authorities in known_hosts

* remove redundant trace.Debug from `tbot` `main()`

* filter to only recieve relevant CA events

* add exponential backoff to renewal

* remove unnecessary `.Ping()` check with new client

* add unit test for filtering CA events

* debounce reloads

* add retry limit and backoff for CA watching

* add integration test for CA rotation

* modify CA rotation watcher loop to retry forever

Co-authored-by: Tim Buckley <tim@goteleport.com>
2022-07-13 16:52:44 +00:00
Gavin Frazar 8929f640f9
Update error message returned when user is not allowed to sign db certs (#13902)
* Update error message returned when user is not allowed to sign db certs

* Update lib/auth/auth_with_roles.go

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

* Update docs

* Fix docs

* Update error for snowflake cert signing

* Update docs/pages/database-access/reference/cli.mdx

Co-authored-by: Paul Gottschling <paul.gottschling@goteleport.com>

* Update docs/pages/database-access/reference/cli.mdx

Co-authored-by: Paul Gottschling <paul.gottschling@goteleport.com>

Co-authored-by: Nic Klaassen <nic@goteleport.com>
Co-authored-by: Paul Gottschling <paul.gottschling@goteleport.com>
2022-07-13 16:17:34 +00:00
Ryan Clark 3e3b9b42b5
Change tbot to allow reading the token from a file (#14087)
This changes tbot's configuration to access the token via a
getter/setter instead of a direct property, to allow us to fetch the
token (possibly reading it from a file) when we need it instead of when
the configuration is created.

This also changes the identity fetching logic, to try and read the token
when there is an identity present but not error, allowing for the token
file to have been deleted between restarts. If it can read the token,
it'll check to see if it has changed and refetch the identity if so.
2022-07-13 15:48:08 +00:00
Alex McGrath a41a430070
Sanitize forward slashes when creating sudoers files (#14365) 2022-07-13 13:34:02 +00:00
Joel 63e17f8a0f
Honor --no-enable-escape-sequences in tsh (#13507) 2022-07-13 11:48:21 +00:00
Marco André Dinis af2d9c56ea
WebAPI: return user traits (#14138)
* WebAPI: read user

We currently need to fetch the whole list of users to get User's
information.
Adding more fields increases the probabilty of having performance
issues.

This PR adds a new endpoint which returns a single user.
This endpoint returns the information we already return when listing
users but also returns the user's traits

This is a follow up of
https://github.com/gravitational/teleport/pull/14076

The following traits are returned:
- Logins
- DB Users
- DB Names
- Kube Users
- Kube Groups
- Windows Logins
- AWS Role ARNs
2022-07-13 10:06:34 +00:00
Noah Stride 7c71413c05
Fix TTL file config not working in tbot (#14371) 2022-07-13 09:07:30 +00:00
Aaron Friel fe66bc8637
Fix panic on equality, add symmetric equality tests (#13588) 2022-07-13 00:07:08 +00:00
Steven Martin 209ca9e6af
Update changelog to include latest V10 and V9 (#14380) 2022-07-12 20:53:37 +00:00
Zac Bergquist 0746221926
Deflake TestIgnorePuTTYSimpleChannel (#14373)
Yet another test where we need to disable the filesessions
uploader.

Fixes #14368
2022-07-12 20:14:36 +00:00
Zac Bergquist bb0667e54f
Check for enterprise license when creating role with pin_source_ip (#14351)
Previously we would only make this check when issuing user certs.
By adding a check when roles are created/updated we can fail faster.
2022-07-12 19:09:37 +00:00
Michael f5d9b32857
only build url if path param exists (#14388)
* only build url if path param exists

* updated comment
2022-07-12 13:43:14 -05:00
STeve (Xin) Huang c18c09f5d5
Fix "tsh db ls --cluster cluster" to use the correct cluster name (#14334) 2022-07-12 17:03:18 +00:00
Edoardo Spadolini 992a5d5fd4
Move the stale review dismissal to Check (#14377) 2022-07-12 16:27:41 +00:00
Paul Gottschling 570b0042df
Fix Kubernetes Access nav sidebar section (#14264)
The changes in #13068 moved pages in the Kubernetes Access section that
did not relate to Kubernetes Access into more appropriate sections of
the docs. This meant converting
`/docs/kubernetes-access/getting-started` into a guide, rather than a
section, since only one page within the previous `getting-started`
section had to do with Kubernetes Access.

However, this change left the nav sidebar for the Getting Started
section unchanged. The current change deletes the sidebar entries to
prevent confusion.
2022-07-12 15:18:37 +00:00
Rafał Cieślak 80a4237bda
Connect: Fix premature proxyClient.Close() when getting db users (#14230)
In the previous version, the proxy client would be closed immediately
after addMetadataToRetryableError. This commit makes it so that the proxy
client is closed only after GetAllowedDatabaseUsers finishes.

When running Connect on Windows, Grzegorz ran into a problem where fetching
db users for MSSQL would fail but only on Windows and only for MSSQL:

    Failed to fetch current user information: connection error:
    desc = "transport: Error while dialing failed to dial: read tcp
    10.211.55.4:55519->52.14.45.73:3023: use of closed network
    connection". services\role.go:764

Other times the error would be

    connection error: desc = &#34;transport: Error while dialing failed
    to dial: ssh: unexpected packet in response to channel open:
    &lt;nil&gt;&#34;] apiserver\middleware.go:39

Surprisingly, `tsh db ls` didn't have this problem. So when thinking about
what we're doing differently than tsh and how it might be related to
a closed connection, I noticed that I made a bug in the code that closes
the proxy client.
2022-07-12 15:03:41 +00:00
Zac Bergquist 376939d517
bot: dismiss unnecessary reviewers (#14100)
Re-run the assign workflow whenever a review is submitted.
If the PR meets the required approvals and there are additional
reviewers still assigned, dismiss them.

This makes it easier on reviewers to filter PRs on
"awaiting review from me" as the list will not include PRs that
already have the required reviews.

Fixes #11855
2022-07-12 14:04:17 +00:00
Krzysztof Skrzętnicki 54f4556d0d
Fail app_service start on invalid configuration (#14325)
Call tunnelAddrResolver to check for errors.
2022-07-12 13:31:03 +00:00
Alex McGrath 59063b1078
Replace occurences of . and ~ with _ when creating sudoers files. (#14300) 2022-07-12 09:22:38 +00:00
Lisa Kim 0deb57f343
Include k8s in listing active sessions for web UI (#14329) 2022-07-12 02:39:19 +00:00
Nic Klaassen c29c5db68c
Fix TestMux/Timeout (#14208) 2022-07-12 02:00:56 +00:00
Gavin Frazar d1781d39be
Do not override cfg.CAPins if ApplyCAPins is called with empty caPins… (#14122)
Do not override cfg.CAPins if ApplyCAPins is called with empty caPins slice
2022-07-12 01:19:18 +00: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
rosstimothy ad1d9b1aae
Prevent forwarding traces to servers which don't support tracing (#14281)
* Prevent forwarding traces to servers which don't support tracing

Tracing clients can detect if a server doesn't support tracing by
checking for a trace.NotImplented error in response to an
UploadTraces request. Since the grpc.Conn used by the client is
likely to be bound to that server for the duration of its life
it doesn't make sense to keep trying to forward traces. Instead
the client now remembers that a server doesn't support tracing
and will drop any spans.

Part of #12241
2022-07-11 21:09:32 +00:00
Zac Bergquist 8ab8598af0
Clarify session joining prerequisites (#14149)
Fixes #1968
2022-07-11 20:11:05 +00:00
Ulysses 9333a4eab9
Fix username in example (#14276)
If we are following the example, we should be grepping for the user created directly above this command to see if it was deleted.

Co-authored-by: Gavin Frazar <gavinfrazar@gmail.com>
2022-07-11 12:37:54 -07:00
Noah Stride e8cfcc78fa
Improve tsh login handshake error messaging (#13836)
* improve principal mismatch error on unmultiplexed tsh login when `public_addr` empty

* Address Pr feedback
2022-07-11 18:17:31 +00:00
Jeff Pihach a4059c2c1b
Do not add configure flags if no values are provided (#14191)
Do not add configure flags if no values are provided (#14156)
2022-07-11 17:44:45 +00:00