Commit Graph
7253 Commits
Author SHA1 Message Date
Yassine Bounekhla f2c8833cea implement listing notifications for a user with matching (#39942) 2024-05-15 19:26:58 +00:00
Michael 265b58cb7e Apply new logos based on license (#41294) 2024-05-15 19:09:33 +00:00
Nic Klaassen b466c8d365 refactor common proto resource (un)marshallers into generic functions (#41562)
* refactor common proto resource (un)marshallers into generic functions

* use protocmp.Transform
2024-05-15 18:18:03 +00:00
rosstimothy 2df9aeafd0 Convert App heartbeats to use the inventory control stream (#41164)
Updates app server heartbeats to use srv.Heartbeatv2 in order to
leverage the inventory control stream instead of the legacy mechanism.
The new srv.heartbeatV2Driver implementation for app servers detects
the version of Auth and falls back appropriately if the Auth server
is too old to know about the new field added to the InventoryHeartbeat
message. The connected_resources metric should be accurate if the
auth and app service are on the same version or if the auth service
is on a more recent version. If the app service is newer than auth
and the new app server driver kicks into fall back mode then the
connected resource metric will not be updated.

Partially addresses #40917
2024-05-15 17:59:30 +00:00
Gavin Frazar 76ef907743 update tests for auto user deactivation (#41497)
* expect deactivation audit event
2024-05-15 17:44:47 +00:00
bd4dcab802 Machine ID: Switch to using new tbot ssh-proxy-command by default. (#41482)
* Add warning to previous command

* Hash out basics of new tbot proxying command use

* Avoid passing full botConfig into `tbot ssh-proxy-command`

* wip

* simplify impl

* Set up test suite for ssh config generation

* Add support for checking if ALPNConnUpgrade is required

* Cache the alpn upgrade result

* Americanize Spellings

* Update lib/tbot/config/template_ssh_client.go

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>

* Add CHANGELOG.md entry for breaking change

* Update tool/tbot/proxy.go

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>

* Update lib/tbot/tbot.go

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>

* Switch to `--no` variants rather than `={bool}`

* Use SingleFlight on alpn proxy upgrade cache

* Improve singleflight

* Add rudimentary shell quoting

* Uniformly pad the templating

* Rename shellQuote -> proxyCommandQuote

* Fix imports

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>
2024-05-15 17:30:54 +00:00
Andrew LeFevre 120efb9bd7 ensure kube watcher writes and flushes are sequential (#41584)
* ensure kube watcher writes and flushes are sequential

* rename to flushLocked
2024-05-15 17:03:49 +00:00
Nic Klaassen 30072c0ea7 fix flaky TestCredentialsCache (#41597) 2024-05-15 16:53:58 +00:00
Edoardo Spadolini bb2b5150a0 Keep SIGHUP handled while we have a pidfile written (#41567)
* Keep SIGHUP handled while there's a pidfile on disk

* Make checkServerIdentity more verbose

* Use a buffered channel that was filled

* Clarify that it's fine if the channel is full

* Use signal.Notify outside of WaitAndReload
2024-05-15 15:11:46 +00:00
Marco Dinis 5b411d73a5 Join Script: add apt repo for Ubuntu 24.04 (#40960) 2024-05-15 15:03:27 +00:00
rosstimothy e95f3d3ed5 Start using authclient.Client/ClientI/NewClient (#41539)
Consumes the new auth client created in #41460. The changes introduced
were performed with a series of gofmt rewrite rules.

```bash
$ find ./lib/auth -type f -name '*.go' -exec gofmt -w -l -r "ClientI -> authclient.ClientI" {} \;
$ find ./lib/auth -type f -name '*.go' -exec gofmt -w -l -r "Client -> authclient.Client" {} \;
$ find ./lib/auth -type f -name '*.go' -exec gofmt -w -l -r "NewClient -> authclient.NewClientI" {} \;
$ find . -type f -name '*.go' -exec gofmt -w -l -r "auth.ClientI -> authclient.ClientI" {} \;
$ find . -type f -name '*.go' -exec gofmt -w -l -r "auth.Client -> authclient.Client" {} \;
$ find . -type f -name '*.go' -exec gofmt -w -l -r "auth.NewClient -> authclient.NewClient" {} \;
```
2024-05-15 14:09:14 +00:00
Edoardo Spadolini 9fb54266e0 Use Restart=always for the Teleport systemd service (#41564) 2024-05-15 12:40:12 +00:00
Tiago Silva b242d26355 services: Fix inconsistency in ListPlugins with pageSize=0 (#41550)
`ListPlugins` endpoint doesn't enforce `size>0` nor it assumes the
default page size when `pageSize = 0` is passed.
This results in the agent being in a deadloop because it cannot iterate
through results.

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
2024-05-15 08:40:33 +00:00
Marco Dinis c90bf7e9a4 AWS OIDC App Access: add PublicAddr to App (#41543)
* AWS OIDC App Access: add PublicAddr to App

This PR adds a missing field to the App created to handle the AWS App
Access when using the AWS OIDC credentials
The PublicAddr is required and was not being set.

* fix identation
2024-05-15 07:11:50 +00:00
Brian Joergerandrosstimothy 9ecd2943a7 MFA for SAML IdP: Add mfa check to CheckAccessToSAMLIdP (#41441)
* Add per-session MFA check to CheckAccessToSAMLIdP helper method.

* Update test.

* Add additional method needed to authorize requests in the Proxy service.

* Address comment.

* Apply suggestions from code review

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
2024-05-14 20:12:20 +00:00
Michael 6b0797adba Update shared access requests components for e changes (#41333) 2024-05-14 17:55:57 +00:00
Justinas StankevičiusandJakub Nyckowski 6fbfadc230 Access Graph: sync AWS identity providers (#41368)
* Add AWSSAMLProviderV1 to access graph proto

* Access Graph: sync AWS SAML Providers

* Parse SAML entity descriptor before sending to TAG

* Add protos for AWS OIDC providers

* Fetch AWS OIDC providers

* Fetch signing certificates for AWS SAML providers

* Deflake identity provider fetch test

The concrete implementation of IAM mock uses a map,
resulting in non-deterministic iteration order.
Sort the results before comparing to alleviate.

* Update lib/srv/discovery/fetchers/aws-sync/iam_test.go

Co-authored-by: Jakub Nyckowski <jakub.nyckowski@goteleport.com>

---------

Co-authored-by: Jakub Nyckowski <jakub.nyckowski@goteleport.com>
2024-05-14 16:20:36 +00:00
Zac Bergquist 10fca830d3 Deflake TestSeekForward (#41446)
Closes #40842
2024-05-14 15:46:57 +00:00
Gabriel Corado 0e54ee8567 Fix SSH sessions recorded on proxy not being fully closed (#41434)
* fix(srv): SSH remote sessions resources not being closed correctly

* refactor(srv): code review suggestions

* test(srv): move t.Helper to the correct function

* chore(srv): typo

* chore(srv): typo
2024-05-14 14:47:14 +00:00
Zac Bergquist e101021c7f Clean up logging for cert generation (#41473)
On a busy cluster, Teleport can issue hundreds or even thousands
of TLS certificates in a short period of time. This can clutter
the logs and make troubleshooting difficult.

- Decrease the severity from INFO to DEBUG
- Log only the common name, not the full subject
2024-05-14 13:43:21 +00:00
rosstimothy 67f499a457 Refactor auth client code into lib/auth/authclient (#41460)
This starts separating the lib/auth client and server code into
distinct packages to reduce the dependency tree of client tools.
For the time being aliases were left to all things moved into
lib/auth/authclient to reduce the changeset and ensure code still
compiles. Future changes will be built off this to convert code
to use lib/auth/authclient where applicable, this was intentionally
left to a minimum amount of changes to facilitate backports.
2024-05-14 13:28:06 +00:00
rosstimothy 24d06502ff Prevent web ui SSH connections from leaking (#41501)
The session closing in TerminalHandler.Close did not always close
established ssh sessions if the client closed the web socket
at any point between the new browser tab being opened and the session
being established. In these cases the SSH connection was leaked for
the duration of the Proxy process. To ensure sessions are always
terminated a check to see if the client closed the web socket was
added prior to writing the session metadata and after the shell
is established for the ssh session.
2024-05-14 11:26:21 +00:00
Trent Clarke fbd0091b9b SCIM only okta (#41125)
* Changes required for implementing a standalone (i.e. without Okta Sync compatibility) SCIM service in teleport.e.

Includes:

 * `tctl plugins delete` and `tctl plugins create scim` tooling
 * Moving some constants from teleport.e to OSS
 * Protobuf message types for standalone SCIM settings
 * UI updates for rendering SCIM users

Changelog: Added plugin management tooling to tctl

* Adds validation to SCIM settigs

* Linter fixup

* linter appeasement
2024-05-14 08:36:11 +00:00
rosstimothy d573e460f7 Cleanup code relegated for deletion in v16 (#41462)
Deletes the client fallback logic for users and auth connectors.
The server side cleanup was punted to v17 to prevent any v14 clients
from being unable to interact with a v16 control plane when trying
to interact with users and auth connectors.
2024-05-13 16:02:28 +00:00
Edoardo Spadolini 33e80cd8f2 Support dynamic SSH host signers (#41227)
* Add a host signers callback to sshutils.Server

* Lift host signers callback into regular.Server

* Lift host signers callback into reversetunnel.Server
2024-05-13 13:11:44 +00:00
rosstimothy ffa3dba509 Reject unsupported clients by default (#41239)
#38026 made rejecting client running unusupported major versions an
opt-in behavior. Moving forward(v16 and beyond) this is now going
to be an opt-out behavior(TELEPORT_UNSTABLE_ALLOW_OLD_CLIENTS=yes).
In addition, a cluster alert is now being emitted once for the life
of an Auth process if it rejects an unsupported client - with
visibility limited to users with token:create permissions.
2024-05-13 13:09:14 +00:00
Noah Stride 87bf2d4131 Machine ID: Basic Unix Workload Attestation (#41254)
* Log UDS sourced peer info

* Add logging of peer address when non-unix

* Properly group logging attributes when svid is issued

* Add config structs for unix workload attestation and tests

* Add test for entire bot config

* Return `PermissionDenied` when no SVIDs available as per SPIFFE Workload API 5.2.1

* Filter down SVIDs based on workload attestation

* Add improved logging

* Add basic unit test

* Add e2e test that uses workload attestation

* Document workload attestation features
2024-05-13 09:10:08 +00:00
Alan Parra 41b60a0848 fix: Emit login failure event in the /mfa/login/begin step (#41419)
* Test failed user/pass audit on CreateAuthenticateChallenge

* Emit login failure event in the /mfa/login/begin step

* nit: Remove final stop from logging statements

* nit: Remove seemingly outdated comment
2024-05-10 21:39:01 +00:00
rosstimothyandEdoardo Spadolini 7a7f982ed9 Add tbot ssh-proxy-command (#41346)
The new subcommand is meant to be a replacement for tbot proxy ssh
which does the ssh proxying entirely within tbot to reduce resource
consumption. The old mechanism spawned a tsh process to perform the
proxying which leads to increased CPU and memory consumption - which
can be quite problematic when used as an OpenSSH ProxyCommand for
an ansible playbook.

The new command also deviates in behavior from tsh proxy ssh in that,
for the moment, it requires users to explicitly dictate whether
tls routing, alpn connection upgrades instead of guessing by making a
call to webapi/ping. This again turns out to be quite resource
intensive when tbot is used as an OpenSSH ProxyCommand for an ansible
playbook.

In the future tbot can look this information up out of band and store
it in the proper location so that tbot ssh-proxy-command can consume
it directly without users needing to provide it. The behavior as is
provides a path toward the future while also allowing users to gain
the performance improvements now.

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>
2024-05-10 21:05:47 +00:00
Lisa Kim 2fbbe6caac Web: Remove legacy app access support (#41243) 2024-05-10 19:41:15 +00:00
39478f3570 Add backend handler for Web UI kube exec functionality. (#41144)
* Add backend handler for Web UI kube exec functionality.

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>

* Log error on sending it to websockete connection.

* Remove duplicate user key creation.

* Use scoped context.

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>

* Use local site cache.

* Simplify creating rest kube rest config.

Co-authored-by: Tiago Silva <tiago.silva@goteleport.com>

* Don't set stdErr on pod execution options, if it's interactive shell.

* Don't use public proxy addr when getting kubeconfig server address/name.

* Don't set stdErr on stream options if it's interactive shell.

* Provide local host CA to podHandler directly, instead of access point.

* Add integration test for kube exec handler.

* Use read deadline instead of closing reader.

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
Co-authored-by: Tiago Silva <tiago.silva@goteleport.com>
2024-05-10 19:10:57 +00:00
Marco Dinis 0005f0b016 Fix ResourceCreationEvent for EC2 Auto Discovery (#41405)
This PR ensures the proper ResourceType is set when emitting
ResourceCreateEvent.

We now support running the Script/SSM mode using integration
credentials, so having an integration is not equivalent to using the
EICE mode.
2024-05-10 15:58:18 +00:00
Alex McGrath 65459e872e Remove support for disabling second factor authentication (#40956)
* dont allow disabling second factor

* update docs for 2fa change

* add environmental variable to work around disabled 2fa

* check if its cloud

* update todos

* add a test

* introduce insecure test mode

* fixes for tests
2024-05-10 11:57:34 +00:00
Anton Miniailo 055766a9c0 Fix logging an error from EKS cluster enrollment. (#41395) 2024-05-09 23:29:34 +00:00
Gavin Frazar 9723fd096f cleanup after db ca split (#41351)
* remove database client CA event filter injection

* remove tctl database client CA fetch fallback

* remove sqlserver database client CA fetch fallback

* remove database client CA migration

* cleanup tests and mocks
2024-05-09 19:51:27 +00:00
Jakub Nyckowski ae9eae3df6 Remove usage of tiktoken (#41374)
* Remove usage of tiktoken

The token counting mechanism in tokencount.go has been simplified by removing the usage of the tokenizer and instead estimating token count based on character length.

* Update tests
2024-05-09 19:24:02 +00:00
Zac Bergquist 19a89bc6cd Remove role downgrade logic for insecure drop mode (#41371)
This logic was necessary in Teleport 15 and earlier, because some v14
(and earlier) clients did not support the insecure-drop mode.

Teleport 16 no longer needs to downgrade roles, as the minimum supported
client version is 15, and all v15 versions support insecure-drop.
2024-05-09 19:00:15 +00:00
Edoardo Spadolini 384654a2e0 Use proquints for recovery codes (#41379) 2024-05-09 18:02:32 +00:00
Marco DinisandEdward Dowling 0aaf1b21c3 AWS OIDC: Script to configure EC2 Auto Discover with SSM (#41053)
* AWS OIDC: Script to configure EC2 Auto Discover with SSM

There's a new teleport command that adds an inline policy which enables
the AWS OIDC Integration to handle EC2 Auto Discover using the script
mode (SSM).
It also adds the SSM Document used in the teleport installation.

There's also a new endpoint which returns the one off script that uses
that command.

* Update lib/integrations/awsoidc/ec2_ssm_iam_config.go

Co-authored-by: Edward Dowling <EdwardDowling@users.noreply.github.com>

---------

Co-authored-by: Edward Dowling <EdwardDowling@users.noreply.github.com>
2024-05-09 17:20:27 +00:00
Alan Parra 0cca3936c7 chore: Bump golangci-lint to v1.58.1 (#41364)
* chore: Bump golangci-lint to v1.58.1

* Bump run.go to 1.22

* gci lib/vnet/dns/osnameservers_darwin_test.go
2024-05-09 15:18:58 +00:00
Marco Dinis 5bebcfba49 EC2 AutoDiscover Script mode with Integration (#40959)
This PR adds auto-discover support for EC2 installation when using the
Script enroll mode with Integration credentials.

This mode uses SSM commands to install teleport on the target host.
Previsouly, integration credentials would only allow the EICE mode.
From now on, we can use integration credentials to run the SSM commands
on the target node.
2024-05-09 15:05:36 +00:00
Noah Stride d003c4b8fe Remove unused GetTSHVersion helper function (#41361) 2024-05-09 13:14:01 +00:00
Zac Bergquist 708dac8e0d Remove unnecessary version checks (#41343)
The OpenSSH CA is supported in all supported versions of Teleport,
so we no longer need these checks that were added for backwards
compatibility.
2024-05-09 00:07:06 +00:00
Noah Stride 90b761beb3 Remove tsh version check from tbot commands (#41342) 2024-05-08 21:09:36 +00:00
Nic Klaassenandrosstimothy 6833aab96a [vnet][2] DNS library (#40972)
* [vnet] DNS library

* switch to RunTestBackgroundTask

* remove unnecessary slog.With

* set forward request timeout to 5s

* add comment on getMessageBuffer

* set single deadline for read/write

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>

* check buf len instead of cap

* explicitly forward unhandled question types

* reduce buffer side and add comments with justification

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
2024-05-08 17:26:13 +00:00
Marek Smoliński 1aea9b48e8 Add fallback to cache.GetAccessList call (#41258) 2024-05-08 16:58:04 +00:00
STeve (Xin) Huang 6dfaa21b53 Automatically download Let's Encrypt CA for MongoDB Atlas (#41289) 2024-05-08 16:54:27 +00:00
Marco Dinis 5c6737647a Fix panic when running Auto Discovery for EKS (#41316) 2024-05-08 15:44:13 +00:00
Grzegorz Zdunek 117fa0fe52 Prevent deprecation of AppServerOrSAMLIdPServiceProvider from being a breaking change (#41047)
* Prevent deprecation of `AppServerOrSAMLIdPServiceProvider` from being a breaking change

* Improve version check
2024-05-08 15:42:24 +00:00
Lisa Kim 8cdf69c62d Validate application URL extracted from request route /web/launch/<app-url> (#41236)
* Validate application URL extracted from /web/launch/<app-url>

Prevents overwriting or setting new CSP directives.

Validating prevents this because a valid CSP directive
requires spaces between values and spaces are not valid
in URL (encoded or not).

Invalid CSP directives or its values gets ignored by the browser.

* Address CR

* Use accurate wording
2024-05-08 03:43:23 +00:00