Commit Graph
35 Commits
Author SHA1 Message Date
Nic Klaassen 023f50b0ea [vnet] add vnet-(un)install-service commands for Windows (#52164) 2025-02-20 18:37:37 +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
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
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
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 e178635711 fix: Set an upper bound for the DMI cache file (#40219) 2024-04-04 21:45:56 +00:00
Alan Parra 5056cec1ba Fix .clangd file on lib/devicetrust/native (#39062) 2024-03-07 16:42:00 +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 ff44238edd fix: Skip known bad asset tags on Windows (#31360) 2023-09-04 15:03:42 +00:00
Alan Parra d1cb52d7e6 fix: Save device keys on os.UserCacheDir (#30171) 2023-08-08 14:26:36 +00:00
Alan Parra ec8594f96d fix: Ignore staticcheck false positive on darwin (#28038) 2023-06-19 18:42:10 +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 87ab3ffe37 Add Proto types for storing TPM Platform Attestation in Collected Data (#27680)
* Add types for storing Platform Attestation

* Add to/from resource conversion

* Use bytes for nonce field

* Tidy up usage of pointers

* Ensure tests cover multiple entries

* Adjust comments as per PR review
2023-06-12 16:13:26 +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 Stride f330bd0bee Device Trust: TPM Enrollment support EKCerts (#27070)
* Send EKCert if one is present

* Consistent naming

* Add configuration types for EKCertAllowedCAs

* Add fileconfig support for EKAllowedCAs

* Add test cases for fileconf loading and parsing

* Rename helper functions for consistency

* Correct GoDoc format

* Add source URL for pem file
2023-05-29 18:42:41 +00:00
Alan Parra 2083dc8109 Fix "unnecessary conversion" in lib/devicetrust/native (#27051)
It trips the "unconvert" linter.
2023-05-29 13:32:16 +00:00
Alan Parra 5031d9581f Collect MDM data from macOS (#26796)
* Collect MDM data from macOS

* Add serial number and model examples
2023-05-25 12:56: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 8dd586b985 Log informative messages for device authn failures (#24849) 2023-04-20 13:50:44 +00:00
Alan Parra d5e329e9ea Add tsh device debug commands (#19166)
Add `tsh device collect` and `tsh device keyget`, which are useful to debug
device trust functionality.

gravitational/teleport.e#514
2022-12-09 10:38:52 -03:00
Alan Parra 73d058d7a7 Return user-friendly messages for common enroll errors (#19115)
Handle a few common macOS errors, as well as gRPC unimplemented errors, and
return more user-friendly messages in their place.

gravitational/teleport.e#514
2022-12-07 20:10:14 +00:00
Alan Parra d218fd2625 Implement macOS device enrollment methods (#19079)
Implement native macOS methods required by device enrollment, namely methods to
Create/Get the device key, Sign challenges with it, and to collect device data
(aka serial number).

The implementation is rather similar to lib/auth/touchid, but simpler in a few
aspects:

1. Device keys don't require user interaction (as in they don't cause a touch ID
   prompt); and
2. There exists, at most, a single device key at all times.

I've added a tiny refactor to reuse Apple public key parsing from touchid, plus
some changes so touchid doesn't break in the face of unexpected keys (which the
device key didn't cause, per se, but my experiments getting to it did).

gravitational/teleport.e#514
2022-12-07 18:11:21 +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