Commit Graph
17 Commits
Author SHA1 Message Date
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
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 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 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 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
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 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 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
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
60a325aa7c Device Trust: tsh privilege elevation for TPM enrollment (#27833)
* Start fleshing out UAC elevation

* Use `runas` and ShellExecuteW to open a child process with elevated privileges

* Add tsh command to re-execute

* Add method to be called in the elevated child process

* Ugly, but working, credential activation in UAC dialogued child

* Add TODO

* Add some further notes/explanation on windows.ShellExecute

* Change error message to match function name

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

* Improve comment

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

* Use `trace.BadParameter` instead of `Errorf`

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

* Use `tpm-activate-credential` instead of `activate-credential`

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

* Remove spurious newline

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

* Move towards more production ready elevated process

* Add stubs for darwin/other

* Use path in state dir for cred activation results

* Fix stub return values

* Fix test missing context.Context pass

* Add additional message when cred activation completes

* Use ShellExecuteExW to get handle to process to wait on

* Improve comment in windowsexec

* Minor stylistic changes from review

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

* Minor adjustments to error handling and logging

* Use `windows` over `syscall`

* Leverage `mkwinsyscall`'s error handling

* Missing param in test

* Always show error, not just when `-d` is provided

* Remove unnecessary trace.Wrap(err)

* Restore cf.Debug check

* Explicitly ignore return values from `FPrintln`

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

* Simplify code

* Add null check to `info.hProcess`

* Minor format changes from review

Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>

---------

Co-authored-by: Alan Parra <alan.parra@goteleport.com>
Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>
2023-06-16 17:35:03 +00:00
Noah Stride 63b0612687 Windows TPM Device Authentication (#26830)
* Start of Windows support for authentication

* Finish clientside implementation of TPM device auth

* Rename getOSType -> getDeviceOSType everywhere

* More efficient byte trimming suggested by Zac

* Use `filepath.Join` rather than `path.Join`

* Add test for device auth

* Improve comments

* Log TPM closure errors

* Rename Auth -> Authn for clarity

* GoDoc for FakeDevice iface

* Use UserConfigDir rather than UserHomeDir
2023-05-30 07:07:12 +00:00
Noah StrideandAlan Parra 13dfbbc1e1 Windows TPM enrollment support (#25801)
* Start implementation of Windows TPM enrollment

* Basic device data collection for windows

* Add AK get/creatiom

* Add helpers for converting tpm protos

* Don't create AK in inappropriate circumstances

* Furhter simplify AK load/create

* Add tests for proto/attest conversions

* Ensure that digestalg varies between test cases

* More accurate proto field name

* Missing license header

* Add credential fingerprinting function

* Add getDeviceCredential implementation for windows

* Add dependencies so this builds

* Fix generation of credential id

* Introduce AKPublic field

* Collect other key data

* Add some additional debug logging

* Add more specific serial number fields to dcd

* Use faster powershell call for determining OS version

* Fix missing field in DeviceFromResource

* Add link to to-do issue

* Add packages necessary for enterprise submodule

* Fix import orders

* bump go-tpm-tools to latest versions

* Tidy up returned errors

* Add failure case test for Linux enrollment

* move linux device fake to lib/devicetrust/testenv

* Add test to exercise `RunCeremony`

* Tidier assertion messages

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

* Further simplifcations of test assertions/errors

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

* Apply suggestions from code review

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

* Further fixes as per the llama's suggestions

* Further simplification and header on logs

* Use BadParameter rather than platform unsupported

* Add further notes on RSAness of `go-attestation`

* Minor adjustments to comments

* Unused import removed

* License headers

* rename `mustRandomBytes` -> `randomBytes`

---------

Co-authored-by: Alan Parra <alan.parra@goteleport.com>
2023-05-22 16:50:52 +00:00
Alan Parra ad5c199736 Auto-enroll devices on user login (#25599)
* Implement client-side auto-enroll logic

* Auto-enroll devices on user login
2023-05-05 14:11:44 +00:00
Alan Parra 4e07b4dfa3 Implement client-side device authentication (#19377)
Implement the client-side device authentication ceremony.

Device authentication requires a previously registered and enrolled device. In
exchange for solving a challenge, the ceremony allows the user to augment their
certificates with device extensions, which are necessary to clear device-aware
authentication.

Wiring to `tsh` to be done in a follow-up PR.

gravitational/teleport.e#514
2022-12-16 14:24:56 +00:00
Alan Parra 4e1c39639e Implement client-side device enrollment (#18988)
Implement the client-side enrollment ceremony and define the interfaces for
native-only methods.

The server-side implementation for Device Trust is Enterprise-only, so sadly we
can't against the real server here. I've opted to write a couple of fakes that
we can reuse for the device authentication ceremony and, eventually, to test
against other OS implementations. The current design attempts to write as much
as possible without build tags, so we can unit test the most of it.

Follow ups will add the native parts and wire the ceremony to the corresponding
`tsh` command.

gravitational/teleport.e#514
2022-12-05 21:17:48 +00:00