Skip to content
This repository was archived by the owner on Oct 21, 2024. It is now read-only.

Commit 9be2840

Browse files
committed
tunnel: improve logging for tunnel install
1 parent 28a3dfa commit 9be2840

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/tunnel/tunnel.go

+4
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ func Install() error {
3737
err = os.Chmod(BINARY_PATH, 0755)
3838
user := os.Getenv("SUDO_USER")
3939
sudoersPath := "/etc/sudoers.d/sst-" + user
40+
slog.Info("creating sudoers file", "path", sudoersPath)
4041
command := BINARY_PATH + " tunnel start *"
4142
sudoersEntry := fmt.Sprintf("%s ALL=(ALL) NOPASSWD:SETENV: %s\n", user, command)
43+
slog.Info("sudoers entry", "entry", sudoersEntry)
4244
err = os.WriteFile(sudoersPath, []byte(sudoersEntry), 0440)
4345
if err != nil {
4446
return err
@@ -49,8 +51,10 @@ func Install() error {
4951
} else {
5052
cmd = exec.Command("visudo", "-c", "-f", sudoersPath)
5153
}
54+
slog.Info("running visudo", "cmd", cmd.Args)
5255
err = cmd.Run()
5356
if err != nil {
57+
slog.Error("failed to run visudo", "error", err)
5458
os.Remove(sudoersPath)
5559
return util.NewReadableError(err, "Error validating sudoers file")
5660
}

0 commit comments

Comments
 (0)