Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,477 changes: 1,251 additions & 1,226 deletions gen/proto/go/prehog/v1alpha/teleport.pb.go

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions gen/proto/js/prehog/v1alpha/teleport_pb.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 62 additions & 2 deletions gen/proto/js/prehog/v1alpha/teleport_pb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 10 additions & 9 deletions lib/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -2255,7 +2255,7 @@ func (a *Server) AugmentContextUserCertificates(

// submitCertificateIssuedEvent submits a certificate issued usage event to the
// usage reporting service.
func (a *Server) submitCertificateIssuedEvent(req *certRequest) {
func (a *Server) submitCertificateIssuedEvent(req *certRequest, params services.UserCertParams) {
var database, app, kubernetes, desktop bool

if req.dbService != "" {
Expand Down Expand Up @@ -2291,13 +2291,14 @@ func (a *Server) submitCertificateIssuedEvent(req *certRequest) {
}

a.AnonymizeAndSubmit(&usagereporter.UserCertificateIssuedEvent{
UserName: user,
Ttl: durationpb.New(req.ttl),
IsBot: bot,
UsageDatabase: database,
UsageApp: app,
UsageKubernetes: kubernetes,
UsageDesktop: desktop,
UserName: user,
Ttl: durationpb.New(req.ttl),
IsBot: bot,
UsageDatabase: database,
UsageApp: app,
UsageKubernetes: kubernetes,
UsageDesktop: desktop,
PrivateKeyPolicy: string(params.PrivateKeyPolicy),
})
}

Expand Down Expand Up @@ -2649,7 +2650,7 @@ func generateCert(a *Server, req certRequest, caType types.CertAuthType) (*proto
certs.SSHCACerts = append(certs.SSHCACerts, services.GetSSHCheckingKeys(ca)...)
}

a.submitCertificateIssuedEvent(&req)
a.submitCertificateIssuedEvent(&req, params)

userCertificatesGeneratedMetric.WithLabelValues(string(attestedKeyPolicy)).Inc()

Expand Down
7 changes: 4 additions & 3 deletions lib/usagereporter/teleport/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ func ConvertAuditEvent(event apievents.AuditEvent) Anonymizable {
// SSO) if desired, but we currently only care about connector type /
// method
return &UserLoginEvent{
UserName: e.User,
ConnectorType: e.Method,
DeviceId: deviceID,
UserName: e.User,
ConnectorType: e.Method,
DeviceId: deviceID,
RequiredPrivateKeyPolicy: e.RequiredPrivateKeyPolicy,
}

case *apievents.SessionStart:
Expand Down
7 changes: 4 additions & 3 deletions lib/usagereporter/teleport/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ func (u *UserLoginEvent) Anonymize(a utils.Anonymizer) prehogv1a.SubmitEventRequ
return prehogv1a.SubmitEventRequest{
Event: &prehogv1a.SubmitEventRequest_UserLogin{
UserLogin: &prehogv1a.UserLoginEvent{
UserName: a.AnonymizeString(u.UserName),
ConnectorType: u.ConnectorType,
DeviceId: deviceID,
UserName: a.AnonymizeString(u.UserName),
ConnectorType: u.ConnectorType,
DeviceId: deviceID,
RequiredPrivateKeyPolicy: u.RequiredPrivateKeyPolicy,
},
},
}
Expand Down
6 changes: 6 additions & 0 deletions proto/prehog/v1alpha/teleport.proto
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ message UserLoginEvent {
//
// PostHog property: tp.device_id
string device_id = 3;

// the required private key policy for this login.
string required_private_key_policy = 4;
}

message SSOCreateEvent {
Expand Down Expand Up @@ -224,6 +227,9 @@ message UserCertificateIssuedEvent {
// If true, the certificate usage is restricted to desktop access.
// PostHog property: tp.usage_desktop
bool usage_desktop = 7;

// the private key policy associated with these user certificates.
string private_key_policy = 8;
}

// UIBannerClickEvent is a usage event sent by the UI when the upgrade
Expand Down