Commit graph

2551 commits

Author SHA1 Message Date
Andrew Lytvynov d23fdcb71e client: load all SSH certs when connecting to proxy
`tc.SiteName` does not necessarily point to the cluster we're connecting
to (or that we have certs for). For example `tsh login leaf` will set
`tc.SiteName` as `"leaf"` even though we're connecting to root proxy to
fetch leaf certs.
2021-04-08 16:48:03 +00:00
Forrest Marshall e118629367 improve cert rotation periodics
* Eliminates spurious leaf cluster CA writes.
* Adds jitters to various periodic operations.
2021-04-07 15:49:27 -07:00
Joel Wejdenstål 28c7163e13
Always set an AuditLog (#6326) 2021-04-07 11:47:02 +02:00
Brian Joerger c396cb8a5d
Propogate user not found error from authenticater. (#6304) 2021-04-06 18:33:38 -07:00
Andrew Lytvynov 1e7a369b26
web: fix AccessRequest loading on user cert reissue (#6264)
Load access requests from SSH cert instead of the profile. The profile
only exists on CLI clients, but not in the proxy.

Note: theoretically, SSH cert may be missing in some cases for CLI
clients. We should eventually encode access requests in TLS certs too,
which are always present.
2021-04-06 16:20:04 -07:00
xacrimon 3d663ab2e8 add fix 2021-04-02 18:30:44 -07:00
Brian Joerger 8ecbefb122
Close leaky direct client. (#6297) 2021-04-02 14:04:54 -07:00
Andrew Lytvynov 6d200faecb
tsh: handle missing cluster name in profile (#6257)
Cluster name can be missing in profiles created by older tsh versions.
Trying to load the client.Key without a cluster name now causes a
failure when using WithAllCerts (because ssh/db/kube certs are
per-cluster).

Also added some output to `tsh status` when no profiles can be loaded.
2021-04-02 11:00:15 -07:00
Andrej Tokarčík 4fde837c59
Don't use OpaqueAccessDenied with CheckAccessToRule (#6246)
* Don't use OpaqueAccessDenied with CheckAccessToRule

* Fix tls_test

Co-authored-by: Andrew Lytvynov <andrew@goteleport.com>
2021-04-01 10:57:14 -07:00
Andrej Tokarčík e525c94e1c
Delete obsolete stored keys in LocalKeyAgent.AddKey (#6251)
* Delete obsolete stored keys in LocalKeyAgent.AddKey

* Don't panic when no stored key found
2021-04-01 09:53:15 -07:00
Pierre Beaucamp 1e18bcb76e
Fix regression bug for DynamoDB scaling policy names (#6259) 2021-04-01 07:47:19 -07:00
Alexander Klizhentas 4fbb2ba3a7
Adds encrypted token docs (#6266) (#6269)
Fixes #5996

Adds section on encrypted SAML tokens. Fixes a couple of typos
and missing schema.

Because schema was missing, the connector did not work.
2021-03-31 18:55:20 -07:00
Andrew Lytvynov 7be86582de Parse all CAs in CertPoolFromCertAuthorities
Returning certPool prematurely omits all but the first CA cert.
2021-03-31 17:44:48 +00:00
Brian Joerger 826ed676fa Refactor ssh.ClientConfig used by tctl and API clients to use the first valid principal as User. 2021-03-30 17:53:29 -07:00
Andrew Lytvynov fffe215570
ssh: fix relogin with jumphosts (#6213)
* ssh: fix relogin with jumphosts

Several fixes to make `tsh ssh -J leaf.proxy.com` work if the root cert
is missing/expired.

* Address review feedback

Correctly parse trusted CAs on GetKey.
Move retry without jumphosts from relogin to UpdateClusterCAs.

* Remove TelpoertClient.AuthMethods override on relogin

It doesn't seem to break anything.
2021-03-30 14:50:07 -07:00
Brian Joerger ee57e539b5
tsh Profile SSH certs fix (#6214) 2021-03-30 12:10:52 -07:00
Andrew Lytvynov f1f02bda04 mfa: fix gRPC unimplemented check in cert reissue
Our gRPC client is wrapped and converts gRPC status codes into trace
errors. It also doesn't preserve the original gRPC error internally.
2021-03-30 18:36:36 +00:00
xacrimon 3f9f33408d add PAM environment with interpolation support 2021-03-30 18:23:38 +02:00
Andrej Tokarčík 52dfeec63e
Cache per-cluster SSH certificates under ~/.tsh (#5938)
```diff
 ~/.tsh/
 └── keys
    ├── one.example.com            --> Proxy hostname
    │   ├── certs.pem              --> TLS CA certs for the Teleport CA
    │   ├── foo                    --> RSA Private Key for user "foo"
    │   ├── foo.pub                --> Public Key
-   │   ├── foo-cert.pub           --> SSH certificate for proxies and nodes
    │   ├── foo-x509.pem           --> TLS client certificate for Auth Server
+   │   ├── foo-ssh                --> SSH certs for user "foo"
+   │   │   ├── root-cert.pub      --> SSH cert for Teleport cluster "root"
+   │   │   └── leaf-cert.pub      --> SSH cert for Teleport cluster "leaf"
```

When `-J` is provided, this also loads/reissues the SSH cert for the cluster associated with the jumphost's certificate. Fixes #5637.
2021-03-29 14:14:31 -07:00
Forrest Marshall 7d4c1ea6cf add special resource type for access plugin data 2021-03-29 13:30:48 -07:00
Pierre Beaucamp 879f8c2b48
Enable DynamoDB autoscaling on global secondary indices (#6112)
Fixes #5632
2021-03-29 10:35:53 -07:00
Andrew Lytvynov 7ca8d29028 kube: add kubernetes_labels to role JSON schema
The schema entry for `kubernetes_labels` was missing, causing them to be
stripped on `tctl create role.yaml`.
2021-03-29 16:26:33 +00:00
Andrew Lytvynov 6479fa8f05 mfa: send username instead of SSH login name in MFA cert request
Username is the teleport username (either from SSO or for local user).
SSH login name is one of the OS logins allowed for the user.

In a user cert request, Username means the former, not the latter.
2021-03-29 16:03:39 +00:00
xacrimon cb33b75941 fix nil slice bug 2021-03-29 17:01:43 +02:00
Brian Joerger f15ceee373
Convert Token CRUD endpoints to gRPC. (#6105) 2021-03-26 19:23:20 -07:00
Brian Joerger c7d84c45d7
Convert Trusted Cluster CRUD endpoints to gRPC. (#6103) 2021-03-26 18:29:39 -07:00
a-palchikov d301da5a39
Embed webassets natively into teleport instead of attaching to the binary (#5935)
Switch to go1.16. Use embed package to embed webassets instead of ad-hoc attaching to binary
2021-03-26 17:37:52 -07:00
Brian Joerger b1bb78a9e0
gRPC conversions - GithubConnector (#6101) 2021-03-26 17:16:49 -07:00
Russell Jones f44523ad18
Test PR. (#6182)
* fix race in filelog

* Fixed data race in Audit Log.

Fixed data race in Audit Log where Close and EmitAuditEvent race during
tests. Use a RWMutex to protect the local log to prevent race.

Co-authored-by: Forrest Marshall <forrest@gravitational.com>
2021-03-26 17:00:53 -07:00
Brian Joerger 0076893155
gRPC conversions - SAMLConnector (#6100) 2021-03-26 16:39:27 -07:00
Brian Joerger 06d252ffca
gRPC conversions - OIDCConnector (#6067) 2021-03-26 15:52:16 -07:00
Forrest Marshall bc2203673d ignore dangling tunnel conns 2021-03-26 14:11:02 -07:00
Brian Joerger 3d6ecb05cd
Remove duplicate sshutils package from merge failure. (#6165) 2021-03-25 19:33:24 -07:00
Brian Joerger c891bae327
Combine common crud proto messages into generic messages in types.proto. (#6058) 2021-03-25 14:25:37 -07:00
jane quin ceebd8fc7d
Allow file argument with tsh play (#5984)
* allow tsh play to take file as arg

* get file paths from writer

* remove comment

* PR feedback

* comments

* PR feedback

* update WriteForPlayback comment

* create temp dir

* remove comments
2021-03-25 13:03:42 -07:00
Lisa Kim 940c83c161
Make SSO login failure event emit more specific errors (#6108)
Purpose is to allow users with admin privilege that are able to view audit logs, 
to be able to debug SSO login failures from the UI as much as possible

* Return generic error message for sso console login failures to hide
  sensitive data from reaching client. Previously errors were returning as
  empty messages b/c of a trace bug.
* Remove emit event for createOIDCClient to allow outer caller to
  emit event and prevent double emits on error.
* Temporarily direct users to check teleports log on errors that come back 
  empty to tsh client.
2021-03-25 10:36:47 -07:00
Andrew Lytvynov 58fc852d82
mfa: per-session U2F challenge for web SSH (#6098)
Check whether MFA is required for the current session and send a
challenge over the websocket.

client.IssueUserCertsWithMFA had to be modified to inject proxy's
cached user certs and websocket-based U2F prompt.
2021-03-25 09:29:08 -07:00
Brian Joerger 31ee2a4c04
Move usage of predicate package out of api. (#6136) 2021-03-24 18:48:07 -07:00
Lisa Kim b0dba9bc00
Set suggested reviewers field to the UI user context struct (#5467) 2021-03-24 16:46:24 -07:00
Forrest Marshall 59d2379b94 custom approval conditions 2021-03-24 14:33:40 -07:00
Andrew Lytvynov 598e287171
mfa: don't check MFA for teleport services in UpsertKubeService (#6129) 2021-03-24 13:11:09 -07:00
tcsc 740d184d1c
Skip enumerating keys when cluster name is empty (#5942)
Addresses Issue #5774

Prior to this change key enumeration could fail with an error if the cluster value in the `tsh` config was missing, which is possible when a post-v6.0 `tsh` reads a ~/.tsh directory created by a pre-v6.0 `tsh`. This would ultimately cause the key enumeration code to search the wrong directory for keys, resulting in an attempt to read a directory as a key file, and failing.

This patch adds detection for an empty cluster name, and gracefully aborts the key enumeration without error if found.
2021-03-24 13:02:00 +11:00
Brian Joerger 4398797f14
Pass context through new gRPC converted endpoints. (#6118) 2021-03-23 18:26:52 -07:00
Lisa Kim 84a4f00114
Define cloud billing event types and codes (#6037)
* Exported auth.clientImpersonator and auth.clientUsername for use in e
2021-03-23 17:23:01 -07:00
Brian Joerger 32c4ae255f
Add Credential loader support for tsh profiles. (#5993) 2021-03-23 16:35:42 -07:00
Andrew Lytvynov 8492f62d43
u2f: add optional attestation cert validation (#6057)
By specifying `device_attestation_cas` in `teleport.yaml`, admins can
restrict U2F device manufacturers. For example, specifying the yubico
attestation CA
(https://developers.yubico.com/U2F/yubico-u2f-ca-certs.txt), you can
restrict users to only yubikeys.

Example error when using the yubico CA and trying to register a Google
Titan key:

```
$ tsh mfa add --type u2f --name test && tsh mfa rm test
Tap any *registered* security key
Tap your *new* security key
ERROR: rpc error: code = InvalidArgument desc = U2F device attestation certificate is signed by "CN=Security Key,O=Google", but this cluster only accepts certificates from ["CN=Yubico U2F Root CA Serial 457200631"]; make sure you're using a U2F device from a trusted manufacturer
```
2021-03-23 15:14:31 -07:00
Brian Joerger 2beb991598
API client connection overhaul (#5625)
* Added support for connecting API client through tunnel proxy and web proxy addresses (with identity file).

* Added concurrent dialing logic to dial several possible dialing combinations and seamlessly return the first client to connect.
2021-03-23 14:39:20 -07:00
Roman Tkachenko 8739417729
Add Postgres Cloud SQL support (#5941) 2021-03-22 09:38:05 -07:00
Roman Tkachenko a3837f6720
App access cli flow (#5918) 2021-03-22 09:18:53 -07:00
Roman Tkachenko b2ff4df8fa
Fix app access websockets support (#6072) 2021-03-22 08:56:44 -07:00