Skip to content

Commit

Permalink
Set config on interactive command in osquery checkup (#1968)
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaMahany authored Nov 26, 2024
1 parent a35d78f commit b5ebe99
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ee/debug/checkups/osquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"time"

"github.com/kolide/launcher/ee/agent/types"
"github.com/kolide/launcher/pkg/launcher"
)

type osqueryCheckup struct {
Expand Down Expand Up @@ -66,10 +67,15 @@ func (o *osqueryCheckup) interactive(ctx context.Context) error {
return fmt.Errorf("getting current running executable: %w", err)
}

flagFilePath := launcher.DefaultPath(launcher.ConfigFile)
if o.k != nil && o.k.Identifier() != "" {
flagFilePath = strings.ReplaceAll(flagFilePath, launcher.DefaultLauncherIdentifier, o.k.Identifier())
}

cmdCtx, cmdCancel := context.WithTimeout(ctx, 20*time.Second)
defer cmdCancel()

cmd := exec.CommandContext(cmdCtx, launcherPath, "interactive", "--osqueryd_path", o.k.LatestOsquerydPath(ctx)) //nolint:forbidigo // It is safe to exec the current running executable
cmd := exec.CommandContext(cmdCtx, launcherPath, "interactive", "--config", flagFilePath, "--osqueryd_path", o.k.LatestOsquerydPath(ctx)) //nolint:forbidigo // It is safe to exec the current running executable
hideWindow(cmd)
cmd.Stdin = strings.NewReader(`select * from osquery_info;`)

Expand Down

0 comments on commit b5ebe99

Please sign in to comment.