summary refs log tree commit diff stats
path: root/cmd/cetus/main.go
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-04-24 19:46:49 +0530
committerAndinus <andinus@nand.sh>2020-04-24 19:46:49 +0530
commita01ce7b96892849d91911a2ef143a08b8e4e57c5 (patch)
tree2a5b7148c34051bfb674c52a40e6e924ab43c6dd /cmd/cetus/main.go
parent14916180447e88eafe09c6a7e8289baacd2194ad (diff)
downloadcetus-a01ce7b96892849d91911a2ef143a08b8e4e57c5.tar.gz
Upgrade to lynx v0.4.0
Diffstat (limited to 'cmd/cetus/main.go')
-rw-r--r--cmd/cetus/main.go47
1 files changed, 47 insertions, 0 deletions
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)
+	}
+}