1 ; -*- Mode: Scheme; tab-width: 4 -*-
3 ; Copyright (c) 2012 Apple Inc. All rights reserved.
5 ; Redistribution and use in source and binary forms, with or without
6 ; modification, are permitted provided that the following conditions are met:
8 ; 1. Redistributions of source code must retain the above copyright notice,
9 ; this list of conditions and the following disclaimer.
10 ; 2. Redistributions in binary form must reproduce the above copyright notice,
11 ; this list of conditions and the following disclaimer in the documentation
12 ; and/or other materials provided with the distribution.
13 ; 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of its
14 ; contributors may be used to endorse or promote products derived from this
15 ; software without specific prior written permission.
17 ; THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18 ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 ; DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21 ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 ;############################################################################
31 ; WARNING: The sandbox rule capabilities and syntax used in this file are currently an
32 ; Apple SPI (System Private Interface) and are subject to change at any time without notice.
35 ; When mDNSResponder is denied access, we want to avoid symoblification of mDNSResponder
36 ; to get the stack trace as that can get into deadlock. no-callout will prevent
38 (deny default (with no-callout))
43 (allow file-read-metadata ipc-posix-shm)
46 ; These are needed for things like getpwnam, hostname changes, & keychain
48 (global-name "com.apple.bsd.dirhelper")
49 (global-name "com.apple.distributed_notifications.2")
50 (global-name "com.apple.ocspd")
51 (global-name "com.apple.PowerManagement.control")
52 (global-name "com.apple.mDNSResponderHelper")
53 (global-name "com.apple.SecurityServer")
54 (global-name "com.apple.SystemConfiguration.configd")
55 (global-name "com.apple.SystemConfiguration.SCNetworkReachability")
56 (global-name "com.apple.system.notification_center")
57 (global-name "com.apple.system.logger")
58 (global-name "com.apple.webcontentfilter.dns")
59 (global-name "com.apple.server.bluetooth")
60 (global-name "com.apple.awacs")
61 (global-name "com.apple.networkd")
62 (global-name "com.apple.securityd")
63 (global-name "com.apple.wifi.manager")
64 (global-name "com.apple.blued"))
66 ; Networking, including Unix Domain Sockets
70 (if (defined? 'system-socket)
71 (allow system-socket))
73 ; Hardware model information
76 ; Syslog early in the boot process
77 (allow file-read-data file-write-data (literal "/dev/console"))
81 (literal "/private/etc/hosts")
82 (literal "/private/etc"))
85 (allow file-read* file-write* (literal "/private/var/run/mDNSResponder"))
87 ; System version, settings, and other miscellaneous necessary file system accesses
89 ; Needed for CFCopyVersionDictionary()
91 (literal "/usr/sbin/mDNSResponder")
93 (literal "/Library/Preferences/SystemConfiguration/preferences.plist")
94 (literal "/Library/Preferences/SystemConfiguration/com.apple.nat.plist")
95 (regex #"^/Library/Preferences/(ByHost/)?\.GlobalPreferences\.")
96 (literal "/Library/Preferences/com.apple.crypto.plist")
97 (literal "/Library/Security/Trust Settings/Admin.plist")
98 (regex #"^/Library/Preferences/com\.apple\.security\.")
99 (literal "/Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist")
100 (literal "/private/var/preferences/SystemConfiguration/preferences.plist"))
102 ; We just need access to System.keychain. But we don't want errors logged if other keychains are
103 ; accessed under /Library/Keychains. Other keychains may be accessed as part of setting up an SSL
104 ; connection. Instead of adding access to it here (to things which we don't need), we disable any
105 ; logging that might happen during the access
106 (deny file-read-data (regex #"^/Library/Keychains/") (with no-log))
107 (allow file-read-data (literal "/Library/Keychains/System.keychain"))
109 ; Our Module Directory Services cache
110 (allow file-read-data
111 (subpath "/private/var/tmp/mds")
112 (subpath "/private/var/db/mds"))
114 (allow file-read* file-write*
115 (regex #"^/private/var/tmp/mds/[0-9]+(/|$)")
116 (regex #"^/private/var/db/mds/[0-9]+(/|$)")
117 (regex #"^/private/var/folders/[^/]+/[^/]+/C/mds(/|$)")
119 ; Required on 10.5 and 10.6
120 (regex #"^/private/var/folders/[^/]+/[^/]+/-Caches-/mds(/|$)"))
122 ; CRL Cache for SSL/TLS connections
123 (allow file-read-data (literal "/private/var/db/crls/crlcache.db"))
125 ; For mDNS sleep proxy offload and IOPMConnectionCreate
126 (if (defined? 'iokit-open)
129 (iokit-user-client-class "NVEthernetUserClientMDNS")
130 (iokit-user-client-class "mDNSOffloadUserClient")
131 (iokit-user-client-class "RootDomainUserClient"))))