Commit Graph
66 Commits
Author SHA1 Message Date
Stephen Levine 362fce8c3d [teleport-update] Add local updater metadata (#53602)
* add metadata

* newline

* cleanup status error

* refactor status error

* fix print

* order

* fix test on linux

* Truncate time to ms

* add host param to request

* jitter locally

* rename host to id

* rename func var
2025-04-07 22:05:56 +00:00
Brian Joerger 58f71101d8 feat: Hardware Key Agent - Add api/utils/keys/hardwarekey package (#53671)
* Move hardware key files into new hardwarekey package.

* Tidy up PIVSlot logic and remove its piv-go dependency.

* Add godoc comments to cliPrompt methods; Update cliprompt.go license year.

* Add godocs.
2025-04-07 19:31:11 +00:00
Hugo ShakaandStephen Levine a33473dde9 Make the proxy read from autoupdate_agent_rollout (#49380)
* Add autoupdate_agenbt_rollout support

* fix ping proxy tests

* address creack's feedback

* Address sclevine's feedback

Co-authored-by: Stephen Levine <stephen.levine@goteleport.com>

* fix panic in tests

---------

Co-authored-by: Stephen Levine <stephen.levine@goteleport.com>
2024-12-05 22:21:07 +00:00
Hugo Shaka 7d102ca45c introduce webclient.ReusableClient (#49296) 2024-11-27 15:22:22 +00:00
Brian Joerger 0927b6f768 Teleport Connect allow SSO hostname (#48035)
* Add SSO provider URLs to ping response.

* Add SSOHostname to profile.

* Add SSOHostname to teleterm cluster.

* Add SSO hostname to connect's proxy host allow list.

* Fix lint.

* Address comments.

* Document use of SSOHostname in the profile.

* Use sso host, not hostname.

* Ping with connector.

* Resolve comments.
2024-11-05 18:43:20 +00:00
Vadym Popov 9d2b5c5fe9 Client auto updates integration for {tctl,tsh} (#47815)
* Client auto updates integration for tctl/tsh

* Add version validation
Fix recursive version check for darwin platform
Fix cleanup for multi-package support

* Fix identifying tools removal from home directory

* Replace ToolsMode with ToolsAutoUpdate

* Reuse insecure flag for tests

* Fix CheckRemote with login

* Fix windows administrative access requirement
Update must be able to be canceled, re-execute with latest version or last updated
Show progress bar before request is made

* Fix update cancellation for login action
Address review comments

* Add signal handler with stack context cancellation

* Use copy instead of hard link for windows
Fix progress bar if we can't receive size of package

* Replace with list in order to support manual cancel

* Download archive package to temp directory

* Decrease timeout for client tools proxy call
2024-10-31 17:09:24 +00:00
Stephen Levine 3220ffad77 [teleport-update] Use new webapi fields to find version (#47961)
* Adapt teleport-update to new webapi endpoints

* feedback
2024-10-29 19:03:31 +00:00
Hugo Shaka 1807dfdf52 Implement immediate schedule support for automatic updates (#47920)
* Implement immediate schedule support

* expose edition, fips, and ensure ping endpoint answers

* fix after rebase

* fix cache tests
2024-10-29 15:11:29 +00:00
Vadym Popov 10fb784495 Client AutoUpdate proto structure changes (#47532)
* Update client autoupdate proto structure

* Replace with reserved

* Fix unit tests

* Add more info in proto

* Rename proto to be aligned RFD namings

* Replace enum type for ToolsMode to string
2024-10-17 14:36:06 +00:00
Vadym Popov eed38adeea Expose client tools auto update for find endpoint (#46785)
* Expose client tools auto update for find endpoint

* Group auto update settings in find response
Log error instead returning error
Add tests auto update settings in find endpoint
Add check for not implemented error

* Add more test cases
2024-10-04 16:01:55 +00:00
rosstimothy 741b54c2b4 Allow a custom SSH dial timeout to be set cluster wide (#45507)
A new SSHDialTimeout field is added to the ClusterNetworkingConfiguration
to allow cluster admins to override the default dial timeout of 30s.
The dial timeout is made available in /webapi/ping, stored in the tsh
profile, and cached on disk like other similar cluster settings so
that tsh ssh can consume the relevant information without requiring
an additional round trip to the cluster. At the moment, there is no
support for an unlimited dial timeout, as that would cause
complexity with backwards compatibility.
2024-08-20 13:11:46 +00:00
Nic KlaassenandTiago Silva bca26e06f4 add signature algorithm suite to ping response (#44567)
* add signature algorithm suite to ping response

* type fix

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

---------

Co-authored-by: Tiago Silva <tiago.silva@goteleport.com>
2024-07-24 15:09:25 +00:00
Yassine Bounekhla f88877e4bf Add saml SLO to tsh logout (#43528) 2024-07-16 02:37:26 +00:00
Jakub Nyckowski bfaa3340e8 Remove Assist (#42657)
* Remove assist feature

* Fix some tests

* Remove unused functions

* Fix ut

Remove more stuff
2024-06-10 20:57:05 +00:00
Rafał CieślakandKrzysztof Skrzętnicki 8e319e7fd6 webclient.Ping: Return error on unsuccessful response (#41317)
* webclient.Ping: Return err on unsuccessful response

* Log mangled response, add test case

* Point towards possible causes of errors

Co-authored-by: Krzysztof Skrzętnicki <krzysztof.skrzetnicki@goteleport.com>

---------

Co-authored-by: Krzysztof Skrzętnicki <krzysztof.skrzetnicki@goteleport.com>
2024-05-14 12:43:43 +00:00
rosstimothy 8f1522bb34 Convert api to use slog instead of logrus (#39255)
THe use of slog now allows logrus to be removed from the api
module entirely.
2024-03-18 21:20:28 +00:00
Alan Parra 446505674b chore: Remove the AuthenticationSettings.DeviceTrustDisabled field (#37595) 2024-01-31 18:56:38 +00:00
Jakub Nyckowski af817583ad Proxy TAG requests through Auth (#34642)
* Proxy TAG requests through Auth

* Integrate Access Graph feature and optimize services

This commit entails the integration of the Access Graph feature into the existing service configuration. This feature is manifested through an 'IsEnabled' method that checks the state of the access graph. Additionally, the auth service logic now includes a flag for enabling access graph. The services have been further optimized with adjustments geared towards improving performance and readability of the code.

* Move TAG enabled flag from proxy to user setting/auth context

* Swap a pointer to AccessGraph config with a value.

* Add 'TestNewAccessGraph' function to 'useracl_test.go' file.

The function 'TestNewAccessGraph' has been added to run tests checking the configuration of Access Graph. Furthermore, a small change is made for the 'KindAccessGraph' comment in 'constants.go' to provide more accurate information.

* Implement Access Graph feature across various files

The Access Graph feature has been incorporated in 'module.go', 'authservice.proto', 'auth.go', and 'plugin.go' files. A method 'EnableAccessGraph' is also introduced in 'module.go' to allow the usage of this feature. Descriptions of Access Graph have been adjusted across files to explicitly state the feature's enablement.

* Fix tests

* Remove unused access graph feature code

This commit removes all references and uses of the access graph feature from the codebase. It also updates corresponding tests to reflect this removal. It also adds EnableAccessGraph() method to testing module to fix test compilation.
2023-11-16 18:08:37 +00:00
Jakub Nyckowski 29d965d2fa TAG initial implementation (#34541)
* TAG initial implementation

This change introduces the initial Teleport integration with TAG. The implementation introduces:

* new `access_graph` section in `teleport.yaml` file that holds the access graph configuration
* new `access_graph` RBAC kind, that controls who has access to TAG feature
* the new access graph RBAC kind is added to the ACL REST endpoint, so WebUI know if TAG is enabled and the user has access to it.

* Remove `UseAuth` and improve comments in `AccessGraph`

This commit removes the `UseAuth` field from the `AccessGraph` configuration. At the same time, the comments for each field in `AccessGraph` have been made more consistent and descriptive, providing clear declaration of each field's purpose. The comments in `WatchEvents` in `grpcserver.go` have also been updated for clarity.
2023-11-13 22:46:17 +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
Alex McGrath 0760bc9776 Allow setting max_session_ttl from clusterauth preferences (#26824)
Document `default_session_ttl` in the reference.
2023-06-21 10:39:34 +00:00
Jakub Nyckowski ae8f2fa929 Assist - Configuration and usage (#25953)
* Assist - Configuration and usage

* Add network config test

* Add config test

* Run GCI

* Address review comments
2023-05-11 01:56:55 +00:00
Alan Parra 48dd429917 Return auto-enroll status on Ping (#24752)
* Return auto-enroll status on Ping

* Verify both old and new flags
2023-04-24 14:43:29 +00:00
Marco André Dinis 3102b82770 Use stable/cloud when Automatic Upgrades is on. (#23395)
* Use `cloud/stable` when Automatic Upgrades is on.

Teleport provides scripts to install teleport agents/services.
Those scripts use YUM/DEB repositories when possible.
Each repo has multiple channels:
- stable/v11
- stable/v12
- cloud/stable

We want to ensure that if the cluster is running in the cloud and
automatic upgrades is on (auth service was started with
TELEPORT_AUTOMATIC_UPGRADES=yes teleport ...), then the installation
script must offer the `cloud/stable` channel.

This PR changes the following scripts:
- Discover Install Node
- Discover Install Database Service
- Install App script
- EC2 default-installer and EC2 default-agentless-installer

* add helm chart knobs to enable auto updater

* use let instead of const and remove default export

* add HA to helm chart

* always return .automatic_upgrades in web ping response

* rename cloud/stable to stable/cloud

* fix ts test
2023-03-28 16:05:09 +00:00
Edoardo Spadolini 701a0b05ed Remove the Houston enforcer (#23527)
* Remove the enforcer

* update e ref
2023-03-24 09:57:47 +00:00
rosstimothy 1c3188a38a Add a dedicated client to communicate with the Proxy SSH server (#22629)
A new `api/client/proxy/Client` has been added to interact with
the SSH and gRPC servers that the Proxy serves on its SSH port.
The client will first try connecting to the gRPC server and if
that fails it will fall back to the SSH server.

Much of the SSH functionality mimics the existing behavior of the
`ProxyClient` in `lib/client`. This is the first part of phasing
out that client in favor of the new client. There will be a follow
up PR that migrates `lib/client` to make use of the new client instead.

Part of #19812
2023-03-15 13:41:56 +00:00
rosstimothy c2fc9a9375 Add idle connection timeouts to http clients and servers (#22885)
Sets `http.Server.IdleTimeout` and `http.Client.IdleConnTimeout`
on clients and servers which didn't have them set. A default of
360s was chosen to be on par with the default of an NLB without
being identical.

This was added as another safety measure to prevent leaking any
idle connections indefinitely as seen in #22757.

`apidefaults.DefaultDialTimeout` was also renamed to
`apidefaults.DefaultIOTimeout` to better reflect its usage.
2023-03-10 16:47:06 +00:00
rosstimothy fa3bb9ac59 Ensure that the webclient closes connections (#22832)
The `http.Client.Transport` created in `newWebClient` wraps a
chain of `http.RoundTripper` over an underlying `http.Transport`.
Since we cannot guarantee that each `http.RoundTipper` has a
`CloseIdleConnections` method the usage of
`defer clt.CloseIdleConnections()` does not guarantee that the http
connections created during Find/Ping/etc are closed.

To prevent leaking connections implementations of `http.RoundTripper`
have added a `CloseIdleConnections` method added that forwards the
request on to the wrapped interface. The `otelhttp.Transport` does
not implement this method either so care has been taken to wrap it
in a `http.RoundTripper` which will call the root transport in
`enforceCloseIdleConnections`. An upstream issue has been filed
with otelhttp: https://github.com/open-telemetry/opentelemetry-go-contrib/issues/3543
to get the method added to their `Transport` implementation.

This wasn't noticed prior to upgrading to go1.20 becuase prior to
[this](https://github.com/golang/go/commit/4e7e7ae1406c70d9cc0809ec11105a55a60a0b70)
commit the `ReadHeaderTimeout` set on the Proxy web api http.Server
would cause the connection to appear idle and get terminated by the
server.

`TestWebClientClosesIdleConnections` was added to capture the leak
in connections as reported in #22757 and prevent any regressions.
2023-03-10 15:21:16 +00:00
Brian Joerger 1dcc997189 Add headless auth preference logic. (#22148) 2023-02-27 18:25:51 +00:00
Vitor Enes d72ac18247 Set extra proxy headers in all tsh HTTP requests (#19766)
Before this commit, the `tsh` HTTP requests that had the extra headers
were those that did not use `roundtrip`.
This commit leverages `http.RoundTripper.RoundTrip` to ensure that all
requests have the the extra headers.
2023-01-11 10:29:05 +00:00
Alan Parra da44b08010 Skip device authentication based on Ping (#19966)
AttemptDeviceLogin, which is the main entry point for device authentication, now
checks the Ping response and skips the attempt entirely if device trust is
disabled.

The main objective is to avoid a needless roundtrip if the feature is disabled,
as one should only pay for what is in use.

There's actual little consequence in attempting the roundtrip, apart from the
added latency on logins, so I've gone with a negative flag ("Disabled" instead
of "Enabled"). The negative is less harmful if, for some reason, it's wrongly
absent (say, because of some future Ping code branch).

gravitational/teleport.e#514
2023-01-10 14:46:48 +00: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
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
rosstimothy 0ec2116ba2 Provide proxy listener mode from reversetunnel.Resolver (#16434)
By only providing the tunnel address from the `reversetunnel.Resolver`
callers would still need to lookup the proxy listener mode to determine
how to dial the address. This results in sending a request to
`/webapi/find` once by the resolver to get the tunnel address and then
a second request to `/webapi/find` by users of the `Resolver` to determine
the proxy listener mode. Propagating the listener mode along with the
tunnel address by the `Resolver` ensures only one `/webapi/find` call
is needed.

This is especially impactful because the `reversetunnel.TunnelAuthDialer`
which is used by the auth http client would do this everytime the
`http.Client` connection pool was empty. When the `http.Client` needed
to dial the auth server it was incurring the additional roundtrip to the
proxy.
2022-09-26 20:15:32 +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
rosstimothy 1973fcee24 Span improvements (#15388)
* Add spans to TeleportClient/ProxyClient/NodeSession

* Improve dialer tracing

* Alter default http client span name to include path

* propagate tracing options in NewClientConn
2022-08-18 21:29:03 +00:00
Bernard Kim 26e3df82b5 Display license out of compliance warnings (#14114) 2022-07-26 19:31:50 -07:00
Krzysztof Skrzętnicki 26a442dfbf Better error message on ping parse error. (#14700) 2022-07-20 20:11:53 +00:00
Andrew Burke 22c0fccba7 Restore HTTP_PROXY for multi-port mode (#13048)
This change undoes the changes in #11990 and #12335 for Teleport going forward.
2022-06-07 11:57:16 -07:00
Roman Tkachenko ec512bafa4 Implement proxy templates (#12848) 2022-06-07 00:06:52 +00:00
Edoardo SpadoliniandAlan Parra 3de0f5dfda Client timeout fixes (#12557)
* Respect timeout in `(directDial).DialTimeout`

* Add a Timeout to the api/client/webclient calls

* Respect timeout in (proxyDial).DialTimeout

* Applied suggestion

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

Co-authored-by: Alan Parra <alan.parra@goteleport.com>
2022-05-13 14:40:59 +02:00
rosstimothy 80d6bff4e5 Add auto instrumentation to http and grpc clients and servers (#12231)
Leverage otelhttp to generate spans for http clients and http handlers.
Additionally add spans for grpc clients and servers by using the
otelgrpc interceptors. This is step one in implementation of RFD 65.
Until further work is done, the spans generated will be a no-op
until the tracing provider is initialized.
2022-05-03 15:55:31 -04:00
Alan Parra f9da8e2252 Implement passwordless cluster settings (#11952)
Implement passwordless cluster settings, as described by RFD 52: Passwordless
[1]. See https://github.com/gravitational/teleport/pull/11716 for recent RFD
changes.

Add the "passwordless" connector and allows cluster admins to configure it as
the cluster default.

teleport.yaml:

```yaml
auth_service:
  authentication:
    type: local
    second_factor: on
    webauthn:
      rp_id: example.com
    passwordless: true            # enables/disables passwordless
    connector_name: passwordless  # sets passwordless as the default
```

`tsh` obeys the connector name if present. User overrides are possible via `tsh
--auth=local` or `tsh --auth=passwordless`. The `tsh --pwdless` flag is now
removed, as discussed in recent RFD changes.

Web API `/ping` and `/ping/{connector}` endpoints are changed to support
"passwordless" and to provide other necessary information.

#9160

[1] https://github.com/gravitational/teleport/blob/master/rfd/0052-passwordless.md#cluster-settings

* Add passwordless toggle to AuthPreferenceSpecV2 proto
* Update generate protos
* Add AuthPreference fields and validation
* Reserve system connector names
* Distinguish between type=local and local connector
* Add passwordless option to teleport.yaml
* Do /ping and /ping/{connector} changes
* Make tsh respect the passwordless connector, remove --pwdless
2022-04-18 22:13:43 +00:00
Andrew Burke 89b6534c57 Ignore HTTP_PROXY for reverse tunnels (#11990)
This change disables the HTTP_PROXY support for reverse tunnel connections, as introduced in #10209. This is for backwards compatibility.
2022-04-18 17:40:03 +00:00
Jeff Pihach c0a0a6c3c7 Return error message if supplied auth connector name doesn't match registered names. (#11800)
* Include the possible connector values if supplied value is invalid.

* Update messaging for auth flag.

* Return error message from failed ping response.

* Collect the connector names in the existing loops.
2022-04-07 22:29:06 +00:00
Andrew Burke e3a8fb7a0f NO_PROXY port support + special case for proxying via localhost (#11403)
This change updates NO_PROXY handling to allow blocking specific host:port combinations, rather than just the host. It also adds a special case for downgrading requests to plain HTTP when --insecure is true and the request goes through a plain HTTP proxy at localhost (i.e. HTTP_PROXY=http://localhost).
2022-04-04 14:23:50 -07:00
Andrew Burke 4543bfd98d Respect HTTP_PROXY/HTTPS_PROXY (#10209)
This change allows tsh to use HTTP proxies when HTTP_PROXY/HTTPS_PROXY is set in the environment.
2022-03-23 19:58:19 +00:00
Alex McGrath 3d35263a6c Add a .tsh/config file and add support for configuring custom http headers 2022-03-23 14:19:07 +00:00
Alan Parra bac0ccdc99 Remove U2F support (#10476)
Follows up on #10466 by removing remaining U2F references, including proto/gRPC
surface and the lib/auth/u2f package itself.

#10375

* Remove U2F from lib/auth/ (1)
* Remove U2F from lib/auth/ (2)
* Remove U2F from lib/auth/ (3)
* Remove U2F from lib/services/
* Remove U2F from tsh mfa add suggestions
* Remove U2F protos
* Update generated protos
* Cleanup a few stragglers
* Remove lib/auth/u2f package
* Fix references to auth.MFAAuthenticateChallenge
* Revert needless lib/auth/password.go change
* Update e/ to ad8fd4a (U2F cleanup)
* Fix stragglers from latest master rebase
* Fix lint and compile failures
2022-02-24 19:54:28 +00:00
Marek Smoliński 5afd0e6204 Update API client: dial auth service with TLS Routing (#9498) 2022-01-03 11:32:45 +01:00