Commit Graph
10 Commits
Author SHA1 Message Date
JoelandAlan Parra 9ae691feb5 Implement tctl resource commands for Device Trust (#21921)
* handle tctl create device.yaml

* delete + fix create

* delete by asset tag

* factor out finder

* tctl get device

* gci

* use unmarshaler

* device

* test + unmarshal version check

* improve error

* fix device asset search

* fix parse shortcut bug

* various fixes

* rename CheckAndSetDefaults to checkAndSetDefaults

* Update tool/tctl/common/device/resource.go

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

* Update tool/tctl/common/collection.go

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

* Update tool/tctl/common/resource_command.go

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

* fix import

* improve findDeviceByIDOrTag and allow multiple returns for fuzzy asset tag searching in tctl get devices/

* update create/delete messages

* print warn instead of error

* mark sanity check

* resource rework

* add comments

* fix typo

* Update tool/tctl/common/resource_command.go

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

* Update tool/tctl/common/resource_command.go

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

* Update tool/tctl/common/resource_command.go

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

* drop findmultiple

* Update tool/tctl/common/resource_command.go

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

* Update tool/tctl/common/device/resource.go

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

* various feedback updates

* user friendly enum for ostypes

* add comments

* Update tool/tctl/common/resource_command.go

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

* Update tool/tctl/common/device/resource.go

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

* Update tool/tctl/common/device/resource.go

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

* Update tool/tctl/common/device/resource.go

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

* Update tool/tctl/common/device/resource.go

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

* gci

* feedback

* typos

* Update tool/tctl/common/device/resource.go

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

---------

Co-authored-by: Alan Parra <alan.parra@goteleport.com>
2023-02-22 21:11:13 +00:00
Alan Parra 8ef8324b8c Enable role-based device authz for DB, k8s and SSH (#20640)
* Expose device verification methods in lib/devicetrust/authz

* Set device fields in auth.Context.GetAccessState

* Enable role-based device verification for SSH

* Enable role-based device verification for DBs

* Add TODO for better SSH error messages

* Do not override device error on lib/kube/proxy

* Run gci
2023-01-27 21:11:01 +00:00
Alan Parra ecf9e5c7d1 Enforce device extensions for SSH access (#19574)
Add device-aware authorization for SSH access, including both long-lived and
single-use certificates.

If the device trust mode is set to "required", then the presence of the
corresponding extensions is enforced. (Requires Teleport Enterprise.)

Adds logic related to TLS validation and single-use certificates as well, where
appropriate. TLS device-aware validation is not wired into Teleport yet, but
will be in follow up PRs.

gravitational/teleport.e#514
2022-12-21 22:54:13 +00:00
Alan Parra f28319a6b8 Add user-visible device trust settings (#19531)
Add device trust settings to teleport.yaml and cluster_auth_preference resource.

Example configuration (teleport.yaml):

```yaml
auth_service:
  authentication:
    device_trust:
      mode: "required"  # requires Teleport Enterprise
```

gravitational/teleport.e#514
2022-12-21 15:24:12 +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 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
Alan Parra 31dbcc3471 Wire the Device Trust client into API/Auth clients (#18366)
Wire the Device Trust client into existing clients, a necessity for implementing
device-related commands.

A few user-friendly enum conversions are added as well, as these are useful to
write said commands.

gravitational/teleport.e#514
2022-11-16 20:38:32 +00:00