]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSMacOSX/mDNSResponder.sb
mDNSResponder-379.27.tar.gz
[apple/mdnsresponder.git] / mDNSMacOSX / mDNSResponder.sb
1 ; -*- Mode: Scheme; tab-width: 4 -*-
2 ;
3 ; Copyright (c) 2012 Apple Inc. All rights reserved.
4 ;
5 ; Redistribution and use in source and binary forms, with or without
6 ; modification, are permitted provided that the following conditions are met:
7 ;
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.
16 ;
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.
27 ;
28 ;############################################################################
29
30
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.
33
34 (version 1)
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
37 ; symbolification.
38 (deny default (with no-callout))
39
40 (import "system.sb")
41
42 ; Baseline
43 (allow file-read-metadata ipc-posix-shm)
44
45 ; Mach communications
46 ; These are needed for things like getpwnam, hostname changes, & keychain
47 (allow mach-lookup
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"))
65
66 ; Networking, including Unix Domain Sockets
67 (allow network*)
68
69 ; Raw sockets
70 (if (defined? 'system-socket)
71 (allow system-socket))
72
73 ; Hardware model information
74 (allow sysctl-read)
75
76 ; Syslog early in the boot process
77 (allow file-read-data file-write-data (literal "/dev/console"))
78
79 (allow file-read-data
80 ; /etc/hosts support
81 (literal "/private/etc/hosts")
82 (literal "/private/etc"))
83
84 ; Our socket
85 (allow file-read* file-write* (literal "/private/var/run/mDNSResponder"))
86
87 ; System version, settings, and other miscellaneous necessary file system accesses
88 (allow file-read-data
89 ; Needed for CFCopyVersionDictionary()
90 (literal "/usr/sbin")
91 (literal "/usr/sbin/mDNSResponder")
92
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"))
101
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"))
108
109 ; Our Module Directory Services cache
110 (allow file-read-data
111 (subpath "/private/var/tmp/mds")
112 (subpath "/private/var/db/mds"))
113
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(/|$)")
118
119 ; Required on 10.5 and 10.6
120 (regex #"^/private/var/folders/[^/]+/[^/]+/-Caches-/mds(/|$)"))
121
122 ; CRL Cache for SSL/TLS connections
123 (allow file-read-data (literal "/private/var/db/crls/crlcache.db"))
124
125 ; For mDNS sleep proxy offload and IOPMConnectionCreate
126 (if (defined? 'iokit-open)
127 (begin
128 (allow iokit-open
129 (iokit-user-client-class "NVEthernetUserClientMDNS")
130 (iokit-user-client-class "mDNSOffloadUserClient")
131 (iokit-user-client-class "RootDomainUserClient"))))