Commit Graph
76 Commits
Author SHA1 Message Date
Alan Parra 8f04409d6a chore: Bump go-attestation to v0.6.0 (#61294)
* chore: Bump github.com/google/go-attestation to v0.6.0

* Fix breaking changes from go-attestation

* Bump e/ reference
2025-11-12 20:37:19 +00:00
Dan Upton dbb5f478d5 Device Trust: add required-for-humans mode (#56907)
* Device Trust: add `required-human` mode

* Add `device_trust.mode=required-human` to the test plan

* Add `IsBot` methods to TLS and SSH identities

* Fix `required-human` mode on roles

* Rename mode to `required-for-humans` for clarity

* Undo premature changes to device trust guides

* Default `deviceVerificationPassed` false to avoid accidents when adding new modes

* Handle `BotName` and `BotInstanceID` in `lib/auth/authtest`

* Fix stray reference in test

* Fix reference to `config.DestinationMemory`

* Handle empty device trust mode
2025-07-28 12:43:16 +00:00
rosstimothy 2afdce29c5 Introduce modulestest package (#56721)
The new package is meant to house a test friendly implementation
of modules.Modules. Due to the pervasive and global nature of
modules, this package also contains a copy of of
modules.SetTestModules. In a perfect world this function wouldn't
be needed and modules would be injected where required, however,
that would take considerable effort. The existing test modules
are temporarily left in place until the enterprise tests can be
updated to use modulestest.
2025-07-14 21:55:07 +00:00
Edoardo Spadolini 1cb642736a Avoid counterproductive checks in IsUserAuthority and IsHostAuthority (#56250) 2025-06-30 19:00:52 +00:00
Zac Bergquist a12def583a Apply remaining modernize changes. (#56037)
This is the last of this series of updates.
2025-06-25 21:25:29 +00:00
rosstimothy 52816e8427 Bump golangci-lint to v2 (#54410)
* Bump golangci-lint to v2

* fix lints

* update e

* fix: delete removed cli option
2025-05-07 22:14:51 +00:00
Nic Klaassen 023f50b0ea [vnet] add vnet-(un)install-service commands for Windows (#52164) 2025-02-20 18:37:37 +00:00
Forrest b9232c3013 transition ssh enforcement to sshca.Identity (#51468) 2025-02-04 18:01:53 +00:00
rosstimothy 2cced62805 Fix violations of non-constant format strings linter (#51812)
Depends on https://github.com/gravitational/teleport.e/pull/6006.
Now that we are compliant, the ignore rule was removed from the
golangci-lint config to prevent future regressions.
2025-02-04 16:43:35 +00:00
Alan Parra 1a82bee20f Allow alternative sudo path for NixOS (#51549) 2025-01-28 21:25:58 +00:00
Paul Gottschling 70d70a2d60 Fix outdated docs URLs (#50923)
- Web UI source
- README
- lib
- api

Do not touch docs URLs in test case names or test data where we don't
expect users to navigate to the URLs.
2025-01-16 18:17:35 +00:00
rosstimothy ef859498bc Vendor gravitational/trace/trail in api (#51032)
* Vendor gravitational/trace/trail in api

Pulling in the trail package directly in api will allow the trace
module to shed the grpc-go dependency. This needs to land prior
to https://github.com/gravitational/trace/pull/112 being included
in a new version of trace.

There should be no noticable change in the api depdency tree since
it already depends on grpc-go. Some additional items from the
trace/internal package were also vendored within trail as needed.
Additionally, some of the public api of trail that was not being
consumed has been made private.

* fix: appease linters
2025-01-14 21:04:01 +00:00
Hugo Shaka 061b0e2bea lint (#50690) 2025-01-02 19:50:08 +00:00
rosstimothy 47c021650c Convert lib/devicetrust to use slog (#50458) 2024-12-19 22:41:37 +00:00
Zac Bergquist b1d8c3bdf0 devicetrust: don't invoke powershell when reading system information (#50372)
The device trust web flow can result in a web browser launching
Teleport Connect (which launches tsh, which in turn launches
powershell).

Some antivirus solutions flag cases where a powershell process is
a descendent of a web browser process. In order to avoid being
blocked by the antivirus software, we want to read system information
directly instead of via powershell.
2024-12-19 18:55:53 +00:00
Grzegorz Zdunek 095b0a329a Show device trust status in Connect (#49508)
* Check if device is trusted

* Move `TrustedDeviceRequirement` enum to a separate file and generate TS definitions for it

Generating TS definitions for the entire legacy/types/types.proto would result in 50K lines of generated code, and the bundle size would increase by ~20% (around 1 MB).

* Extract function to calculate device trust requirement that can be used both by the server and the client

Important: it now uses `GetEnforcementMode` instead of `GetEffectiveMode`. The check for OSS module is performed on the server-side anyway.

* Check what is device trust requirement based on cluster config and user roles

* Show device trust status in UI

* Remove `types.` prefix

* Improve godocs

* Bring back `getRoles func() ([]types.Role, error)`

* Simplify `TestHasDeviceTrustExtensions`

* Clean up and improve `TestCalculateTrustedDeviceRequirement`

* Move `CalculateTrustedDeviceRequirement` and tests to a separate file

* Add colors to shield icons

* Declare variables where they are used

* Extract a component to display device trust status for better readability

* Correctly reference `lib/client.ProfileStatus.Extensions`

* Set group limit to 8

* Make `switch` exhaustive

* Regenerate protos

* `make fix-license`
2024-11-29 10:11:30 +00:00
Nic Klaassen 0a0d4137db eliminate rsa.GenerateKey and lib/auth/native (#47768) 2024-10-21 20:55:22 +00:00
Alan Parraandrosstimothy 335cae0dc9 Fix TestAutoEnroll_disabledByEnv flakiness (#47723)
* Fix TestAutoEnroll_disabledByEnv flakiness

* Use t.Setenv

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

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
2024-10-18 19:00:21 +00:00
Alan Parra 6669f2d160 feat: Disable auto-enroll via environment variable (#47679) 2024-10-18 17:02:02 +00:00
Alan Parra 0b751713b5 fix: Avoid needless user escalation during auto-enroll (#47676) 2024-10-18 13:25:06 +00:00
Zac Bergquist c8b364efb1 Set min macOS version to 11 (#46461)
Go 1.23 has a hard requirement of macOS11 Big Sur or later.
2024-10-04 23:31:00 +00:00
Alan Parra 4d9fab6962 fix: Enforce device trust on OSS processes (#46940)
* fix: Enforce device trust on OSS processes

* Fix TestSessionController_AcquireSessionContext
2024-09-27 14:13:32 +00:00
Nic KlaassenandAlan Parra f1083d89f0 remove lib/client dependency on lib/devicetrust/authn (#45673)
* remove lib/client dependency on lib/devicetrust/authn

* add cgo depguard

* fix typo

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

---------

Co-authored-by: Alan Parra <alan.parra@goteleport.com>
2024-08-22 20:38:30 +00:00
Nic Klaassen 45d33c4751 Device Trust support for split SSH and TLS keys (#45546)
* Device Trust support for split SSH and TLS keys

* chalResp -> tpmChallenge

* clarify comment on sha256 import

* use input struct, crypto.Signer instead of keys.PrivateKey

* use trace errors in challenge package
2024-08-19 18:59:08 +00:00
Tiago Silva cdfed087b8 [devicetrust] fix: handle server errors in bi-directional streams (#44677)
* [devicetrust] fix: handle server errors in bi-directional streams

Fix an edge case in the devicetrust gRPC bi-directional stream handler where the stream could terminate with an error after the last client `Recv` call but before the next `Send` call.
Previously, this scenario caused the `Send` method to return an `io.EOF` error, which indicated that the connection was terminated but did not reveal any errors returned by the server.
This update ensures that the client continues to consume the stream until an error is returned, allowing for proper error handling and more robust stream management.

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>

* add license headers

* drop helper and local skip io.EOF errors

---------

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
2024-07-30 08:45:07 +00:00
Tiago SilvaandAlan Parra e05dd7f379 [sec_scan][17] add AssertDevice to FakeDeviceService (#44159)
* [sec_scan][17] add `AssertDevice` to `FakeDeviceService`

This PR introduces a `AssertDevice` logic into `FakeDeviceService` to authenticate devices during unit tests using device trust credentials.

This PR is part of https://github.com/gravitational/access-graph/issues/637.

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>

* simplify assert tests

* Update lib/devicetrust/assert/assert_test.go

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

---------

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
Co-authored-by: Alan Parra <alan.parra@goteleport.com>
2024-07-15 09:11:09 +00:00
Alan Parra 2cb249dc9f Define server-side device assertion interfaces (#44036)
* Define server-side device assertion interfaces

* Update proto comments

* Update generated protos
2024-07-11 13:13:47 +00:00
Tiago Silva e3ae590c21 [sec_scan][6] add device events (#43905)
This PR adds the ability to watch for events for `*devicepb.Device` objects.

Backend storage representation of  `devicepb.Device` is achieved using an internal representation that lives in `e/lib/devicetrust/storage` and whose logic is internal to the package.

To be able to expose the unmarshal logic necessary for events to work, this PR exposes a registration hook that `e/lib/devicetrust/storage` function must call during initialization to register the unmarshal function.

Part of https://github.com/gravitational/access-graph/issues/637

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
2024-07-11 10:27:54 +00:00
Alan Parra a545068e65 Add a client-side API to assert devices (#43890)
* Add a client-side API to assert devices

* Add a godoc to authnStreamAdapter
2024-07-10 16:26:53 +00:00
Michael b85d1a6e0e Include BuildCommunity in built type checks (#42391)
* Include BuildCommunity in built type checks

This commit will add two new methods to the modules interface,
IsEnterprise and IsOSS. This is to help alieviate any pain around the
code base that used to look specifically for BuildOSS. Now that we have
two "oss types" (oss and community), we can use these methods to do
enterprise/oss checks, rather than specifically looking at the build
type. This also will allow any future build types to not affect these
checks again in the future.

* Update e
2024-06-04 20:10:38 +00:00
Zac Bergquist 631c1fcae2 Update min macOS version to 10.15 (#42017)
Teleport 16 will be built with Go 1.22, which requires macOS 10.15
(Catalina) or later.
2024-05-28 14:59:31 +00:00
Alan Parra a1c7ab71a2 Modify lib/devicetrust/authn to return the DeviceConfirmationToken (#40377)
* Update FakeDeviceService to issue confirmation tokens

* Modify lib/devicetrust/authn to return the DeviceConfirmationToken
2024-04-12 14:34:22 +00:00
Alan Parra e178635711 fix: Set an upper bound for the DMI cache file (#40219) 2024-04-04 21:45:56 +00:00
Alan Parra fd562794cb Implement client-side device web authentication (#39426)
* Implement client-side device web authentication

* Update TestCeremony_Run
2024-03-18 14:51:53 +00:00
Alan Parra 5056cec1ba Fix .clangd file on lib/devicetrust/native (#39062) 2024-03-07 16:42:00 +00:00
Alan Parra a469c4ce2b feat!: Apply role device mode to App Access (#35274)
* Apply role device mode to App Access

* nit: Don't capture traces on guard errors

* Consistently return ErrTrustedDeviceRequired

* Surface device error trust error for apps

* Reply with a custom message for device trust errors

* Review: Remove the DisableDeviceAuthorization field

* Review: Refactor device trust message into its own method

* Review: Wrap guard errors

* Review: Simplify device error message
2023-12-04 17:53:30 +00:00
fheinecke b178b8b732 Updated Teleport codebase to AGPL3 license (#35259)
Signed-off-by: Fred Heinecke <fred.heinecke@goteleport.com>
2023-12-01 17:48:14 +00:00
Alan Parra f86c527a31 Collect device data concurrently on Windows (#34707) 2023-11-21 13:38:30 +00:00
Alan Parra ffce86db1f Keep a device data cache in-process (#34597) 2023-11-17 13:27:23 +00:00
Alan Parra 0cef1a31ca Return an user-friendly message on TPM permission errors (#34681)
* Return an user-friendly message on TPM permission errors

* Drop tpmDevice.signChallenge

* Create parents when creating the state dir
2023-11-17 13:03:28 +00:00
Alan Parra 40dc2e9c6c Collect device data concurrently on Linux (#34602)
* Read DMI files concurrently

* Refactor DMI logic into its own method

* Collect device data concurrently on Linux

* Drop the mutex on DMIInfoFromFS, simplify
2023-11-16 14:20:57 +00:00
Alan Parra e92d0bffff Add the os_id field to device messages (#34588)
* Add the os_id field to device messages

* Update generated protos

* Add os_id field conversions

* Collect os_id on Linux devices

* Fix Linux tests
2023-11-16 13:05:47 +00:00
Alan Parra 7008dc1fc2 Implement Linux support for device enroll and authn (#34557)
* Close streams on errors

* Rename fake_windows_device.go to fake_tpm_device.go

* Test enroll/authn ceremonies against Linux

* Allow Linux devices to enroll and authenticate

* Implement Linux TPM methods

* Attempt attestation without the event log on failures
2023-11-14 14:23:30 +00:00
Alan Parra 9db7a1bf96 Implement device data collection for Linux (#34467)
* Rename others.go to device_others.go

* Move various functions to tpm_common.go

* Read device collected data on Linux

* Add the mode param to native.CollectDeviceData

* Add the mode param to collectDeviceData

* Run escalated `tsh device dmi-info`

* Write cached DMI info

* Read cached DMI info

* Avoid asset tags with spaces on them

* nit: Use deviceStateFolderName without a dot on Linux

* Test various data collection scenarios

* Fix macOS/Windows typo
2023-11-14 13:13:22 +00:00
Alan Parra ee9ded0ec6 Refactor device TPM logic to better support Linux (#34133)
* Dupe device_windows.go

* Split functions between generic and OS-specific

* Add the tpmDevice abstraction

* Add "No Asset Information" to the list of skipped tags

* Appease linter, reintroduce windows build tag
2023-11-02 16:40:52 +00:00
Alan Parra c5ec921536 fix: Use octal mode for Windows TPM files (#34102) 2023-11-01 13:21:32 +00:00
Alan Parra 32bcd71591 fix: Fix panic on tsh device enroll --current-device (#32694)
* Test RunAdmin enrollment failure

* Fix RunAdmin when enrollment fails, protect tsh from nil device
2023-09-28 13:56:46 +00:00
Alan Parra ff44238edd fix: Skip known bad asset tags on Windows (#31360) 2023-09-04 15:03:42 +00:00
Brian Joerger cf6473feb9 Add gRPC error interceptors to API client (#30578)
* Move gRPC error intercetpors to api/utils/grpc/interceptors.

* Use error interceptors in api client and mock server.

* Apply suggestions from CR.

* Unwrap FromGRPC errors in middleware.

* Use gRPC auth service in tests instead of external example service.

* It's gRPC!!!

* Fix unit test.

* Add error interceptor to proxy client.

* Fix merge conflict.
2023-08-24 23:27:06 +00:00
Alan Parra 5c8f91a4dd Add --current-device capabilities to tsh and tctl (#30636)
* Add the `tsh device asset-tag` hidden command

* Implement registration in the fake device service

* Add `--current-device` to `tsh device enroll`

* Add `--current-device` to various `tctl` commands

* s/currentDeviceCommand/canOperateOnCurrentDevice/

* Delete the non-unused `enroll.RunCeremony`

* Document RunAdminOutcome

* fix: Correctly handle partial successes

* nit: Logging
2023-08-18 15:03:50 +00:00