Commit graph

51 commits

Author SHA1 Message Date
Roman Tkachenko 1e09b825f6
Port fixes from v8 (#9397)
* Update oxy
* Do not allow MySQL COM_CHANGE_USER command
* Add support for all MongoDB wire messages
* Drone fix
2021-12-15 06:38:05 +00:00
Roman Tkachenko beb91db747
Bump x/crypto (#9205) 2021-12-02 17:56:06 -08:00
Roman Tkachenko 4d5493eb69
Add Azure access token auth support for Postgres/MySQL (#8951) 2021-12-01 14:30:25 -08:00
Andrew Burke 2ac300a1f8 Update vendor 2021-11-18 09:28:25 -08:00
Nic Klaassen 07ffb23e4e
make update-vendor (#9017) 2021-11-17 07:31:56 +00:00
Nic Klaassen d67e9b347f
update gosaml2 dep (#8937) 2021-11-16 10:07:11 -08:00
Nic Klaassen 3798ca8b44
replace dgrijalva/jwt-go with golang-jwt/jwt (#8939) 2021-11-12 16:09:44 -08:00
Andrew Burke 71ea32fbae
Add '+' to key sanitizer whitelist (#8396) 2021-10-28 16:02:55 -07:00
Nic Klaassen 2d10515f19
Implement Simplified Node Joining (#8250) 2021-10-08 10:41:28 -07:00
Steven Martin c3b07306f8
Adds OIDC logic for Ping Provider (#8308)
Checks if provider is ping and uses only client secret post for oidc auth method

* Update go-oidc fork to v0.0.5 to include PingID workaround
2021-10-05 16:41:19 -04: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
Tim Buckley 01acea141a
Add support for tsh ssh on Windows (#7790)
* Add support for `tsh ssh` on Windows

This adds Windows session support to tsh, taking advantage of ANSI
terminal support and VT emulation added in recent versions Windows
10. On supported Windows versions (Windows 10 1607+), `tsh ssh`
should work as expected in `cmd.exe`, PowerShell, and the new
Windows Terminal app.

* Address a few review comments

* Remove significant chunks of unnecessary tncon code.

Removes the global buffer, `GetVTSeqFromKeyStroke`, and several
ancillary headers and functions that aren't needed for our (current)
use-case. Also removes mouse and focus events.

* Refactor OS-specific terminal handling

This significantly simplifies OS-specific terminal behavior:
 * Move OS specific terminal code into a new `terminal` package
 * Remove `session_windows.go` in favor of an OS-independent
   `session.go`, defer to terminal package for OS specific
   functionality.
 * Remove ConPTY since it's not needed.
 * Always wait for the terminal and ssh session to fully close before
   quitting.
 * Refactor tncon; ensure the raw reader can be closed and reopened,
   remove lots of unnecessary C code.

* Revert dependency changes

* Use WindowsOS constant.

* Fix `tsh play` on Windows

This fixes `tsh play` on Windows by using the new `terminal` module to
initialize the terminal for raw input in a cross-platform way.

Additionally, this simplifies `terminal.New()` since in practice we never
want interactive mode at init time, and  fixes a broken unit test.

* Use correct log library

* Fix `tsh play` player controls on Windows

This fixes the console player controls on Windows as well as the timestamp
writer.

* Clean up lints

* Add missing license header

* Fix broken unit test

* Fix cross-compile builds on Linux/Docker

We need windows.h, which is not capitalized in the mingw packages
(and is case insensitive on Windows).

* Address code review feedback

 - Rename `Terminal.InitInteractive` to `Terminal.InitRaw`
 - Ensure goroutines terminate on close
 - Fix outdated godoc comments
 - Ensure Terminal event subscribers are cleared (and their channels
   are closed)
 - Ensure terminal output mode is reset on error in initTerminal
 - Bubble up errors in Terminal.Close()
 - Add author notice to tncon.c re: our changes
 - Add go-ansiterm as a direct dependency
 - Run `make update-vendor`

* Add constants and a small player.go TODO.

* Clear linter warning
2021-09-16 15:53:08 -06:00
Joel 48077e168f
Fix firestore (#8181) 2021-09-14 11:32:53 +02:00
Lisa Kim 6c1a5b7b87
Implement Account Recovery Codes (#8034)
* Add dice-ware library to create the recovery codes
* Add new recovery code "generated" and "used" events
* Implement create, upsert, and get recovery codes
* Create ChangeUserAuthentication grpc endpoint that is essentially a rework
  of ChangePasswordWithToken that returns both a web session and
  recovery codes (if user meets requirement)
* Add custom rate limit for grpc endpoint for ChangeUserAuthentication

* This commit also includes unused methods related to verifying recovery
  code and recovery attempts that isn't utilized until later PRs
2021-08-26 17:29:08 -07:00
Alan Parra c401bb7cf7
Implement WebAuthn login (#8009)
Add the necessary logic to perform WebAuthn logins/authentication, including
both necessary steps (named "Begin" and "Finish" after the Duo Labs
API/reference implementation).

Note that the login logic is not yet wired to Teleport, that is to come in a
future PR.

Part of the WebAuthn Support[1] work.

[1] https://github.com/gravitational/teleport/pull/7808

* Vendor duo-labs/webauthn and fxamacker/cbor/v2
* Implement the first step of login
* Implement the second step of login
* Add WebAuthn support for mock U2F devices
* Add tests for the complete login flow
* Be explicit about the default attestation value
* Refactor "appid" into a constant
* Add missing license headers
2021-08-26 10:50:59 -07:00
Roman Tkachenko 060750bc88
Vendor our logrus fork to fix data race (#7940) 2021-08-17 12:58:20 -07:00
Andrej Tokarčík f97b7c09d3
Reject cert generation requests for locked-out users/hosts (#7746) 2021-08-12 19:52:13 +02:00
Nic Klaassen 185e5fda35
Add hsmKeyStore implementation (#7614) 2021-07-29 13:08:01 -07:00
Russell Jones 45f8954c5b Fixed vendoring issue. 2021-07-14 14:41:34 -07:00
Eugene Yakubovich c83d028d92 libbpfgo has been moved out of tracee
libbpfgo is now a standalone project and thus
requires Teleport to vendor less code.
2021-07-14 11:56:59 -07:00
Roman Tkachenko efc3973f78
Better handling of database access IAM errors (#7525) 2021-07-14 09:13:39 -07:00
Roman Tkachenko 6b9726f961
Add MongoDB database access support (#7213) 2021-06-21 22:54:05 -07:00
Andrew Lytvynov 41d0e1f557
grpc: call trail.ToGRPC from gRPC interceptors (#7217)
* grpc: call trail.ToGRPC from gRPC interceptors

The reduces the boilerplate a bit in the gRPC handlers and ensures you
won't forget the conversion.

* Update lib/auth/grpcserver.go

Co-authored-by: Andrej Tokarčík <andrej@goteleport.com>

Co-authored-by: Andrej Tokarčík <andrej@goteleport.com>
2021-06-10 15:05:56 -07:00
Russell Jones 3043809051 Updated vendoring of tracee/libbpfgo.
Updated vendoring of  github.com/aquasecurity/tracee/libbpfgo to point
to 242d721b using the following command:

CGO_LDFLAGS=-lbpf \
  go get -u -v github.com/aquasecurity/tracee/libbpfgo@242d721b
2021-05-28 15:25:23 -07:00
Eugene Yakubovich 585c33232b Move from BCC to libbpf with CO-RE. 2021-05-28 15:25:23 -07:00
Russell Jones 66f3aab036 Fixed IBM Cloud AppID SSO integration.
IBM Cloud AppID SSO returns strings as well as integers in JWT headers.
Updated version of our go-oidc fork which handles string and integer
values in JWT headers.
2021-05-20 18:45:26 -07:00
Brian Joerger f533872a25
Upgrade api's trace dependency to 1.1.15 (#6341) 2021-05-03 16:27:51 -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
Roman Tkachenko 8739417729
Add Postgres Cloud SQL support (#5941) 2021-03-22 09:38:05 -07:00
Roman Tkachenko b2ff4df8fa
Fix app access websockets support (#6072) 2021-03-22 08:56:44 -07:00
Andrew Lytvynov efc99a068c Update Go dependencies
Several dependencies can't be updated due to breakages (etcd and grpc
for example).

Also updated ttlmap usage since their API changed.
2021-02-23 18:04:55 -08:00
Brian Joerger 427bafe7b2
API Go module (#5449) 2021-02-22 16:20:43 -08:00
Roman Tkachenko e235dfa35a
Update go-mysql to fix performance issue (#5554) 2021-02-11 17:31:56 -08:00
Roman Tkachenko 81e1102250
Add MySQL support for database access (#5453) 2021-02-10 11:08:13 -08:00
Andrew Lytvynov 491a298b1a
mfa: replace u2f-host with github.com/flynn/u2f (#5477)
This change removes the need for users to manually install u2f-host.
It also enables us to do U2F authentication with multiple devices.
2021-02-04 11:10:00 -08:00
Andrew Lytvynov e3ee42a775
Upgrade go-sqlite3 (#5436)
After a recent local C compiler upgrade, I started getting these
warnings when building teleport:

```
\# github.com/mattn/go-sqlite3
sqlite3-binding.c: In function 'sqlite3SelectNew':
sqlite3-binding.c:123303:10: warning: function may return address of local variable [-Wreturn-local-addr]
123303 |   return pNew;
       |          ^~~~
sqlite3-binding.c:123263:10: note: declared here
123263 |   Select standin;
       |          ^~~~~~~
```

Upgrading to the latest version clears those.
Here's the full changelog: https://github.com/mattn/go-sqlite3/compare/v1.10.0...v1.14.6
2021-01-29 12:15:14 -08:00
Roman Tkachenko 8e1865464b
Database access (#5005) 2021-01-14 18:21:38 -08:00
a-palchikov 6684c37103
Use fake clock consistently in units tests. (#5263)
Use fake clock consistently in units tests.
2021-01-12 12:10:00 +01:00
a-palchikov 54ee98f529
Upgrade github.com/gravitataional/trace to v1.1.13 (#5187)
* Upgrade github.com/gravitataional/trace to v1.1.12

We were a few versions behind. In particular this versions lets us use
stdlib's `errors.Is/As` to inspect errors.

* Bump trace to 1.1.13

Co-authored-by: Andrew Lytvynov <andrew@goteleport.com>
2020-12-23 11:30:15 +01:00
Andrew Lytvynov 05c73c9372
Upgrade gosaml2 library to v0.6.0 (#5118)
See https://github.com/russellhaering/gosaml2/security/advisories/GHSA-xhqq-x44f-9fgg
2020-12-14 11:34:20 -08:00
a-palchikov c94e5042c7
Server data race (#4790)
* Add logger attributes to be able to propagate logger from tests for identifying tests
* Add test case for Server's DeepCopy.
* Update test to using the testing package directly. Update dependency after upstream PR.
2020-12-09 16:46:33 +01:00
a-palchikov 7c87576a8b
flaky tests: consistent logging (#4849)
* Update logrus package to fix data races
* Introduce a logger that uses the test context to log the messages so they are output if a test fails for improved trouble-shooting.
* Revert introduction of test logger - simply leave logger configuration at debug level outputting to stderr during tests.
* Run integration test for e as well
* Use make with a cap and append to only copy the relevant roles.
* Address review comments
* Update integration test suite to use test-local logger that would only output logs iff a specific test has failed - no logs from other test cases will be output.
* Revert changes to InitLoggerForTests API
* Create a new logger instance when applying defaults or merging with file service configuration
* Introduce a local logger interface to be able to test file configuration merge.
* Fix kube integration tests w.r.t log
* Move goroutine profile dump into a separate func to handle parameters consistently for all invocations
2020-12-07 15:35:15 +01:00
Russell Jones e94e4b5147 Updated vendoring of AWS SDK.
Vendored github.com/aws/aws-sdk-go/aws/applicationautoscaling.
2020-11-03 17:46:34 -08:00
Russell Jones a175e21c97 Vendored gopkg.in/square/go-jose.v2/jwt. 2020-11-03 14:32:13 -08:00
jane (quin) 888d6f5d9a
updated HDR histogram vendor (#4461) 2020-10-07 17:13:18 -07:00
Andrew Lytvynov cfb7839c08 Update vendored k8s dependencies 2020-09-29 21:04:02 +00:00
Andrew Lytvynov 8aacdc1b0f Update github.com/russellhaering/goxmldsig to v1.1.0
See https://github.com/russellhaering/goxmldsig/security/advisories/GHSA-q547-gmf8-8jr7
2020-09-29 17:51:50 +00:00
Sasha Klizhentas d160507430 Session streaming
This commit introduces GRPC API for streaming sessions.

It adds structured events and sync streaming
that avoids storing events on disk.

You can find design in rfd/0002-streaming.md RFD.
2020-09-28 23:08:56 -07:00
Andrew Lytvynov 3587cca784
Always collect metrics about top backend requests (#4282)
* Always collect metrics about top backend requests

Previously, it was only done in debug mode. This makes some tabs in
`tctl top` empty, when auth server is not in debug mode.

* backend: use an LRU cache for top requests in Reporter

This LRU cache tracks the most frequent recent backend keys. All keys in
this cache map to existing labels in the requests metric. Any evicted
keys are also deleted from the metric.

This will keep an upper limit on our memory usage while still always
reporting the most active keys.
2020-09-16 20:33:19 +00:00
Andrew Lytvynov 9c041361f9 Vendor testing dependencies
- github.com/stretctr/testify
- github.com/google/go-cmp
2020-08-28 00:28:45 +00:00