Skip to content

Commit

Permalink
Only chmod kolide-owned directories
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaMahany committed Jul 26, 2023
1 parent 4cedba8 commit 06b74cb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cmd/launcher/launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,16 @@ func runLauncher(ctx context.Context, cancel func(), opts *launcher.Options) err
// Ensure permissions are correct, regardless of umask settings -- we use
// DirMode (0755) because the desktop processes that run as the user
// must be able to access the root directory as well.
if err := os.Chmod(filepath.Dir(rootDirectory), fsutil.DirMode); err != nil {
return fmt.Errorf("chmodding root directory parent: %w", err)
}
if err := os.Chmod(rootDirectory, fsutil.DirMode); err != nil {
return fmt.Errorf("chmodding root directory: %w", err)
}
if filepath.Dir(rootDirectory) == "/var/kolide-k2" {
// We need to ensure the same for the parent of the root directory, but we only
// want to do the same for Kolide-created directories.
if err := os.Chmod(filepath.Dir(rootDirectory), fsutil.DirMode); err != nil {
return fmt.Errorf("chmodding root directory parent: %w", err)
}
}

if _, err := osquery.DetectPlatform(); err != nil {
return fmt.Errorf("detecting platform: %w", err)
Expand Down

0 comments on commit 06b74cb

Please sign in to comment.