Commit Graph
99 Commits
Author SHA1 Message Date
Edoardo Spadolini 4cbbc0c583 Use UpsertWindowsDesktop for heartbeats (#23072) 2023-03-16 15:26:00 +00:00
rosstimothy 9d066364a8 Migrate GetCertAuthorities to gRPC (#22985)
Adds a new `GetCertAuthorities` unary RPC to
`teleport.v1.trust.TrustService` and deprecates the equivalent
HTTP endpoint. All associated interfaces have been updated to remove
the marshal options as well.
2023-03-14 14:45:01 +00:00
Tiago Silva 674a3a1ec1 Removes deprecated KindKubeService objects (#22663)
This PR removes the `types.KindKubeService` objects that were
deprecated in Teleport 11.

Teleport 12 removed the double heartbeat and for Teleport 13 we can
safely drop the support of the old hearbeat based on `types.Server`
objects.

Clients older than Teleport 12 connecting to a Teleport 13 server will
fail since they cannot heartbeat using the old mechanism.
2023-03-13 10:55:39 +00:00
rosstimothy 95d6d0fee1 Migrate GetCertAuthority to gRPC (#22624)
The HTTP client created by `auth.NewClient` has an idle timeout of
30s and each instance periodically gets cert authorities in
`TeleportProcess.syncRotationStateCycle`. If there has been no
activity when the ticker expires then the request will result in a
brand new connection to Auth to be established. This can cause a
spikes in open file descriptors on the Proxy when there are a large
number of instances connected via a tunnel.

To prevent periodic dialing when retrieving cert authorities the
endpoint has been migrated to the new Trust gRPC service. For now
only the get endpoint has been migrated but the rest of the CRUD
operations for cert authorities should be migrated from the HTTP
api to the gRPC service as well.
2023-03-10 14:32:34 +00:00
MichaelandJeff Pihach d94fed7b0d Add static and dynamic web ui configuration options (#21945)
* Add UiConfig option to proxy service config

* Add uiConfig to GRV_CONFIG window object and use in terminal constructor

* Update configuration reference docs

* Remove extra structs and change property to scrollbackLines

* Update web/packages/teleport/src/config.ts

Co-authored-by: Jeff Pihach <hatched@users.noreply.github.com>

* Use a common struct and apply in applyProxyConfig

* Remove webclient dependency for fileconf

* Add missing doc comments

* Set individual properties of cfg.Proxy.UI

* Remove unneeded comment

* Add nolint rule

* Fix nolint

* Add test for UIConfig

* Cleanup tests

* Fix TestUIConfig context

* Allow dynamic config for web ui (#22097)

* Update protofiles

---------

Co-authored-by: Jeff Pihach <hatched@users.noreply.github.com>
2023-02-28 17:45:52 +00:00
Michael Wilson 35e94ca5f1 Add missing methods into proxy access point. (#22413)
SAML IdP methods and the user group methods were not added into the proxy
access point interface after being added to the cache.
2023-02-28 17:32:22 +00:00
Michael Wilsonandrosstimothy 2249d1cc17 SAML IdP sessions added to the API and cache. (#21937)
* SAML IdP sessions added to the API and cache.

SAML IdP sessions have now been added to the API and to the cache.

* Update lib/auth/sessions.go

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

* Revert changes to types.proto.

* Fix missing session ID, misnamed variable, gRPC update.

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
2023-02-21 17:26:10 +00:00
Michael Wilsonandrosstimothy d619d303db Add SAML IdP service providers to the cache and CLI. (#21218)
* Add SAML IdP service providers to the cache and CLI.

SAML IdP service providers have been added to the cache and are now manageable
via the CLI. Some alterations to role permissions have occurred to ensure that
the system and users can manage these.

* Tiago's feedback.

* Update tool/tctl/common/collection.go

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

* Tim's feedback.

* Update lib/cache/collections.go

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

---------

Co-authored-by: rosstimothy <39066650+rosstimothy@users.noreply.github.com>
2023-02-08 17:01:10 +00:00
STeve (Xin) Huang 48fbd369ed Enable database fetchers for discovery service (#19739) 2023-01-13 14:03:06 +00:00
Marco André Dinis 69dc237fe2 DatabaseService resource: client and server CRUD (#19469)
* DatabaseService resource: client and server CRUD

In the context of Teleport Discover, we must be able to known if there's
any DatabaseService available to proxy a given Database resource.
If there's none available, we will offer a script for the user to run
and install a DatabaseService which proxies the desired Database
resource.

By DatabaseService, we mean the process that Teleport binary manages
when the `teleport.yaml` config has the following section:
```yaml
db_service:
  enabled: "yes"
```

To accomplish this we are creating a new resource: DatabaseService.
The UI will fetch all DatabaseServices and check if there's any
ResourceMatcher that matches the DatabaseLabels.

A previous PR created the DatabaseService resource.

This PR creates all the necessary CRUD operations:
- Add Service to manage DatabaseServices resources in the backend.
- Add GetAll, Upsert, Delete and DeleteAll operations to Client.
- Add DatabaseService support to ListResources.
- Add WebAPI endpoint to list DatabaseServices using ListResources.

The next PR will add the heartbeat mechanism to the DatabaseService
process.
2022-12-21 14:34:36 +01:00
Jakub Nyckowski 0ee91f6c37 Enable GCI linter (#17894) 2022-10-28 20:20:28 +00:00
Tiago Silva 249a4c5595 Adds Azure AKS auto-discovery (#16633)
This PR presents a watcher for automatic  `kube_cluster` discovery for Azure AKS clusters. Given a user with access to the Azure cloud, the auto-discovery service will scan the cloud and register all clusters available in AKS .

Once the discovery service creates a `kube_cluster` in Auth Server, the Kubernetes Service will start serving it. The credentials used to access the cluster depend on the different AKS clusters configurations:

# Authentication 
## Local Accounts

If the AKS cluster auth is based on local accounts created during the provisioning phase of the cluster, the agent will use the [`aks:ListClusterUserCredentials`](https://learn.microsoft.com/en-us/rest/api/aks/managed-clusters/list-cluster-user-credentials?tabs=HTTP) endpoint. 

This endpoint returns a `kubeconfig` fully populated with user credentials that Teleport can use to access the cluster.

## AZ Active Directory

When AZ active directory integration is enabled, Azure allows login with AD users. Azure forces the login to happen with dynamic short-lived user tokens. These tokens are generated by calling `credentials.GetToken` with a fixed Scope: `6dae42f8-4368-4678-94ff-3960e28e3630` and with the cluster's `tenant_id`. The token contains the user details as well as `group_ids` to match with authorization rules.

```go
// getAzureToken generates an authentication token for clusters with AD enabled.
func (a *aKSClient) getAzureToken(ctx context.Context, tentantID string, clientCfg *rest.Config) (time.Time, error) {
	const (
		azureManagedClusterScope = "6dae42f8-4368-4678-94ff-3960e28e3630"
	)
	cred, err := a.azIdentity(&azidentity.DefaultAzureCredentialOptions{
		TenantID: tentantID,
	})
	if err != nil {
		return time.Time{}, trace.Wrap(ConvertResponseError(err))
	}

	cliAccessToken, err := cred.GetToken(ctx, policy.TokenRequestOptions{
		// azureManagedClusterScope is a fixed scope that identifies azure AKS managed clusters.
		Scopes: []string{azureManagedClusterScope},
	},
	)
	if err != nil {
		return time.Time{}, trace.Wrap(ConvertResponseError(err))
	}
	// reset the old exec provider credentials
	clientCfg.ExecProvider = nil
	clientCfg.BearerToken = cliAccessToken.Token

	return cliAccessToken.ExpiresOn, nil
}
```

# Authorization

## Local Accounts
The [`aks:ListClusterUserCredentials`](https://learn.microsoft.com/en-us/rest/api/aks/managed-clusters/list-cluster-user-credentials?tabs=HTTP) endpoint returns credentials with enough permissions for Teleport to enroll the cluster.

## AZ AD 

### Azure RBAC

When Azure RBAC mode is enabled, the cluster authorization is based on rules specified in the Azure Identity permissions. 

The AZ group associated with the AZ identity the Teleport Process is running has to define the following permissions:

```json
{
    "Name": "AKS Teleport Discovery Permissions",
    "Description": "Required permissions for Teleport auto-discovery.",
    "Actions": [],
    "NotActions": [],
    "DataActions": [
      "Microsoft.ContainerService/managedClusters/pods/read",
      "Microsoft.ContainerService/managedClusters/users/impersonate/action",
      "Microsoft.ContainerService/managedClusters/groups/impersonate/action",
      "Microsoft.ContainerService/managedClusters/serviceaccounts/impersonate/action",
      "Microsoft.ContainerService/managedClusters/authorization.k8s.io/selfsubjectaccessreviews/write",
      "Microsoft.ContainerService/managedClusters/authorization.k8s.io/selfsubjectrulesreviews/write",
    ],
    "NotDataActions": [],
    "assignableScopes": [
        "/subscriptions/{subscription_id}"
    ]
}
```

If correctly specified, the Azure authentication service automatically grants access to any cluster within  `subscription_id` 
 without any other definition. On the other hand, if it's incorrectly configured, an error is triggered but Teleport cannot gain access to the cluster.


### Kubernetes RBAC

If AZ RBAC integration is disabled, the authorization to the cluster is processed by Kubernetes RBAC. This is done by matching the Az Identity principals (`group_ids`) with `Role`, `ClusterRole` objects that live in the AKS cluster.  This mode requires that the `ClusterRole` and `ClusterRoleBinding` must exist and must be well configured for each cluster to enroll.

```yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: teleport-role
rules:
- apiGroups:
  - ""
  resources:
  - users
  - groups
  - serviceaccounts
  verbs:
  - impersonate
- apiGroups:
  - ""
  resources:
  - pods
  verbs:
  - get
- apiGroups:
  - "authorization.k8s.io"
  resources:
  - selfsubjectaccessreviews
  - selfsubjectrulesreviews
  verbs:
  - create
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: teleport-role-binding
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: teleport-role
subjects:
- kind: Group
  name: {group_name}
  apiGroup: rbac.authorization.k8s.io
```

#### `ClusterRole` and `ClusterRoleBinding` configured

If cluster operators or previous Teleport run has configured access to the cluster, no further action is required since Teleport already has access to the cluster.

#### Cluster `aks:ListClusterAdminCredentials` returns valid credentials

If the Teleport process has access to [`aks:ListClusterAdminCredentials`](https://learn.microsoft.com/en-us/rest/api/aks/managed-clusters/list-cluster-admin-credentials?tabs=HTTP) and the endpoint returns valid cluster admin credentials, Teleport will automatically create the  `ClusterRole` and `ClusterRoleBinding` objects in the cluster configured to the `group_id` that is listed in the access token. In order to extract the `group_id` from the token, Teleport parses the JWT claims and extracts the first element.

If the object creation was successful, Teleport can access it, otherwise, it will use the `aks:BeginRunCommand` method to try to configure access to itself.

#### Cluster `aks:BeginRunCommand` returns valid credentials

When we reach this mode, Teleport tries to run a `kubectl` command against the cluster to configure the `ClusterRole` and `ClusterRoleBinding`. `aks:BeginRunCommand` allows any user with access to that endpoint to run arbitrary commands in the cluster (commands cannot be validated). Teleport will use it as the last resource to configure the access to itself.

If the command failed, Teleport cannot grant access to the cluster and an error is returned.

# UX

Currently, to discover AKS  resources created and to have them dynamically served by the `kubernetes_service`one can define the following configuration.

```yaml
discovery_service:
   enabled: true
  azure:
  - subscriptions: ["*"]
    types: ["aks"]
    regions: ["*"]
    tags:
      '*': '*'

kubernetes_service:
   enabled: true

   resources:
       labels:
           '*': '*'
```

# Future work
- Support AWS dynamic authentication

Part of #16135, #13376  
Related to  #12048, #16276, #16281
2022-10-11 21:37:50 +00:00
Lisa Kim 8bb0636863 Partial delete deprecated code for "DELETE IN 11.0.0" and lower (#16947)
* Deleted 
   - GetAppServers
   - GetApplicationServers 
   - GetDatabaseServers 
   - GetKubeService 
   - UpsertAppServer
   - DeleteAppServer
   - DeleteAllAppServers
   - RotateUserTokenSecrets
* Delete list nodes fallback
* Use AppServer type for heartbeat test
2022-10-04 17:58:30 +00:00
Ryan Clark 9f9461d5f0 Add labels to Windows Desktop Service, add endpoint for searching them (#16436) 2022-09-23 22:08:04 +00:00
Alex McGrath e2fab63ba9 Introduce discovery_service and automatically run an SSM Document on discovered EC2 nodes (#14094)
* Add initial version of installer

* Resolve comments

- Use aws waiters when checking commands
- Use SSMRunRequest rather than passing instances
- General comments

* Resolve comments, (rebase) pass scriptname parameter

This resolves comments regarding running on multiple ec2 instances at
once by adding state to the instances cache to check if the instance
is known about and how far into installation it is

* Revert cache

* Dont cache on non discovery nodes

* Resolve some comments

* Move discovery out to its own serviec

* Add a `discovery_service` section

* Fix messed up conflict merge

* Make starting a standalone discovery agent work

* Resolve comments

* Resolve comments

- use a regular events.Emitter
- resolve a thousand typos :)

* Resolve comments

* resolve comments, fix a bad merge

* Fail when a non ec2 matcher type is configured

* fix lint-go

* Resolve comments

* Resolve comments, add initial test (currently broken)

* Fix log string so only 1 pair of [] are used

* Chunk instances for sending commands

* add 'isInitialized' to watchers

* Add test for chunked discovery, log output

* lints

* explicetly set matcher.Tags to "*":"*" if its unset
2022-09-21 12:23:06 +00:00
Tiago Silva 24f6957639 Support for dynamic kube_cluster resources (#16276)
This PR introduces Auth Server CRUD API for managing the lifecycle of dynamic `kube_cluster` resources.

Currently, `kube_cluster` resources cannot be manipulated without using the API, nor are they being listened to. It will be part of future developments.

# Future work
- The `kubernetes_service` will have to watch these `kube_cluster` resources.
- The discovery service will have to create these resources. 

Resource manipulation via `tctl` will be introduced later and is not part of the scope.

Part of #16135, #13376  
Related to  #12048
2022-09-16 14:15:29 +00:00
Marco André Dinis c219962ccc ConnectionDiagnostics: SSH Tester (#15413)
This PR implements the SSH Tester for ConnectionDiagnostic feature.
This feature is also known as Test Connection, part of Teleport
Discover.

The goal here is to provide immediante feedback about a newly added
resource. Can the user connect to it?

We are targetting SSH Nodes as a first ResourceKind.

To test the access to an SSH Node we require the ResourceName and a
login username (ssh principal).

Then a series of checks will occur in two places:
- SSH client in the Web server
- SSH server in the SSH agent

The ssh client creates a new Connection Diagnostic with some initial
state.
Then it tries to build up the necessary SSH config
This already gives us a couple of things to check for:
- does the node exist and does the current user (inherited from
  websession) can access it?
- is the node accepting TCP connections (in the specific port)?
- is the node accepting SSH protocol on top of the TCP connection?

Then, the ConnectionDiagnosticID is inject into the certificate and the
SSH Server receives it and will also Append traces into it:
- is the requested principal allowed for the current user?
- does the requested principal exist in the target node?

This is not an exhaustive list of checks.
For a complete list of which checks are verified please see the
TestDiagnoseSSHConnection test.

After all those checks, it returns if the Connection was successful and
what all of the traces generated along the way.


Demo:
![image](https://user-images.githubusercontent.com/689271/187976940-55522fd9-f581-4c6d-9bfc-f6e501c1ed72.png)

![image](https://user-images.githubusercontent.com/689271/187976957-35075112-2b42-4726-8d50-19d02fab2464.png)

![image](https://user-images.githubusercontent.com/689271/187976967-81406e2c-0517-474b-b323-dad1f8be1571.png)
2022-09-02 08:17:21 +00:00
Alex McGrath 6bf2f18435 Allow for multiple installer scripts instead of a singleton (#15682)
* Allow for multiple installer scripts instead of using a singleton

* Resolve comments

- require name be provided to installer
- MetaNameClusterInstallerScript -> defaults.InstallerScriptName
- Require VerbList for GetInstallers

* Resolve comments

- Include the default installer in GetInstallers output
- Update how the scripts are prefixed

* resolve conflicts

* make the linters happy
2022-08-30 17:23:57 +00:00
Alex McGrath f56dd09ebd Add an installer script resource type and public HTTP endpoint (#13146)
* Add an installer script resource type and HTTP endpoint

* Add default installer scripts

* Resolve comments

- run `shfmt` over the installer script
- add MustNewInstaller
- move default installer logic to GetInstaller
- only include PublicProxyAddr in server.Config

* Resolve comments

- move from auth_with_roles -> auth/grpcserver
- document `MustNewInstallerV1`
2022-08-15 10:27:33 +00:00
Tiago Silva 037daad083 Introduce dedicated server type for Kubernetes resources (#14389)
## What

First part of the Kubernetes [Discovery RFD](https://github.com/gravitational/teleport/pull/13376/) to introduce a Kubernetes server per cluster. 

This PR introduces a separate Kubernetes server that uses the already introduced `KubernetesClusterV3`. 

## Compatibility

In previous versions, Kubernetes Clusters were part of regular `ServerV2` resource and this refactoring deprecates the `ServerV2` usage but keeps them for compatibility with previous version.

Everything is backward compatible, so v10 kubernetes agents and trusted clusters can connect fine.

## Next steps

Once this is merged, a new PR will introduce dynamic registration for Kubernetes Clusters discovered through EKS Discovery.
2022-08-04 14:21:11 +00:00
Bernard Kim 26e3df82b5 Display license out of compliance warnings (#14114) 2022-07-26 19:31:50 -07:00
Jakub NyckowskiandMarek Smoliński 9c046930ff Snowflake integration (#12564)
Add Snowflake integration.

Co-authored-by: Marek Smoliński <marek@goteleport.com>
2022-06-06 17:49:38 +00:00
Brian Joerger 0431c0f0fb Remove deprecated node http endpoints (#12970) 2022-06-03 18:15:49 +00:00
Noah Stride a7f9030104 Remove deprecated Auth HTTP Tokens endpoints (#12844)
* delete deprecated tokens endpoints in auth http api

* remove marshal opts from GetTokens
2022-05-25 15:25:31 +00:00
rosstimothy 2c226600a7 Add context.Context to GetReverseTunnels (#12373)
The RemoteClusterTunnelManager was hanging on the call to
GetReverseTunnels because it did not take a context and thus did
not respect cancellation. During certain shutdown/restart scenarios
the auth server may not respond, which causes Sync to never return
and subsequently prevents Run from ever completing.

By requiring a context to be passed to GetReverseTunnels, we can
remove the hard coded context.TODO that was being sent to the
http client and fully respect cancellation.
2022-05-03 19:18:55 +00:00
rosstimothy 550d23d15d Fix goroutine and memory leak in watchCertAuthorities (#10871)
* Fix goroutine and memory leak in watchCertAuthorities

The CA Watcher was blocking both on writing to a channel when the watcher
was closed and on HTTP calls that had no request timeout or context passed
to cause cancellation.

All resourceWatcher implementations that had a bug which may cause them to block
on writing to a channel forever were fixed by selecting on the write and ctx.Done.

Adding context.Context to all Get/Put/Post/Delete methods on the auth HTTPClient to
force callers to propagate context. Prior all calls used context.TODO which
prevents requests from being properly cancelled.

Add context propagation to RotateCertAuthority, RotateExternalCertAuthority,
GetCertAuthority, GetCertAuthorities. This is needed to get the correct ctx
from the CertAtuhorityWatcher all the way down to the HTTPClient that makes
the call.

Closes #10648
2022-03-10 11:05:39 -05:00
Lisa Kim 632d851783 Add KindWindowsDesktops to ListResources (#10769)
* Also add windows desktops sorter and its type converters
* Use forked vulcand/predicate library: allows traversing
  by embedded fields

Part of RFD 55
2022-03-07 08:58:26 -08:00
Lisa Kim e7eb6c4af8 Return filtered total count with ListResources (#10573)
* The web UI needed to show the total count of resources available after filter
* ListResources response returns as a struct to make adding extra fields easier
2022-02-28 21:51:19 +00:00
Alex McGrathandZac Bergquist 611c05106f Add support for windows desktop services proxying different desktops (#10101)
* Add support for windows desktop services proxying different desktops

* Add filter to GetWindowsDesktops, remove GetWindowsDesktop and GetWindowsDesktopByName

* Cache cleanup

* Fix cache deletes for Windows desktops

For deletes, the cache only gets the backend key, not the entire
resource. Do what database access does, which is to extract the
host ID from the path, and stuff it in the description field of
the resource header.

* Godoc cleanup

* Fix lint

* Address review comments

* Send error message if no desktop found

* Revert to x/net/websocket

This got converted to gorilla/websocket as part of moderated sessions.
We'll do a more intentional conversion post-release.

* fix lint

Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>
2022-02-18 00:01:08 +00:00
Carson Anderson cc1e13154c Add keepalive heartbeat to kubernetes service (#9584)
This adds an rpc UpsertKubeServiceV2 to replace UpsertKubeService. Currently, kubernetes service does not have a keepalive heartbeat unlike app, db, and windows service. This brings functionality in line with the others. This would allow for future use of the keepalive to track connected agents via prometheus metrics.
2022-02-10 14:54:03 -07:00
Gabriel Corado e426b782a9 feat: add KubeService and Node to ListResources (#9613) 2022-01-25 15:48:13 +00:00
Gabriel Corado 5f403562ab feat: ListResources gRPC rpc (#9096) 2021-12-15 18:09:21 +00:00
rosstimothy 5cd7c3c294 Split auth.AccessPoint into variant specific interfaces (#8471) 2021-11-04 09:42:14 -04:00
Forrest Marshall 19c5768873 server-side filtering 2021-10-22 16:42:33 -07:00
Andrew Lytvynov 726e70de7d TDP: add mouse scroll support 2021-10-07 14:33:34 -07:00
Andrew Lytvynov 813dff20c1 PIV authentication for RDP (#8408)
* PIV authentication for RDP

This uncomfortably large change fully implements smartcard PIV
authentication for RDP clients using the Teleport CA:
- PIV applet implementation in emulated RDP smartcard
- generating Windows-compatible certificates using Teleport CA with a
  dedicated RPC
- generating dummy CRLs for Teleport CA and publishing it via LDAP

The CRLs are required by Windows for any smartcard login certificate, we
can't avoid that. But we can avoid making it public: the CRL can live in
ActiveDirectory instead of a public endpoint of a Teleport service.
Here, we use LDAP to publish the CRL on startup, valid for a year.

There are a few unhandled cases in the current implementation:
- LDAP server certificate is not validated when upgrading to TLS
- multiple active CAs (with HSMs) are not supported, only one CRL is
  published
- CA rotation is not supported, CRL is not re-published on rotation

All of the above issues will be handled in future PRs as this one is
already too large.

* Address review feedback

* Fix linter errors
2021-10-01 15:01:17 -07:00
Andrej Tokarčík bddc54d8c4 Remove ClusterConfig resource (#8150) 2021-09-23 13:56:35 -07:00
Roman Tkachenko 6502a12f1f Add API and CLI for managing application resources (#8185) 2021-09-20 08:44:13 -07:00
Roman Tkachenko 4ea2ecdcfc Introduce app server and app resources (#8140) 2021-09-09 14:19:02 -07:00
Roman Tkachenko 3410bc8594 Dynamically register/unregister database resources (#7957) 2021-09-01 15:27:02 -07:00
Andrew Lytvynov 5b090f8633 Connect proxy <-> windows_desktop_service <-> RDP server (#7990)
* Connect proxy <-> windows_desktop_service <-> RDP server

Link together the proxy (websocket), service (mTPS) and RDP client. Pass
target desktop UUID via SNI on the TLS connection from the proxy.

* Use client CAs to validate incoming desktop_service connections

* Send binary frames on desktop websocket
2021-08-30 11:22:39 -07:00
Andrew Lytvynov f2cda7b3ee Split UpsertWindowsDesktop into Create/Update 2021-08-18 18:44:41 +00:00
Andrew Lytvynov e9351457ba Address review comments, batch 1 2021-08-18 18:44:41 +00:00
Andrew Lytvynov ab062428b1 Windows desktop service boilerplate
Boilerplate for a new service and API objects:
- windows_desktop_service config section
- service registration and heartbeats
- static host registration and heartbeats
- caching, permissions, etc
- "tctl get" support

For new connections the service aborts after authentication, since the
RDP client implementation is not ready yet (pending in
https://github.com/gravitational/teleport/pull/7824).

Tested that the service starts, registers (both over a tunnel and
directly) and creates the API objects.
2021-08-18 18:44:41 +00:00
Andrej Tokarčík a649db6746 Re-add GetLock methods for auth server cache (#7861) 2021-08-11 12:02:53 -07:00
Brian Joerger 9b8b9d6d0c rollback - Upgrade api version. (#7751) 2021-07-30 15:34:19 -07:00
Brian Joerger c040aca4c1 Upgrade api version. (#7609) 2021-07-28 13:51:21 -07:00
Andrej Tokarčík 006c149001 Remove GetLock methods from Cache/ReadAccessPoint (#7593)
The cache system does not provide freshness guarantees required
for proper lock propagation.
2021-07-21 12:51:23 +02:00
Eugene Yakubovich 67c0eb3b4c Add restricted session
Adds the ability to block network traffic on SSH sessions.
The deny/allow lists of IPs are specified in teleport.yaml file.
Supports both IPv4 and IPv6 communication.

This feature currently relies on enhanced recording for
cgroup management so that needs to be enabled as well.

-- Design rationale:
This patch uses Linux Security Module (LSM) hooks, specifically
security_socket_connect and security_socket_sendmsg, to control
egress traffic. The LSM provides two advantages over socket filtering
program types.
- It's executed early enough that the task information is available.
  This makes it easy to report PID, COMM, etc.
- It becomes a model for extending restrictions beyond networking.

The set of enforced cgroups is stored in a BPF hash map and the
deny/allow lists are stored in BPF trie maps. An IP address is
first checked against the allow list. If found, it's checked for
an override in the deny list. The policy is default deny. However,
the absence of the NetworkRestrictions API object is allow all.

IPv4 addresses are additionally registered in IPv6 trie (as mapped)
to account for dual stacks. However it is unclear if this is sufficient
as 4-to-6 transition methods utilize a multitude of translation and
tunneling methods.
2021-07-16 16:49:04 -07:00
Andrej Tokarčík 7c630ec960 Introduce Lock resource (#7430) 2021-07-07 18:20:53 +02:00