Commit Graph
793 Commits
Author SHA1 Message Date
Trent Clarke d933fe03ea Adds WebClientTimeout to config (#7497)
Adds `web_client_timeout` to the Teleport config file and exposes it via
the Cluster Network Settings.

See-Also: #6092
2021-07-21 10:40:05 +10:00
Nic Klaassen e51bb8b1b4 Fall back to old CA schema when retrieving keys and certs (#7603) 2021-07-20 16:36:54 -07:00
Trent Clarke 5ffa4b4829 Adds Message of the Day (#7396)
Adds a configurable MotD to the auth service. If a message is set, any
attempt to login into a cluster via `tsh` will display that message and
not begin to log the user in until that message is acknowledged.
2021-07-20 10:48:00 +10: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
Brian Joerger a0f9729c12 ListNodes limit exceeded test timeout fix (#7464) 2021-07-15 19:11:26 -07:00
Russell Jones 45f8954c5b Fixed vendoring issue. 2021-07-14 14:41:34 -07:00
Joel 98d51c529d Implement an API for exporting session events (#7360) 2021-07-14 01:29:00 +02:00
Joel 01dd8068aa Allow querying for audit events in either an ascending or descending order (#7425) 2021-07-12 13:14:05 +02:00
Andrej Tokarčík 3f041daa69 Generalize ProxyWatcher to monitor other resources (#7489) 2021-07-09 14:49:14 +02:00
Russell Jones 29c390f1fc Release 7.0.0-beta.1. 2021-07-08 14:56:08 -07:00
Andrej Tokarčík b3aba1aed8 Disable nonlocal SetClusterAuditConfig calls (#7465) 2021-07-07 18:49:31 +02:00
Andrej Tokarčík 7c630ec960 Introduce Lock resource (#7430) 2021-07-07 18:20:53 +02:00
Brian Joerger 20a734ec5d Paginated rpcs - Replace GetNodes with ListNodes (#7415) 2021-07-01 14:03:23 -07:00
Brian Joerger 4162452be8 Update API RFD. (#6764) 2021-06-30 11:41:56 -07:00
Trent Clarke ca1e47bef0 Adds custom timeout message to SSH sessions (#7120)
* Adds the idle_timeout_message to the auth_service config file block
* Plumbs the value through to the session monitor
* Writes the message to stderr when a session times out due to inactivity
* Adds some machinery to the test helpers to configure appropriate tests

See-Also: #6091
2021-06-25 14:12:50 +10:00
Roman Tkachenko b42bec61c1 Parse AWS info from RDS/Redshift endpoint (#7385) 2021-06-23 12:41:54 -07:00
Roman Tkachenko 6b9726f961 Add MongoDB database access support (#7213) 2021-06-21 22:54:05 -07:00
Andrej Tokarčík 10a43dbf30 Relax ClusterName validation to allow ClusterID migration (#7363) 2021-06-21 17:09:30 +02:00
Brian Joerger bd07d7be20 CheckAndSetDefaults sets all defaults. (#6846) 2021-06-18 12:57:29 -07:00
Brian Joerger a3aab985cd API version generated file (#7157) 2021-06-18 13:52:55 -05:00
Brian Joerger 24063e65f0 Remove SetTTL methods in favor of SetExpiry. (#7234) 2021-06-18 13:35:02 -05:00
Brian Joerger 917df5ad02 gRPC conversions - Auth Preference (#7220) 2021-06-18 12:30:56 -05:00
Andrej Tokarčík d63d144e8e Move ClusterID field from ClusterConfig to ClusterName (#7050) 2021-06-18 18:42:09 +02:00
Andrew Lytvynov d4247cb150 hsm: migrate CA storage schema (#7245)
* hsm: migrate CA storage schema

Migrate types.CertAuthorityV2 schema according to
https://github.com/gravitational/teleport/blob/master/rfd/0025-hsm.md#backend-storage

Includes proto changes, types.CertAuthority wrapper changes and data
migration.

Note that we keep and update the old fields for backwards-compatibility.
If a cluster is upgraded to v7 and then downgraded back to v6,
everything should keep working.

* Address review feedback
2021-06-16 12:17:03 -05:00
Roman Tkachenko 0ac7334939 Better handle database access HA scenario (#7293) 2021-06-15 13:35:49 -05:00
Joel 42beccb27e Add gRPC conversion support for BillingCard events (#7303) 2021-06-15 19:42:22 +02:00
Andrej Tokarčík 3d22eaac0e Turn AuditConfig into a standalone resource (#6997) 2021-06-14 15:49:22 -05:00
Nic Klaassen 109fa7443d Add V4 Roles (#7118) 2021-06-10 11:52:10 -07:00
Brian Joerger 4d36870ff0 Remove remaining API aliases (#7137) 2021-06-08 12:08:55 -07:00
Andrej Tokarčík 9410346b8d Make SessionRecordingConfig resource dynamically configurable (#7054) 2021-06-08 08:30:44 -07:00
Brian Joerger a6ed4d3d22 Update profile credential loader to work with tsh v6.0. (#7142) 2021-06-07 18:01:12 -07:00
Andrej Tokarčík 2747cc75bf Move ClusterConfig auth fields into ClusterAuthPreference (#6876) 2021-06-07 11:07:02 -07:00
Brian Joerger 7bff7c41bd Remove API aliases (#6983) 2021-06-04 13:29:31 -07:00
Andrej Tokarčík 3ca21aca9a Make ClusterNetworkingConfig resource dynamically configurable (#7013) 2021-06-04 19:42:50 +02:00
Andrej Tokarčík 833da36de9 Emit backward compatible ClusterConfig events (#6836) 2021-06-04 18:10:40 +02:00
Brian Joerger d3e0a24239 Expand client tests with mock server (#7004) 2021-06-03 18:21:31 -07:00
jane quin 5c78f1f756 Improve Access Request Events (#6863) 2021-06-03 14:28:38 -07:00
Andrew Lytvynov cd2f4fceb7 Remove JSON schema validation (#6685)
* Remove JSON schema validation

Removing JSON schema validation from all resource unmarshalers.

--- what JSON schema gets us

Looking at the JSON schema spec and our usage, here are the supposed benefits:
- type validation - make sure incoming data uses the right types for the right fields
- required fields - make sure that mandatory fields are set
- defaulting - set defaults for fields
- documentation - schema definition for our API objects

Note that it does _not_ do:
- fail on unknown fields in data
- fail on a required field with an empty value

--- what replaces it

Based on the above, it may seem like JSON schema provides value.
But it's not the case, let's break it down one by one:
- type validation - unmarshaling JSON into a typed Go struct does this
- required fields - only checks that the field was provided, doesn't actually check that a value is set (e.g. `"name": ""` will pass the `required` check)
  - so it's pretty useless for any real validation
  - and we already have a separate place for proper validation - `CheckAndSetDefaults` methods
- defaulting - done in `CheckAndSetDefaults` methods
  - `Version` is the only annoying field, had to add it in a bunch of objects
- documentation - protobuf definitions are the source of truth for our API schema

--- the benefits

- performance - schema validation does a few rounds of `json.Marshal/Unmarshal` in addition to actual validation; now we simply skip all that
- maintenance - no need to keep protobuf and JSON schema definitions in sync anymore
- creating new API objects - one error-prone step removed
- (future) fewer dependencies - we can _almost_ remove the Go libraries for schema validation (one transient dependency keeping them around)

* Remove services.SkipValidation

No more JSON schema validation so this option is a noop.
2021-06-01 15:27:20 -07:00
Eugene Yakubovich 585c33232b Move from BCC to libbpf with CO-RE. 2021-05-28 15:25:23 -07:00
Brian Joerger 5fbffaab80 keypaths package (#6848) 2021-05-27 10:31:05 -07:00
Andrej Tokarčík 555695dfdd Introduce SessionRecordingConfig extracting fields from ClusterConfig (#6708) 2021-05-19 12:01:37 -07:00
Andrej Tokarčík 66ff76c94f Add tctl rm cap for resetting cluster auth preference to defaults (#6801) 2021-05-19 18:29:38 +02:00
Andrew Lytvynov d3e1be2064 make update-vendor: run 'go mod tidy' in api/ 2021-05-18 21:56:02 +00:00
Andrej Tokarčík 60f7692353 Add CheckAndSetDefaults call to UnmarshalAuthPreference (#6898) 2021-05-18 12:23:10 -07:00
Joel b68c519b4c Implement RFD 19: Event Iteration API (#6731) 2021-05-18 16:46:01 +02:00
jane quin aee7523535 Add session_recording field to session start and end event (#6664) 2021-05-13 18:55:25 -07:00
Andrew Lytvynov 84a7230e6e Move CheckAndSetDefaults definition to types.Resource (#6825)
All resources should implement it, reduce some code duplication in
interfaces.
2021-05-13 14:02:56 -07:00
Andrew Lytvynov e987caa292 client: set TLS certificate usage for k8s/app/db certs (#6824)
* client: set TLS certificate usage for k8s/app/db certs

--- TLS usage field

The certificate usage field prevents a certificate from being used for
other purposes. For example, a k8s-specific certificate will not be
accepted by a database service endpoint.

Server-side enforcement logic was already in place for a long time, but
we stopped setting the correct Usage in UserCertRequest during keystore
refactoring in 5.0 (with introduction of k8s certs).

--- TLS certificate overwrite

As part of this, client.ReissueUserCerts will no longer write
usage-restricted certificates into the top-level TLS certificate used
for Teleport API authentication.

For example, when generating a k8s-specific certificate, we used to
overwrite both:
- `~/.tsh/keys/$proxy/$user-x509.pem`
- `~/.tsh/keys/$proxy/$user-kube/$cluster/$kubeCluster-x509.pem`
This PR stops overwriting `~/.tsh/keys/$proxy/$user-x509.pem`.
This is not a breaking change.

--- Selected k8s cluster

Prior to this PR, `tsh status` printed the selected k8s cluster based on
the top-level TLS certificate. Since we no longer overwrite that
certificate, it will not contain a k8s cluster name.

Instead, we extract it from the kubeconfig, which is actually more
accurate since a user could switch to a different context out-of-band.

* Document UserCertRequest CertUsage enum values
2021-05-13 10:26:12 -07:00
Andrej Tokarčík ad00c6c789 Introduce ClusterNetworkingConfig extracting fields from ClusterConfig (#6638) 2021-05-07 13:54:08 +02:00
Brian Joerger f3a03e4391 Add GetNode endpoint. (#6539) 2021-05-06 18:22:41 -07:00