about summary refs log tree commit diff
path: root/src/libstore/sandbox-defaults.sb.in
blob: 54e4530435043a380513c82235021d46503b7013 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
(allow file-read* file-write-data (literal "/dev/null"))
(allow ipc-posix*)
(allow mach-lookup (global-name "com.apple.SecurityServer"))

(allow file-read*
       (literal "/dev/dtracehelper")
       (literal "/dev/tty")
       (literal "/dev/autofs_nowait")
       (literal "/System/Library/CoreServices/SystemVersion.plist")
       (literal "/private/var/run/systemkeychaincheck.done")
       (literal "/private/etc/protocols")
       (literal "/private/var/tmp")
       (subpath "/usr/share/locale")
       (subpath "/usr/share/zoneinfo")
       (literal "/private/var/db")
       (subpath "/private/var/db/mds"))

(allow file-write*
       (literal "/dev/tty")
       (literal "/dev/dtracehelper")
       (literal "/mds"))

(allow file-ioctl (literal "/dev/dtracehelper"))

(allow file-read-metadata
       (literal "/var")
       (literal "/tmp")
       ; symlinks
       (literal "@sysconfdir@")
       (literal "@sysconfdir@/nix")
       (literal "@sysconfdir@/nix/nix.conf")
       (literal "/etc/resolv.conf")
       (literal "/private/etc/resolv.conf"))

(allow file-read*
       (literal "/private@sysconfdir@/nix/nix.conf")
       (literal "/private/var/run/resolv.conf"))

; some builders use filehandles other than stdin/stdout
(allow file* (subpath "/dev/fd"))

; allow everything inside TMP
(allow file* process-exec
       (subpath (param "_GLOBAL_TMP_DIR"))
       (subpath "/private/tmp"))

(allow process-fork)
(allow sysctl-read)
(allow signal (target same-sandbox))

; allow getpwuid (for git and other packages)
(allow mach-lookup
       (global-name "com.apple.system.notification_center")
       (global-name "com.apple.system.opendirectoryd.libinfo"))

; allow local networking
(allow network* (local ip) (remote unix-socket))