Commit graph

173 commits

Author SHA1 Message Date
Brian Joerger c040aca4c1
Upgrade api version. (#7609) 2021-07-28 13:51:21 -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
Roman Tkachenko 58012cf376
Add Cloud SQL MySQL support (#7302) 2021-06-18 17:38:15 -05: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
Andrew Lytvynov ac9ba539ce
Use cmp.Equal instead of manual Equals methods (#5828)
* Use cmp.Equal instead of manual Equals methods

Equals methods can get out-of-sync with the fields added in structs they
compare. Using `cmp.Equal` handles that, removes a ton of code and makes
it more explicit when specific fields are excluded from comparison.

* Use gogoproto equal plugin for comparing proto values

This will be faster than reflect-based go-cmp.
2021-05-06 11:47:31 -07:00
Brian Joerger f533872a25
Upgrade api's trace dependency to 1.1.15 (#6341) 2021-05-03 16:27:51 -07:00
Roman Tkachenko a3d39e3810
Add redshift auth support to database access (#6479) 2021-04-26 11:53:10 -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
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 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
Andrew Lytvynov 79b0d54ee8
u2f: extract registration/authentication logic into lib/auth/u2f (#5387)
This is just a refactoring without functional changes. Pull all the u2f
handling spread across multiple client and server packages into one
place.

Also clean up an obsolete vendored dependency, unrelated to this PR.
2021-01-29 11:30:15 -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
Sasha Klizhentas c0bb732545 Adds ACME - auto cert management
This commit fixes #5177

Initial implementation uses dir backend as a cache and is OK
for small clusters, but will be a problem for many proxies.

This implementation uses Go autocert that is quite limited
compared to Caddy's certmagic or lego.

Autocert has no OCSP stapling and no locking for cache for example.
However, it is much simpler and has no dependencies.
It will be easier to extend to use Teleport backend as a cert cache.

```yaml
proxy_service:
  public_addr: ['example.com']
  # ACME - automatic certificate management environment.
  #
  # It provisions certificates for domains and
  # valid subdomains in public_addr section.
  #
  # The sudomains are valid if there is a registered application.
  # For example, app.example.com will get a cert if app is a regsitered
  # application access app. The sudomain cookie.example.com is not.
  #
  # Teleport acme is using TLS-ALPN-01 challenge:
  #
  # https://letsencrypt.org/docs/challenge-types/#tls-alpn-01
  #
  acme:
    # By default acme is disabled.
    enabled: true
    # Use a custom URI, for example staging is
    #
    # https://acme-staging-v02.api.letsencrypt.org/directory
    #
    # Default is letsencrypt.org production URL:
    #
    # https://acme-v02.api.letsencrypt.org/directory
    uri: ''
    # Set email to receive alerts and other correspondence
    # from your certificate authority.
    email: 'alice@example.com'
```
2020-12-22 17:33:20 -08: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
Andrew Lytvynov b16ad647b4
Kubernetes request routing and cluster registration (#4670)
This change has several parts: cluster registration, cache updates,
routing and a new tctl flag.

> cluster registration

Cluster registration means adding `KubernetesClusters` to `ServerSpec`
for servers with `KindKubeService`.

`kubernetes_service` instances will parse their kubeconfig or local
`kube_cluster_name` and add them to their `ServerSpec` sent to the auth
server. They are effectively declaring that "I can serve k8s requests
for k8s cluster X".

> cache updates

This is just cache plumbing for `kubernetes_service` presence, so that
other teleport processes can fetch all of kube services. It was missed
in the previous PR implementing CRUD for `kubernetes_service`.

> routing

Now the fun part - routing logic. This logic lives in
`/lib/kube/proxy/forwarder.go` and is shared by both `proxy_service`
(with kubernetes integration enabled) and `kubernetes_service`.

The target k8s cluster name is passed in the client cert, along with k8s
users/groups information.

`kubernetes_service` only serves requests for its direct k8s cluster
(from `Forwarder.creds`) and doesn't route requests to other teleport
instances.

`proxy_service` can serve requests:
- directly to a k8s cluster (the way it works pre-5.0)
- to a leaf teleport cluster (also same as pre-5.0, based on
  `RouteToCluster` field in the client cert)
- to a `kubernetes_service` (directly or over a tunnel)

The last two modes require the proxy to generate an ephemeral client TLS
cert to do an outbound mTLS connection.

> tctl flag

A flag `--kube-cluster-name` for `tctl auth sign --format=kubernetes`
which allows generating client certs for non-default k8s cluster name
(as long as it's registered in a cluster).
I used this for testing, but it could be used for automation too.
2020-11-09 19:40:02 +00: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
Andrew Lytvynov 566b7cc457 RFD 1: user testify/require instead of testify/assert
`require` is a sister package to `assert` that terminates the test on
failure. `assert` records the failure but lets the test proceed, which
is un-intuitive.

Also update all existing tests to match.
2020-10-16 00:15:25 +00: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
Andrew Lytvynov ad59af2220 Re-vendor dependencies with go mod
This is a result of "go mod vendor".
You'll notice that some versions have changed. This is due to the
transient module dependencies that dep wasn't aware of.

For example:
- Gopkg.lock imported cloud.google.com/go v0.41.0 and
  github.com/fsouza/fake-gcs-server v1.11.6
- github.com/fsouza/fake-gcs-server v1.11.6 has a go.mod file that
  depends on cloud.google.com/go v0.43.3:
  https://github.com/fsouza/fake-gcs-server/blob/v1.11.6/go.mod#L4
- therefore, "go mod vendor" bumped cloud.google.com/go to v.0.43.3

Same transient dependency version bumps got applied to some other
modules.

A few are also removed via "go mod tidy".
2020-07-17 16:09:23 +00:00
Andrew Lytvynov 832392bf42 dep: bump aws-sdk-go to v1.32.7
This should pick up some improvements, including a fix for
https://github.com/gravitational/teleport/issues/3510
2020-06-25 15:58:53 +00:00
Andrew Lytvynov 5fc99d2de4 Remove vendored openstack and oidc plugins
These are no longer needed.
2020-05-05 00:13:29 +00:00
Andrew Lytvynov faa95af34c Enable all kubeconfig auth plugins
By importing the magic `k8s.io/client-go/plugin/pkg/client/auth`
package, we compile-in support for auth plugins: gcp, azure, oidc,
openstack.

Without this, users can't provide a kubeconfig using those authn
methods to a proxy.
2020-05-05 00:13:29 +00:00
Russell Jones 72e2ffbc4e Re-vendored golang.org/x/crypto. 2020-02-20 14:43:29 -08:00
Alexander Klizhentas 0a57ff4bde
Updates k8s client to 0.17.3 (#3362) 2020-02-19 15:45:49 -08:00
Alexander Klizhentas b2ce1220e9
Updates AWS SDK to 1.28.11 (#3330)
This commit updates AWS Go SDK and fixes #3210

Co-authored-by: Russell Jones <russjones@users.noreply.github.com>
2020-02-06 17:13:20 -08:00
Russell Jones b11c0dfca4 Re-vendor golang.org/x/sys/unix. 2020-01-20 14:04:36 -08:00