Skip to content

Commit

Permalink
add more logging to hardware runners (kolide#2013)
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Pickett authored Dec 20, 2024
1 parent c8ff2ab commit 730f144
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
8 changes: 8 additions & 0 deletions ee/secureenclaverunner/secureenclaverunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ func (ser *secureEnclaveRunner) currentConsoleUserKey(ctx context.Context) (*ecd

key, ok := ser.uidPubKeyMap[cu.Uid]
if ok {
ser.slogger.Log(ctx, slog.LevelDebug,
"found existing key for console user",
"uid", cu.Uid,
)
span.AddEvent("found_existing_key_for_console_user")
return key, nil
}
Expand All @@ -207,6 +211,10 @@ func (ser *secureEnclaveRunner) currentConsoleUserKey(ctx context.Context) (*ecd
return nil, fmt.Errorf("creating key: %w", err)
}

ser.slogger.Log(ctx, slog.LevelInfo,
"created new key for console user",
"uid", cu.Uid,
)
span.AddEvent("created_new_key_for_console_user")

ser.uidPubKeyMap[cu.Uid] = key
Expand Down
12 changes: 7 additions & 5 deletions ee/tpmrunner/tpmrunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (tr *tpmRunner) Execute() error {
continue
case <-tr.interrupt:
tr.slogger.Log(context.TODO(), slog.LevelDebug,
"interrupt received, exiting secure enclave signer execute loop",
"interrupt received, exiting tpm signer execute loop",
)
return nil
}
Expand Down Expand Up @@ -208,10 +208,6 @@ func (tr *tpmRunner) loadOrCreateKeys(ctx context.Context) error {
}

if pubData == nil || priData == nil {
tr.slogger.Log(ctx, slog.LevelInfo,
"generating new tpm keys",
)

var err error
priData, pubData, err = tr.signerCreator.CreateKey()
if err != nil {
Expand All @@ -230,6 +226,9 @@ func (tr *tpmRunner) loadOrCreateKeys(ctx context.Context) error {
return thisErr
}

tr.slogger.Log(ctx, slog.LevelInfo,
"new tpm keys generated",
)
span.AddEvent("generated_new_tpm_keys")
}

Expand All @@ -242,6 +241,9 @@ func (tr *tpmRunner) loadOrCreateKeys(ctx context.Context) error {

tr.signer = k

tr.slogger.Log(ctx, slog.LevelDebug,
"tpm signer created",
)
span.AddEvent("created_tpm_signer")

return nil
Expand Down

0 comments on commit 730f144

Please sign in to comment.