Skip to content

Commit 3c21258

Browse files
committed
OpenBSD: Pledge full filesystem read for Go's resolv.conf polling
sys/kern/kern_pledge.c r1.329[0] removed the unveil bypass for "dns", so "rpath" is needed for Go's DNS to stat(2) it. Since current "/ rwc" and "cpath" with the new "rpath" amount to full read access, there is no point in unveiling anymore. 0: openbsd/src@8d49ad0
1 parent 429403a commit 3c21258

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

cmd/yggdrasil/main.go

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,6 @@ type node struct {
4141

4242
// The main function is responsible for configuring and starting Yggdrasil.
4343
func main() {
44-
// Not all operations are coverable with pledge(2), so immediately
45-
// limit file system access with unveil(2), effectively preventing
46-
// "proc exec" promises right from the start:
47-
//
48-
// - read arbitrary config file
49-
// - create/write arbitrary log file
50-
// - read/write/chmod/remove admin socket, if at all
51-
if err := protect.Unveil("/", "rwc"); err != nil {
52-
panic(fmt.Sprintf("unveil: / rwc: %v", err))
53-
}
54-
if err := protect.UnveilBlock(); err != nil {
55-
panic(fmt.Sprintf("unveil: %v", err))
56-
}
57-
5844
genconf := flag.Bool("genconf", false, "print a new config to stdout")
5945
useconf := flag.Bool("useconf", false, "read HJSON/JSON config from stdin")
6046
useconffile := flag.String("useconffile", "", "read HJSON/JSON config from specified file path")
@@ -319,7 +305,7 @@ func main() {
319305
//
320306
// Peers, InterfacePeers, Listen can be UNIX sockets;
321307
// Go's net.Listen.Close() deletes files on shutdown.
322-
promises := []string{"stdio", "cpath", "inet", "unix", "dns"}
308+
promises := []string{"stdio", "rpath", "cpath", "inet", "unix", "dns"}
323309
if len(cfg.MulticastInterfaces) > 0 {
324310
promises = append(promises, "mcast")
325311
}

0 commit comments

Comments
 (0)