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

Set config on interactive command in osquery checkup #1968

Merged
Merged
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
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())
Copy link
Contributor

Choose a reason for hiding this comment

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

🔥

}

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
Loading