From 1e5cf2c37ce31f538702d64aca15f5e558d58729 Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Wed, 22 Nov 2023 08:53:42 -0700 Subject: [PATCH] put socket in home and tighten perms --- main.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index c3313ad..ad859e0 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ import ( "net" "os" "os/signal" + "path" "syscall" "time" @@ -16,8 +17,12 @@ import ( "golang.org/x/crypto/ssh/agent" ) +func init() { + syscall.Umask(0077) +} + func main() { - sock := flag.String("s", "/tmp/traygent", "Socket path to create") + sock := flag.String("s", path.Join(os.Getenv("HOME"), ".traygent"), "Socket path to create") cmdList := flag.String("c", "/etc/traygent.json", "List of commands to execute") flag.Parse() @@ -37,8 +42,6 @@ func main() { os.Exit(0) }(sig) - app := app.NewWithID("traygent") - cmds := LoadCommands(*cmdList) tagent := Traygent{ listener: l, @@ -48,6 +51,7 @@ func main() { sigResp: make(chan bool), } + app := app.NewWithID("traygent") var desk desktop.App var ok bool if desk, ok = app.(desktop.App); ok {