put socket in home and tighten perms

This commit is contained in:
Aaron Bieber 2023-11-22 08:53:42 -07:00
parent d9900282d4
commit 1e5cf2c37c
No known key found for this signature in database

10
main.go
View File

@ -6,6 +6,7 @@ import (
"net" "net"
"os" "os"
"os/signal" "os/signal"
"path"
"syscall" "syscall"
"time" "time"
@ -16,8 +17,12 @@ import (
"golang.org/x/crypto/ssh/agent" "golang.org/x/crypto/ssh/agent"
) )
func init() {
syscall.Umask(0077)
}
func main() { 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") cmdList := flag.String("c", "/etc/traygent.json", "List of commands to execute")
flag.Parse() flag.Parse()
@ -37,8 +42,6 @@ func main() {
os.Exit(0) os.Exit(0)
}(sig) }(sig)
app := app.NewWithID("traygent")
cmds := LoadCommands(*cmdList) cmds := LoadCommands(*cmdList)
tagent := Traygent{ tagent := Traygent{
listener: l, listener: l,
@ -48,6 +51,7 @@ func main() {
sigResp: make(chan bool), sigResp: make(chan bool),
} }
app := app.NewWithID("traygent")
var desk desktop.App var desk desktop.App
var ok bool var ok bool
if desk, ok = app.(desktop.App); ok { if desk, ok = app.(desktop.App); ok {