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 env vars to Kolide processes in checkup #1616

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
7 changes: 7 additions & 0 deletions ee/debug/checkups/processes.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ func (c *Processes) Run(ctx context.Context, fullWriter io.Writer) error {
exe, _ := p.Exe()
if strings.Contains(strings.ToLower(exe), "kolide") {
c.kolideCount += 1

// Grab ENV vars if available -- we ignore the error because we expect
// this function to return `ErrNotImplementedError` on darwin
if envVars, err := p.EnvironWithContext(ctx); err == nil {
pMap["env"] = strings.Join(envVars, " ")
Copy link
Contributor

@directionless directionless Feb 23, 2024

Choose a reason for hiding this comment

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

I don't think you need the strings.Join here, the map should handle any. And you can probably be even simpler and just do pMap["env"] = naIfError(p.EnvironWithContext(ctx))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks -- addressed here: #1622

}

c.data[fmt.Sprintf("%d", p.Pid)] = pMap

if !c.kolideRunningAsRoot {
Expand Down
Loading