Commit Graph
12 Commits
Author SHA1 Message Date
Rafał Cieślak 3ac5a0aedb Refactor prehog & teleterm protos to match project conventions (#20810)
* Adjust go_package of lib/prehog Go protobufs

This makes them follow the pattern set out by api/proto and proto.

* Adjust go_package of lib/teleterm Go protobufs

* Use single buf.gen.yaml to generate JS protos

This also entailed changing the location of lib/teleterm protos and changing
the value of their package specifier to match the conventions in other parts
of the codebase. This is a breaking change but that is fine for Connect
as the protos are used locally only and each build ships with matching
protobufs.

* Make web/packages/teleterm use protobufs from gen-proto-js

We used to copy protobufs over to web/packages/teleterm/src/services/tshd
since webapps used to be in a separate repo.

This is no longer the case, so we can just make teleterm use protobufs
from gen-proto-js.

* Move prehog & teleterm protos into proto/teleport/lib

* Generate JS protos to gen/proto/js

* Move lib/teleterm Go protobufs to gen/proto/go

* Move lib/prehog Go protobufs to gen/proto/go

* Rename lib/teleterm proto package

* Re-enable linter rules for teleterm & prehog

* Update prehogv1 path in usagereporter_test.go

* Use except instead of ignore_only to allow Google API-style responses

* Add UNARY_RPC to api/proto & proto

* Ignore gen/ when running addlicense

* buf-js.gen.yaml: Remove comment about lack of go_package for JS

* Move prehog protos to proto/prehog/v1alpha

* Adjust prehog's go_package to match proto package
2023-02-03 14:47:06 +00:00
Marco André Dinis 18bb8cf728 Discover: add flow events (#20925)
* Discover: add flow events

* improve comments and test description
2023-02-02 15:54:22 +00:00
Tim Buckley 95c5f1c6a8 Add usage events for certificate issuance and additional session types (#20662)
* Add usage events for certificate issuance and additional session types

This adds a new usage event for certificate issuance, emitted
whenever a new user certificate is generated. These events include
an anonymized username, TTL, and basic info about which requests are
present on the certificate (e.g. db/app/k8s requests).

Additionally, this captures additional session event types from the
audit log, including database, app, and desktop sessions, and also
properly tags k8s exec sessions which were previously grouped
together with SSH.

* Add `SessionStartV2` events, add `is_bot` flag to cert events

* Drop redundant `Event` prefix on `UsageCertificteIssued` event

* Rename `CertificateIssuedEvent` -> `UserCertificateIssuedEvent`
2023-02-01 21:29:59 +00:00
Marco André Dinis 799219f07a Update grpc-generated files (#21056)
In a previous PR some grpc-generated files were not included in the
commit.
This PR is the result of running `make grpc`.
2023-02-01 10:46:21 +00:00
Marco André Dinis 3f106eb350 Add DiscoverEvents (start and resourceSelection) (#20207)
* Discover Events: add started and resourceSelection event

This commit adds two new Prehog events, as part of the Discover
initiative.

Discover Started: when the wizard screen opens.
Resource Selection: when the user selects a Resource (server, kube,
db/pg, db/rds, db/..., desktop), and clicks next.

* improve comments, rename user_name
2023-01-30 18:31:57 +00:00
Rafał Cieślak 6791b48da9 Remove grpc-teleterm Make target and Dockerfile-teleterm (#20032)
* Remove CLANG_FORMAT from Makefiles

It was used to format protos but we use Buf for that since v10.

* Move installing grpc_node_plugin into Dockerfile

This commit basically takes grpc_node_plugin compilation from
Dockerfile-teleterm and moves it to Dockerfile.

* Replace Dockerfile-teleterm with Dockerfile

After moving grpc_node_plugin compilation to Dockerfile, the only remaining
thing that Dockerfile-teleterm does is installing rpm so that we can make
an RPM package for Connect during tag builds.

Installing this package can be simply moved to Dockerfile.

* Remove grpc-teleterm Make target in favor of grpc

* Add updated protobufs

It looks like they're a result of someone changing protos in lib/prehog
without running `make grpc-teleterm` separately. Which is why we're getting
rid of grpc-teleterm as a separate Make target in the first place. ;)
2023-01-26 09:41:07 +01:00
Krzysztof Skrzętnicki c481eb5396 Changes from make grpc and make grpc-teleterm missing from master (#20070)
* Changes from `make grpc`.

* Changes from `make grpc-teleterm`.
2023-01-11 16:44:36 +00:00
Michelle Bergquist 0fbe3447dc capture additional prehog events (#19713) 2023-01-10 17:44:58 +00:00
Grzegorz Zdunek 584e96efe0 Report Connect usage events (#19564) 2023-01-10 18:17:21 +01:00
Rafał Cieślak 50213556db Use one Buf workspace instead of three (#19774) 2023-01-09 11:31:35 +00:00
Tim Buckley 07de55d45d Generate prehog protos in genproto.sh (#19631)
This adds a `buf generate` for the prehog protos in `genproto.sh`,
which was previously missing from the usual `make grpc` flow.
2022-12-28 09:32:31 -07:00
fba02d9f9d Add a new usage reporter (#18142)
* [draft] Add a new usage reporter

This adds a new usage reporter service to the auth server. It's
disabled by default in OSS and can only be turned on via startup hook
in Cloud / Enterprise. In OSS, the audit log wrapper is never
configured and any usage events are sent to a no-op discard reporter.

Usage events are defined in prehog and can be sent to the new
UsageReporter Service on the auth server. An audit event wrapper is
used to capture certain events that are otherwise difficult to hook.
Events are anonymized before submission, then held in a non-blocking
queue for batching and submission purposes.

* Remove dead code

* Add SubmitUsageEvent RPC to Auth.

This adds a new SubmitUsageEvent RPC to the Auth API that external
clients (e.g. the UI) can use to submit usage events externally.

* Slight refactor for unit testing

* Add Prometheus metrics and add initial working prehog submitter

* Add more metrics, tweak prehog client, and add unit tests

* Further tweak http transport settings based on Teleport defaults

* Add missing metrics

* Fix goimports

* Add new UI usage events

* Update e ref

* Add prehog directly for now. Improve logging.

* update prehog

* Add new prehog events; use username from request identity

* add HTTP server for user events

* Add username back to pre-onboard events

* unauthenticated user events

* Fix userevent build error

* Use event-provided username where appropriate

* Move barebones prehog reqs to lib/prehog and generate here.

Also, use prod tunable values.

* Fix license lints

* De-flake tests by adding unfortunate amounts of synchronization.

* Add missing license header

* Misc PR cleanup for review

* Update lib/events/usageevents/usageevents.go

Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>

* Address a batch of review comments

Adds `anonymizer.AnonymizeString` and parent loggers

* Update e ref

* Clean up comments

* Remove onboard prefix from recovery code event

* Address another batch of feedback

* Use defaults.HTTPClient()

* Remove a noisy log message

* Demote noisy log message to debug

* Temporarily revert e ref for merge

Co-authored-by: Michelle Bergquist <michelle.bergquist@goteleport.com>
Co-authored-by: Edoardo Spadolini <edoardo.spadolini@goteleport.com>
2022-12-05 17:13:54 +00:00