From a01ce7b96892849d91911a2ef143a08b8e4e57c5 Mon Sep 17 00:00:00 2001 From: Andinus Date: Fri, 24 Apr 2020 19:46:49 +0530 Subject: Upgrade to lynx v0.4.0 --- cmd/cetus/main.go | 47 ++++++++++++++++++++++++++++++++++++++++++++ cmd/cetus/main_openbsd.go | 50 ----------------------------------------------- cmd/cetus/main_other.go | 7 ------- go.mod | 5 +---- go.sum | 2 ++ 5 files changed, 50 insertions(+), 61 deletions(-) create mode 100644 cmd/cetus/main.go delete mode 100644 cmd/cetus/main_openbsd.go delete mode 100644 cmd/cetus/main_other.go diff --git a/cmd/cetus/main.go b/cmd/cetus/main.go new file mode 100644 index 0000000..b8098be --- /dev/null +++ b/cmd/cetus/main.go @@ -0,0 +1,47 @@ +package main + +import ( + "log" + + "tildegit.org/andinus/cetus/cache" + "tildegit.org/andinus/lynx" +) + +func main() { + unveil() + app() +} + +func unveil() { + paths := make(map[string]string) + + paths[cache.Dir()] = "rwc" + paths["/dev/null"] = "rw" // required by feh + paths["/etc/resolv.conf"] = "r" + + // ktrace output + paths["/usr/libexec/ld.so"] = "r" + paths["/var/run/ld.so.hints"] = "r" + paths["/usr/lib"] = "r" + paths["/dev/urandom"] = "r" + paths["/etc/hosts"] = "r" + paths["/etc/ssl"] = "r" + + err := lynx.UnveilPaths(paths) + if err != nil { + log.Fatal(err) + } + + commands := []string{"feh", "gsettings", "pcmanfm", "notify-send"} + + err = lynx.UnveilCommands(commands) + if err != nil { + log.Fatal(err) + } + + // Block further unveil calls + err = lynx.UnveilBlock() + if err != nil { + log.Fatal(err) + } +} diff --git a/cmd/cetus/main_openbsd.go b/cmd/cetus/main_openbsd.go deleted file mode 100644 index 7e19f5b..0000000 --- a/cmd/cetus/main_openbsd.go +++ /dev/null @@ -1,50 +0,0 @@ -// +build openbsd - -package main - -import ( - "log" - - "golang.org/x/sys/unix" - "tildegit.org/andinus/cetus/cache" - "tildegit.org/andinus/lynx" -) - -func main() { - unveil() - app() -} - -func unveil() { - paths := make(map[string]string) - - paths[cache.Dir()] = "rwc" - paths["/dev/null"] = "rw" // required by feh - paths["/etc/resolv.conf"] = "r" - - // ktrace output - paths["/usr/libexec/ld.so"] = "r" - paths["/var/run/ld.so.hints"] = "r" - paths["/usr/lib"] = "r" - paths["/dev/urandom"] = "r" - paths["/etc/hosts"] = "r" - paths["/etc/ssl"] = "r" - - err := lynx.UnveilPaths(paths) - if err != nil { - log.Fatal(err) - } - - commands := []string{"feh", "gsettings", "pcmanfm", "notify-send"} - - err = lynx.UnveilCommands(commands) - if err != nil { - log.Fatal(err) - } - - // Block further unveil calls - err = unix.UnveilBlock() - if err != nil { - log.Fatal(err) - } -} diff --git a/cmd/cetus/main_other.go b/cmd/cetus/main_other.go deleted file mode 100644 index d39e66f..0000000 --- a/cmd/cetus/main_other.go +++ /dev/null @@ -1,7 +0,0 @@ -// +build !openbsd - -package main - -func main() { - app() -} diff --git a/go.mod b/go.mod index 52e6818..cc3f114 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,4 @@ module tildegit.org/andinus/cetus go 1.13 -require ( - golang.org/x/sys v0.0.0-20200331124033-c3d80250170d - tildegit.org/andinus/lynx v0.1.0 -) +require tildegit.org/andinus/lynx v0.4.0 diff --git a/go.sum b/go.sum index 0c63acf..b3f38e8 100644 --- a/go.sum +++ b/go.sum @@ -2,3 +2,5 @@ golang.org/x/sys v0.0.0-20200331124033-c3d80250170d h1:nc5K6ox/4lTFbMVSL9WRR81ix golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= tildegit.org/andinus/lynx v0.1.0 h1:7YjyF8h7MBGKRgQZT0j0I3uHRPf3mI2GMiDujXVlLS0= tildegit.org/andinus/lynx v0.1.0/go.mod h1:/PCNkKwfJ7pb6ziHa76a4gYp1R9S1Ro4ANjQwzSpBIk= +tildegit.org/andinus/lynx v0.4.0 h1:bAxZLOdWy66+qJ3bDWjkbmJfCWTIOZ8hMGzYt7T7Bxk= +tildegit.org/andinus/lynx v0.4.0/go.mod h1:/PCNkKwfJ7pb6ziHa76a4gYp1R9S1Ro4ANjQwzSpBIk= -- cgit 1.4.1-2-gfad0