teleport/lib/service
Gavin Frazar d9b80fb2a7
Emit new event for DynamoDB requests via app access (#17595)
* protobuf update

* Update proto to use dynamodb request event specific to app-access

We will include a similar event for dynamodb via database-access.
We split the events so that app and database access events are not coupled.
This way we do not have to include optional database/app metadata in one event too.

* Update protos

* Update oneof

* Move AppMetaData up with the other metadata and add a 'target' field

* Remove operation plane

* Fix typo

* Configure signing service with transport instead of http client

* Protect from resource exhaustion attacks

* Add IsDynamoDB to types.Application

* Add new event and code for dynamodb requests

* Add async emitter to app access

* Add audit.go to unify app access auditing

* Refactor auditing in app access

* Use the new audit's onSessionChunk/onRequest methods
* Put the session context in the session chunk
* Use a TeeStreamer to send AppSessionDynamoDBRequest directly to audit log as well as session file
* Change streamWriter to streamCloser in sessionChunk to clarify that it should only be used for closing

* Update handler test to test dynamodb events

* Update test to use streamCloser

* Update sever test

* Add doc strings

* Return error from audit interface methods so callers can choose what do to with it

* Move app session start/end into audit interface

* Configure tcpServer to use the server's emitter instead of auth
  client, as an Audit interface.
* Have tcpServer call onSessionStart/End instead of emitting events
  itself.

* Remove unneeded check type

* Rename Transport -> RoundTripper

* Fix test after renaming field

* Rename drainBody and defer body closing

* Fix subtle named return mistake

* Update lib/service/service.go

Co-authored-by: Tobiasz Heller <14020794+tobiaszheller@users.noreply.github.com>

* Update lib/service/service.go

Co-authored-by: Tobiasz Heller <14020794+tobiaszheller@users.noreply.github.com>

* Rename ok->shouldSkipCleanup to make the purpose of it more clear

* Refactor request body decoding into aws utils

* Use request instead of signed request for audit event

* Determine if req is for a dynamo endpoint instead of checking app uri

* Remove obsolete app func IsDynamoDB

* Update handler test

* Use generic console app uri to test that we differentiate request by endpoint instead of app uri
* Use a dynamodb request which has a body to test that we include the body in the audit event
* Test for expected body JSON

* fix lint

* Fixup merge

Co-authored-by: Tobiasz Heller <14020794+tobiaszheller@users.noreply.github.com>
2022-11-15 22:58:15 +00:00
..
acme.go Enable GCI linter (#17894) 2022-10-28 20:20:28 +00:00
cfg.go Adds GCP GKE auto-discovery (#17831) 2022-11-11 18:10:29 +00:00
cfg_test.go Enable GCI linter (#17894) 2022-10-28 20:20:28 +00:00
connect.go For config v3, improve the error message when failing to connect to the auth service (#17847) 2022-10-28 17:23:24 +00:00
db.go Add Cassandra/Scylla database support (#15895) 2022-10-10 12:37:51 +02:00
db_test.go Update golangci-lint to 1.49.0 (#16507) 2022-09-19 22:38:59 +00:00
desktop.go This commit refactors some parts of Windows Desktop into lib/auth/windows in order to prepare it for more general use; in particular, pkinit/x509 authentication for SQL Server has the same certificate requirements, and it does not make sense to import desktop into database code. (#17870) 2022-10-31 22:49:00 +00:00
discovery.go Adds GCP GKE auto-discovery (#17831) 2022-11-11 18:10:29 +00:00
info.go Better signal handling and pools for gzip. 2018-02-19 10:57:26 -08:00
kubernetes.go Pass the process log config to Kube Service/Proxy (#17462) 2022-10-17 12:11:29 +00:00
listeners.go Remove centralised port allocation for tests (#13658) 2022-07-20 12:04:54 +10:00
proxy_settings.go Introduce config v3, add auth_server and proxy_server, remove auth_addresses (#15761) 2022-09-28 15:30:15 +00:00
service.go Emit new event for DynamoDB requests via app access (#17595) 2022-11-15 22:58:15 +00:00
service_test.go Proritize HTTP/1.1 over HTTP/2. (#17886) 2022-11-01 15:38:50 +00:00
signals.go Refactor Supervisor.WaitForEvent (#14940) 2022-07-28 13:34:27 +00:00
state.go Move prometheus collectors from utils to metrics (#15288) 2022-08-09 17:35:19 +00:00
state_test.go Revert readyz changes (#12244) 2022-04-26 22:16:55 +00:00
supervisor.go Refactor Supervisor.WaitForEvent (#14940) 2022-07-28 13:34:27 +00:00
validateconfig.go Enable GCI linter (#17894) 2022-10-28 20:20:28 +00:00
validateconfig_test.go Enable GCI linter (#17894) 2022-10-28 20:20:28 +00:00