Skip to content

Commit

Permalink
Fixes the KUBECONFIG file permission (#64)
Browse files Browse the repository at this point in the history
Previously the KUBECONFIG file had more permissions than required and was not aligned with the best practices.

This PR modifies the permission to 0400.
  • Loading branch information
Ranjandas authored Aug 9, 2024
1 parent 8d42ae2 commit b7f8a36
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"math/rand"
"os"
"os/exec"
"path/filepath"
"strings"

lima "github.com/ranjandas/shikari/app/lima"
Expand Down Expand Up @@ -296,6 +297,14 @@ func (c ClientConfigOpts) copyK3SKubeConfig() error {

// Run the command
err := cmd.Run()
if err != nil {
return err
}

// Set 0600 permission as a best practice
filepath := filepath.Join(vm.Dir, "k3s.yaml")

err = os.Chmod(filepath, 0400)

return err
}
Expand Down

0 comments on commit b7f8a36

Please sign in to comment.