Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial_version to launcher info table, update a log line #1741

Merged
merged 4 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
8 changes: 8 additions & 0 deletions cmd/launcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ func runMain() int {
"revision", version.Version().Revision,
)

// Set an os environmental variable that we can use to track launcher versions across
// various bits of updated binaries
if chain := os.Getenv("KOLIDE_LAUNCHER_VERSION_CHAIN"); chain == "" {
os.Setenv("KOLIDE_LAUNCHER_VERSION_CHAIN", version.Version().Version)
} else {
os.Setenv("KOLIDE_LAUNCHER_VERSION_CHAIN", fmt.Sprintf("%s:%s", chain, version.Version().Version))
}

// create initial logger. As this is prior to options parsing,
// use the environment to determine verbosity. It will be
// re-leveled during options parsing.
Expand Down
11 changes: 8 additions & 3 deletions ee/agent/reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,16 @@ func DetectAndRemediateHardwareChange(ctx context.Context, k types.Knapsack) {
ctx, span := traces.StartSpan(ctx)
defer span.End()

k.Slogger().Log(ctx, slog.LevelDebug, "checking to see if database should be reset...")

serialChanged := false
hardwareUUIDChanged := false
munemoChanged := false

defer k.Slogger().Log(ctx, slog.LevelDebug, "checking to see if database should be reset...",
"serial", serialChanged,
"hardware_uuid", hardwareUUIDChanged,
"munemo", munemoChanged,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This data also gets logged on ~85 if any of them are true -- want to remove that extra log since it'd be redundant with this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tweaked a little. How's this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thummmbbbbss

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arrg. Committed too much. must revert

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


currentSerial, currentHardwareUUID, err := currentSerialAndHardwareUUID(ctx, k)
if err != nil {
k.Slogger().Log(ctx, slog.LevelWarn, "could not get current serial and hardware UUID", "err", err)
Expand All @@ -68,7 +74,6 @@ func DetectAndRemediateHardwareChange(ctx context.Context, k types.Knapsack) {
hardwareUUIDChanged = valueChanged(ctx, k, currentHardwareUUID, hostDataKeyHardwareUuid)
}

munemoChanged := false
currentTenantMunemo, err := currentMunemo(k)
if err != nil {
k.Slogger().Log(ctx, slog.LevelWarn, "could not get current munemo", "err", err)
Expand Down
3 changes: 3 additions & 0 deletions pkg/osquery/table/launcher_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
"os"
"runtime"

"github.com/kolide/kit/version"
Expand All @@ -27,6 +28,7 @@ func LauncherInfoTable(store types.GetterSetter) *table.Plugin {
table.TextColumn("goos"),
table.TextColumn("revision"),
table.TextColumn("version"),
table.TextColumn("version_chain"),
table.TextColumn("identifier"),
table.TextColumn("osquery_instance_id"),

Expand Down Expand Up @@ -75,6 +77,7 @@ func generateLauncherInfoTable(store types.GetterSetter) table.GenerateFunc {
"goos": runtime.GOOS,
"revision": version.Version().Revision,
"version": version.Version().Version,
"version_chain": os.Getenv("KOLIDE_LAUNCHER_VERSION_CHAIN"),
"identifier": identifier,
"osquery_instance_id": osqueryInstance.InstanceId,
"fingerprint": fingerprint,
Expand Down
Loading