Commit Graph
36 Commits
Author SHA1 Message Date
Tobiasz Heller 0b3a67f69f Remove GetSessionEvents from external loggers (#22071) (#22703)
Remove GetSessionEvents from external loggers
2023-03-07 15:48:00 +00:00
Tobiasz Heller 770e74a31a refactor: audit interface (#22070)
* refactor: shrinker interface for external audit loggers

* move StreamSessionEvents from ExternalAuditLogger

* fix comment of getLocalLog

* Rename IauditLog into AuditLoggerSessionStreamer
2023-03-06 10:44:16 +00:00
Zac Bergquist da7680ad0b Use x/exp/slices instead of home grown utilities (#18524)
We were inconsistent throughout the codebase and would sometimes
use the slices package and other times use our own equivalents
in api/.

This removes our versions in favor of the golang.org/x package that
does the same, which has the added benefit of reducing the surface
area of the public API module.

Note: despite existing uses of the slices package, for some reason
it didn't show up in go.mod or go.sum. Fixed that too.
2022-11-17 15:25:46 +00:00
Jakub Nyckowski 0ee91f6c37 Enable GCI linter (#17894) 2022-10-28 20:20:28 +00:00
Brian Joerger 4c0a6ff5b1 tsh PIV login integration (#15335)
* Add Yubikey PrivateKey implementation for use by Teleport clients.

  - Add yubikey login logic, reusing previously stored private keys.

  - Fix identity file decoding with PIV keys, which sign ecdsa certificates.

  - Add libpcsclite-dev pre-req for building on linux.

  - Remove unnecessary keys.Signer interface and move its functionality to keys.PrivateKey.

  - Move retry and jitter utils to new api/utils/retryutils package.
2022-09-23 19:44:10 +00:00
Russell Jones d016c85a9a Refactor tests under events package.
Refactored all tests under "lib/events" to use testify instead
of gocheck.
2022-07-18 15:10:40 -07:00
Marek Smoliński eb2401d5ee DynamoDB events by session ID (#13284) 2022-07-04 13:45:32 +02:00
Zac Bergquist 1e021e6db9 Fix dependencies (#13972)
* Don't use k8s utils package

We have our own function to check for the presence of a string
in a []string.

* Fix go.mod's missing 'e' dependencies
2022-06-29 14:08:46 +00:00
Joel aaa6ea73dd Correctly handle Firestore pagination with DocumentID cursors (#13017) 2022-06-22 16:48:21 +00:00
JoelandKrzysztof Skrzętnicki bb6c4b4262 Add nil check for billing mode in AWS DynamoDB events driver (#12445)
* Check for nil in the billing mode getter + fix panic if eventtype is not set

* use a better strategy to check if the interface is nil

* add godoc

* simplify switch

* update godoc

* simplify unknown field extraction code

* ensure underlying type is correct

* Update lib/events/dynamic_test.go

Co-authored-by: Krzysztof Skrzętnicki <krzysztof.skrzetnicki@goteleport.com>

* fix lint

* Update AWS dynamo tests as a result of the dynamic.go changes, I don't think they've ever worked in some time as they appeared quite broke.

* simplify

* simplify 2

Co-authored-by: Krzysztof Skrzętnicki <krzysztof.skrzetnicki@goteleport.com>
2022-05-05 14:34:04 +00:00
Zac Bergquist bc50f7dbf7 Remove unused PostSessionSlice method
This is leftover from the old session recordings uploader
and is unused in current Teleport code.
2022-05-03 11:09:21 -06:00
Zac Bergquist 62f687bef7 lib/events: remove legacy event types
These events are remnants of the old system before our events
were strongly-typed protos, and were unused in the code
(save for a few tests, which were updated)
2022-03-25 15:21:22 -06:00
Zac Bergquist 55cbd0ac97 Remove use of deprecated ioutil package (#11296)
* Remove use of deprecated ioutil package
* Add lint rule to check for ioutil imports
2022-03-21 18:00:34 +00:00
Andrej Tokarčík b86fa7bfa8 Implement where conditions for session recordings list/read (#8289) 2021-10-08 10:18:22 -07:00
Alan Parra dba49bfad6 Lint and fix missing license headers (#8075)
Introduce new make targets to check and add license headers to files
("make lint-license" and "make fix-license"). License checking is now a part of
"make lint" as well.

Initial attempts used goheader, but it caused "make lint-go" to become about 9x
slower (if not more), plus it only targets go files. Google's addlicense is fast
enough and targets however many file types we want.

Existing files that were missing licenses got the header added, using the
current year as the license date.

* Introduce lint-license and fix-license make targets
* Ignore generated files
* Add license to go files
* Replace irregular licenses with standard copyright/license
* Add license to proto files
* Install addlicense in build.assets Dockerfile
2021-08-30 09:44:09 -07: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
Joel 01dd8068aa Allow querying for audit events in either an ascending or descending order (#7425) 2021-07-12 13:14:05 +02: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
Joel ceb0de8c79 Fix file event driver inconsistencies (#7073) 2021-06-03 08:49:23 +02:00
Joel b2494bea8e Improve RFD 24 Dynamo migration efficiency and performance (#7012) 2021-05-27 22:19:56 +02:00
Joel 615c4639b8 Resolve test issues and event driver bugs (#6990) 2021-05-21 22:01:52 +02:00
Joel b68c519b4c Implement RFD 19: Event Iteration API (#6731) 2021-05-18 16:46:01 +02: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
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 e5478c937d Remove unnecessary type conversions
Caught by `unconvert` linter. No behavior changes here.
2020-05-11 16:44:27 +00:00
Andrew Lytvynov 935375a00d Fix staticcheck findings in lib/events/...
Fixed findings:
```
lib/events/test/suite.go:88:2: SA4006: this value of `err` is never used (staticcheck)
	err := s.Log.EmitAuditEvent(events.UserLocalLogin, events.EventFields{
	^
lib/events/auditlog_test.go:98:2: SA4006: this value of `err` is never used (staticcheck)
	fileHandler, err := filesessions.NewHandler(filesessions.Config{
	^
lib/events/auditlog_test.go:121:2: SA4006: this value of `err` is never used (staticcheck)
	err = os.MkdirAll(filepath.Join(uploadDir, "upload", "sessions", defaults.Namespace), 0755)
	^
lib/events/auditlog_test.go:224:2: SA4006: this value of `err` is never used (staticcheck)
	fileHandler, err := filesessions.NewHandler(filesessions.Config{
	^
lib/events/auditlog_test.go:246:2: SA4006: this value of `err` is never used (staticcheck)
	err = os.MkdirAll(filepath.Join(uploadDir, "upload", "sessions", defaults.Namespace), 0755)
	^
lib/events/auditlog_test.go:381:2: SA4006: this value of `err` is never used (staticcheck)
	fileHandler, err := filesessions.NewHandler(filesessions.Config{
	^
lib/events/auditlog_test.go:403:2: SA4006: this value of `err` is never used (staticcheck)
	fileHandler, err := filesessions.NewHandler(filesessions.Config{
	^
lib/events/auditlog_test.go:431:2: SA4006: this value of `err` is never used (staticcheck)
	err := os.MkdirAll(filepath.Join(uploadDir, "upload", "sessions", defaults.Namespace), 0755)
	^
lib/events/filesessions/fileuploader.go:84:2: SA4006: this value of `err` is never used (staticcheck)
	_, err := os.Stat(filepath.Dir(path))
	^
lib/events/dynamoevents/dynamoevents.go:352:2: SA4006: this value of `err` is never used (staticcheck)
	attributeValues, err := dynamodbattribute.MarshalMap(attributes)
	^
lib/events/dynamoevents/dynamoevents.go:405:2: SA4006: this value of `err` is never used (staticcheck)
	attributeValues, err := dynamodbattribute.MarshalMap(attributes)
	^
```
2020-04-28 15:17:44 +00:00
Roman Tkachenko 1828e21ef4 [Forward-port] Update audit events with additional fields. (#2655) 2019-04-17 10:16:28 -07:00
Sasha Klizhentas bad1b0498d External events and sessions storage.
Updates #1755

Design
------

This commit adds support for pluggable events and
sessions recordings and adds several plugins.

In case if external sessions recording storage
is used, nodes or proxies depending on configuration
store the session recordings locally and
then upload the recordings in the background.

Non-print session events are always sent to the
remote auth server as usual.

In case if remote events storage is used, auth
servers download recordings from it during playbacks.

DynamoDB event backend
----------------------

Transient DynamoDB backend is added for events
storage. Events are stored with default TTL of 1 year.

External lambda functions should be used
to forward events from DynamoDB.

Parameter audit_table_name in storage section
turns on dynamodb backend.

The table will be auto created.

S3 sessions backend
-------------------

If audit_sessions_uri is specified to s3://bucket-name
node or proxy depending on recording mode
will start uploading the recorded sessions
to the bucket.

If the bucket does not exist, teleport will
attempt to create a bucket with versioning and encryption
turned on by default.

Teleport will turn on bucket-side encryption for the tarballs
using aws:kms key.

File sessions backend
---------------------

If audit_sessions_uri is specified to file:///folder
teleport will start writing tarballs to this folder instead
of sending records to the file server.

This is helpful for plugin writers who can use fuse or NFS
mounted storage to handle the data.

Working dynamic configuration.
2018-03-15 12:42:43 -07:00
Ev Kontsevoy 6f111e39e2 Removed lunk + old events + old recorder 2016-04-26 17:39:46 -07:00
klizhentas 55388db74b migrate to time UUID in session log, fixes #266
this commit restricts session id and session party id to be time UUID v1
and uses this fact to create a sorted session log
2016-03-19 18:16:06 -07:00
klizhentas 332212dcd4 add session log 2016-03-04 16:53:11 -08:00
Alex Lyulkov a56b5236ac Moved to go1.5 vendoring 2016-01-20 18:52:25 +03:00
klizhentas 00ef621e6b Apply apache license to teleport 2015-10-31 11:56:49 -07:00
Alex Lyulkov 9afc9a38a1 Fixed imports 2015-10-05 17:33:25 +03:00