Commit Graph
68 Commits
Author SHA1 Message Date
Yassine Bounekhla 2fb5294aac Add support for Moderated Sessions in the Web UI (#19647) 2023-01-26 22:52:01 +00:00
Jeff Pihach 7e64ae32ba Generate new session on new ssh websocket connection. (#18523)
SSH Sessions from the UI are now managed under a single websocket connection instead of through multiple HTTP and WS calls.
2022-11-28 21:26:57 +00:00
Zac Bergquist c2e79f1fa9 Include all active sessions in the web API (#17945)
Also update the active sessions test to operate based on the presence
of session trackers rather than actually starting a session. This
allows us to test additional session types and is more deterministic.

For app sessions, use the name from the types.Application, since
the value in the cert is only present for CLI sessions.

For database sessions, use the database service name, which maps
to the Teleport database service the user is connecting to, since
the actual "logical" database name is not required.

Closes #17126
Closes #17871
2022-11-07 20:09:37 +00:00
Jakub Nyckowski 0ee91f6c37 Enable GCI linter (#17894) 2022-10-28 20:20:28 +00:00
Joel f2dd75801a Remove legacy session service (#15155) 2022-08-12 16:39:45 +00:00
rosstimothy fba159e9c4 Add context.Context to session.Service inteface (#14668)
* Add context.Context to session.Service interface

Updates GetSessions, GetSession, CreateSession, UpdateSesion, and
DeleteSession to take a context.Context. All call paths are updated
to properly pass along a real context instead of relying on a
to eliminate context.TODOs.
2022-07-25 22:05:09 +00:00
Lisa Kim 0deb57f343 Include k8s in listing active sessions for web UI (#14329) 2022-07-12 02:39:19 +00:00
Zac Bergquist c8af176828 Remove more deprecated code (#13132)
* Remove more deprecated code

In the case where we were using the PostalCode, StreetAddress,
and Province fields rather than ASN.1 extensions we could have
removed more code, but I opted for a phase approach where we stop
populating the fields in v10 (but still accept them), and then
stop reading them entirely in v11.

* Fix lints and remove more unused code

* Restore StreetAddress / PostalCode

We don't yet have dedicated extensions for these
2022-06-07 03:38:33 +00:00
JoelandZac Bergquist 62173e096b use google/uuid instead of pborman/uuid (#9793)
* replace imports

* use google/uuid

* fix test

* reverse changelog changes

* update gomod

* zac steps

* tidy

Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>
2022-01-19 23:44:48 +00:00
Alan ParraandAndrej Tokarčík 64679d2db8 Implement where conditions for active sessions (#9040)
Implements RFD 45 / "where" conditions for active sessions[1].

In few words, the purpose of the RFD is to allow the creation of roles that
permits users to only join a subset of active sessions (for example, only their
own sessions).

Implementation goes a bit further than the RFD, allowing the conditions to be
applied to  `update` and `delete` verbs as well.

Originally implemented by @andrejtokarcik (#8568), tweaks by @codingllama.

[1] https://github.com/gravitational/teleport/blob/master/rfd/0045-ssh_session-where-condition.md


* Implement where conditions for active sessions list/read
* actionWithConditionForList => actionForListWithCondition
* Make Context-exposed sessions follow the RFD API
* Add tests for "where" conditions on active sessions
* Fix typos
* Fix typos and spacing
* Rename "parties" to "participants" in the context session
* Update RFD to reflect PR changes

Update RFD to reflect PR changes

Specifically, mark as implemented and rename `parties` to `participants`.

* Push list authz logic to ServerWithRoles, obsolete cond
* Remove cond from GetSessions signature
* Simplify cast in lib.utils.Fields.GetString
* Add TODO to refactor SearchSessionEvents / stored sessions

Co-authored-by: Andrej Tokarčík <andrej@goteleport.com>
2021-11-18 15:05:13 -08: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
Brian Joerger 4d36870ff0 Remove remaining API aliases (#7137) 2021-06-08 12:08:55 -07:00
Brian Joerger 7bff7c41bd Remove API aliases (#6983) 2021-06-04 13:29:31 -07:00
Andrew Lytvynov fc1c1dbd14 Move all utils.InitLoggerForTests calls to TestMain
This prevents data races between changing the standard logger and it
acutally being used.
2021-02-23 18:04:55 -08: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
Acrimon cb701c4743 Refactor lib/asciitable, lib/tlsca, lib/shell, lib/session and lib/config tests to not use gocheck 2021-02-23 18:30:06 +01:00
dmitri a74c90769c Fix reported data races in lib/backend unit tests.
Fixes https://github.com/gravitational/teleport/issues/5331.
2021-02-02 15:07:25 -08:00
Andrew Lytvynov 92ed2db38a Fixing golint warnings, batch 1
Mostly cosmetic changes:
- making receiver names consistent
- renaming `foo.FooBar` to `foo.Bar` (using package name as prefix)
- removing redundant `else` branches
- changing `a += 1` to `a++`
2020-10-13 00:22:49 +00:00
Andrew Lytvynov 1d9e01bb80 errcheck: add missing error checks in lib/service* 2020-06-01 17:00:07 +00:00
Andrew Lytvynov e5478c937d Remove unnecessary type conversions
Caught by `unconvert` linter. No behavior changes here.
2020-05-11 16:44:27 +00:00
Lisa Kim 1376ff8e55 Add/Set ClusterName prop to Session struct (#3668) 2020-05-06 13:13:23 -07:00
Andrew Lytvynov b1eae4ac4c Remove unused functions and methods throughout lib/...
This code is not caught by linters because it's exported and they assume
there's some external users.
Since teleport is relatively self-contained, we can tell for sure
whether something is called or not.
2020-05-06 00:02:53 +00:00
3c670d5d58 Merge Teleport V4.3 UI branch to master (#3583)
* Add monorepo

* Add reset/passwd capability for local users (#3287)

* Add UserTokens to allow password resets

* Pass context down through ChangePasswordWithToken

* Rename UserToken to ResetPasswordToken

* Add auto formatting for proto files

* Add common Marshaller interfaces to reset password token

* Allow enterprise "tctl" reuse OSS user methods (#3344)

* Pass localAuthEnabled flag to UI (#3412)

* Added LocalAuthEnabled prop to WebConfigAuthSetting struct in webconfig.go
* Added LocalAuthEnabled state as part of webCfg in  apiserver.go

* update e-refs

* Fix a regression bug after merge

* Update tctl CLI output msgs (#3442)

* Use local user client when resolving user roles

* Update webapps ref

* Add and retrieve fields from Cluster struct (#3476)

* Set Teleport versions for node, auth, proxy init heartbeat
* Add and retrieve fields NodeCount, PublicURL, AuthVersion from Clusters
* Remove debug logging to avoid log pollution when getting public_addr of proxy
* Create helper func GuessProxyHost to get the public_addr of a proxy host
* Refactor newResetPasswordToken to use GuessProxyHost and remove publicUrl func

* Remove webapps submodule

* Add webassets submodule

* Replace webapps sub-module reference with webassets

* Update webassets path in Makefile

* Update webassets

1b11b26 Simplify and clean up Makefile (#62) https://github.com/gravitational/webapps/commit/1b11b26

* Retrieve cluster details for user context (#3515)

* Let GuessProxyHost also return proxy's version
* Unit test GuessProxyHostAndVersion & GetClusterDetails

* Update webassets

4dfef4e Fix build pipeline (#66) https://github.com/gravitational/webapps/commit/4dfef4e

* Update e-ref

* Update webassets

0647568 Fix OSS redirects https://github.com/gravitational/webapps/commit/0647568

* update e-ref

* Update webassets

e0f4189 Address security audit warnings Updates  "minimist" package which is used by 7y old "optimist". https://github.com/gravitational/webapps/commit/e0f4189

* Add new attr to Session struct (#3574)

* Add fields ServerHostname and ServerAddr
* Set these fields on newSession

* Ensure webassets submodule during build

* Update e-ref

* Ensure webassets before running unit-tests

* Update E-ref

Co-authored-by: Lisa Kim <lisa@gravitational.com>
Co-authored-by: Pierre Beaucamp <pierre@gravitational.com>
Co-authored-by: Jenkins <jenkins@gravitational.io>
2020-04-15 15:35:26 -04:00
Russell Jones 6f96595e99 Send UUIDv1 session IDs to legacy servers.
Before establishing a session, request the server version. If the server
replies false, that means it does not support that request type and is
an older server version which needs UUIDv1 format session IDs.
2019-09-11 13:50:00 -07:00
Russell Jones de66044843 Migrate session ID from UUIDv1 to UUIDv4. 2019-09-03 13:44:20 -07:00
Russell Jones 8e646482f4 Remove active session from backend at completion.
Fixed an issued where active session were removed from the backend after
a 30 second TTL. This would allow another user to attempt to join the
session which would then corrupt the audit recording. This fix removes
the active session upon completion so the session can no longer be
joined.
2019-06-06 10:58:24 -07:00
Sasha Klizhentas f40df845db Events and GRPC API
This commit introduces several key changes to
Teleport backend and API infrastructure
in order to achieve scalability improvements
on 10K+ node deployments.

Events and plain keyspace
--------------------------

New backend interface supports events,
pagination and range queries
and moves away from buckets to
plain keyspace, what better aligns
with DynamoDB and Etcd featuring similar
interfaces.

All backend implementations are
exposing Events API, allowing
multiple subscribers to consume the same
event stream and avoid polling database.

Replacing BoltDB, Dir with SQLite
-------------------------------

BoltDB backend does not support
having two processes access the database at the
same time. This prevented Teleport
using BoltDB backend to be live reloaded.

SQLite supports reads/writes by multiple
processes and makes Dir backend obsolete
as SQLite is more efficient on larger collections,
supports transactions and can detect data
corruption.

Teleport automatically migrates data from
Bolt and Dir backends into SQLite.

GRPC API and protobuf resources
-------------------------------

GRPC API has been introduced for
the auth server. The auth server now serves both GRPC
and JSON-HTTP API on the same TLS socket and uses
the same client certificate authentication.

All future API methods should use GRPC and HTTP-JSON
API is considered obsolete.

In addition to that some resources like
Server and CertificateAuthority are now
generated from protobuf service specifications in
a way that is fully backward compatible with
original JSON spec and schema, so the same resource
can be encoded and decoded from JSON, YAML
and protobuf.

All models should be refactored
into new proto specification over time.

Streaming presence service
--------------------------

In order to cut bandwidth, nodes
are sending full updates only when changes
to labels or spec have occured, otherwise
new light-weight GRPC keep alive updates are sent
over to the presence service, reducing
bandwidth usage on multi-node deployments.

In addition to that nodes are no longer polling
auth server for certificate authority rotation
updates, instead they subscribe to event updates
to detect updates as soon as they happen.

This is a new API, so the errors are inevitable,
that's why polling is still done, but
on a way slower rate.
2018-12-10 17:20:24 -08:00
Russell Jones a4b070c750 Fixed vendoring issues.
* Changed import path from github.com/moby/moby to canonical path of
    github.com/docker/docker.
  * Updated dependency for github.com/docker/docker/pkg/term.
  * Updated dependency for github.com/Azure/go-ansiterm.
2018-07-25 13:51:50 -07:00
Russell Jones 09b3c7f786 Pass all input to backend through a input sanitizer. 2018-05-30 19:53:41 +00:00
Russell Jones 876e04af07 * Push window size changes to clients instead of polling.
* Cache services.ClusterConfig within srv.ServerContext for the duration
  of a connection.
* Create a single websocket between the browser and the proxy for all
* terminal bytes and events.
2018-05-04 18:28:36 +00:00
Russell Jones 6a814e8a85 Use a discard session server and audit logger when the proxy is in
recording mode and on a Teleport node.
2018-01-16 01:38:24 +00:00
mricher b58cb051e8 Correct various typos
This was fixed running the `misspell` linter in fix mode using
`gometalinter`. The exact command I ran was :
```
gometalinter --vendor --disable-all -E misspell --linter='misspell:misspell -w {path}:^(?P<path>.*?\.go):(?P<line>\d+):(?P<col>\d+):\s*(?P<message>.*)$' ./...
```

Some typo were fixed by hand on top of it.
2017-10-20 10:20:26 +02:00
Sasha Klizhentas 8b81a0c384 Migrate to golang/dep for dependency management
Update following packages:

* Replace Sirupsen/log with sirupsen/log everywhere
* Update etcd client to 3.2.4
* Update docker/term to moby/term
* Update kr/pty to v1.0.0 release
* Update K8s client to 2.0
2017-08-22 15:30:30 -07:00
Russell Jones 97b5b8f6e8 Return errors from GetSession. 2017-06-09 16:57:12 -07:00
Sasha Klizhentas 3c2570fa35 Sasha High Availability. 2017-04-07 16:54:15 -07:00
Ev Kontsevoy 7040331660 Fixed all tests
Also replaced mailgun.FrozenTime with `clockwork` in a few places
(mailgun's frozen time still remains elsewhere)
2017-01-15 16:28:18 -08:00
Ev Kontsevoy 4ed536a2f0 First pass at cleaning up DynamoDB and locks
- Added ability to read AWS config from `~/.aws` directory for testing
- Fixed TTL bug in DynamoDB back-end
- Made FS back-end return similar error types as Boltdb does
- Cleaned up buggy tests for DynamoDB
- Removed unnecessary locks everywhere in code
2016-12-27 00:12:59 -08:00
Sasha Klizhentas 0793fe1d82 fix possible panic in GetSession 2016-12-20 11:52:15 -08:00
Sasha Klizhentas 698e615fd7 make API backwards compatible with pre-namespaces 2016-12-13 14:20:52 -08:00
Sasha Klizhentas c96c412542 add namespaces for sessions and events 2016-12-12 11:09:09 -08:00
Sasha Klizhentas 3678cf56e0 new permission checking system 2016-12-11 16:52:22 -08:00
Ev Kontsevoy ddedd8b923 Frozen tunnels (instead of closed connection) due to an expired session 2016-07-04 16:08:58 -07:00
Ev Kontsevoy b175d92052 PR comments - implemented! 2016-05-07 21:51:35 -07:00
Ev Kontsevoy e10612028e Preparations for a PR
Fixes #394
2016-05-06 20:48:02 -07:00
Ev Kontsevoy d36fced780 Added multi-party real-time window size support 2016-05-02 23:21:13 -07:00
Ev Kontsevoy 14ebdff0b4 Less logging and fixed terminal size vents from web sessions 2016-05-01 21:42:08 -07:00
Ev Kontsevoy 38dca5aba0 Added server ID to the session object to assist the UI 2016-05-01 18:54:44 -07:00
Ev Kontsevoy f4dfbf2e50 Easier bookkeeping of sessin parties 2016-05-01 17:31:28 -07:00
Ev Kontsevoy f14cdf5d58 Intermediate commit:
1. "new session" event now includes terminal size
2. started cleaning up web session event stream
2016-04-29 19:43:39 -07:00