2 ;;; GNU Guix --- Functional package management for GNU
3 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
5 ;;; This file is part of GNU Guix.
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20 ;; This is a specification for SELinux 2.7 written in the SELinux Common
21 ;; Intermediate Language (CIL). It refers to types that must be defined in
22 ;; the system's base policy.
25 ;; Require existing types
26 (typeattributeset cil_gen_require init_t)
27 (typeattributeset cil_gen_require tmp_t)
28 (typeattributeset cil_gen_require nscd_var_run_t)
29 (typeattributeset cil_gen_require var_log_t)
30 (typeattributeset cil_gen_require domain)
34 (roletype object_r guix_daemon_t)
35 (type guix_daemon_conf_t)
36 (roletype object_r guix_daemon_conf_t)
37 (type guix_daemon_exec_t)
38 (roletype object_r guix_daemon_exec_t)
39 (type guix_daemon_socket_t)
40 (roletype object_r guix_daemon_socket_t)
41 (type guix_store_content_t)
42 (roletype object_r guix_store_content_t)
43 (type guix_profiles_t)
44 (roletype object_r guix_profiles_t)
46 ;; These types are domains, thereby allowing process rules
47 (typeattributeset domain (guix_daemon_t guix_daemon_exec_t))
51 ;; When a process in init_t or guix_store_content_t spawns a
52 ;; guix_daemon_exec_t process, let it run in the guix_daemon_t context
53 (typetransition init_t guix_daemon_exec_t
54 process guix_daemon_t)
55 (typetransition guix_store_content_t guix_daemon_exec_t
56 process guix_daemon_t)
58 ;; Permit communication with NSCD
73 (unix_stream_socket (connectto)))
75 ;; Permit logging and temp file access
78 (lnk_file (setattr unlink)))
89 (file (create getattr open write)))
92 (dir (getattr write add_name)))
100 ;; Spawning processes, execute helpers
106 (file (execute execute_no_trans read open)))
114 (filesystem (getattr)))
115 (allow guix_daemon_conf_t
117 (filesystem (associate)))
123 (allow guix_store_content_t
125 (filesystem (associate)))
131 (capability (net_admin
134 dac_override dac_read_search
138 (filesystem (unmount)))
141 (filesystem (mount)))
144 (chr_file (setattr getattr)))
147 (filesystem (mount)))
153 (filesystem (mount)))
156 (chr_file (getattr open read write)))
159 (chr_file (getattr)))
162 (chr_file (getattr)))
165 (chr_file (getattr)))
168 (chr_file (getattr)))
171 (chr_file (getattr)))
173 ;; Access to store items
188 execute execute_no_trans
201 ;; Access to configuration files and directories
218 (lnk_file (create getattr rename unlink)))
220 ;; Access to profiles
223 (dir (getattr setattr read open)))
226 (lnk_file (read getattr)))
228 ;; Access to profile links in the home directory
229 ;; TODO: allow access to profile links *anywhere* on the filesystem
232 (lnk_file (read getattr)))
243 (unix_stream_socket (write)))
246 (unix_stream_socket (listen)))
249 (sock_file (create unlink)))
252 (unix_stream_socket (create
258 (fifo_file (write read)))
261 (udp_socket (ioctl create)))
264 (filecon "@guix_sysconfdir@/guix(/.*)?"
265 any (system_u object_r guix_daemon_conf_t (low low)))
266 (filecon "@guix_localstatedir@/guix(/.*)?"
267 any (system_u object_r guix_daemon_conf_t (low low)))
268 (filecon "@guix_localstatedir@/guix/profiles(/.*)?"
269 any (system_u object_r guix_profiles_t (low low)))
271 dir (unconfined_u object_r guix_store_content_t (low low)))
272 (filecon "@storedir@(/.+)?"
273 any (unconfined_u object_r guix_store_content_t (low low)))
274 (filecon "@storedir@/[^/]+/.+"
275 any (unconfined_u object_r guix_store_content_t (low low)))
276 (filecon "@prefix@/bin/guix-daemon"
277 file (system_u object_r guix_daemon_exec_t (low low)))
278 (filecon "@storedir@/.+-(guix-.+|profile)/bin/guix-daemon"
279 file (system_u object_r guix_daemon_exec_t (low low)))
280 (filecon "@storedir@/.+-(guix-.+|profile)/libexec/guix-authenticate"
281 file (system_u object_r guix_daemon_exec_t (low low)))
282 (filecon "@storedir@/.+-(guix-.+|profile)/libexec/guix/(.*)?"
283 any (system_u object_r guix_daemon_exec_t (low low)))
284 (filecon "@guix_localstatedir@/guix/daemon-socket/socket"
285 any (system_u object_r guix_daemon_socket_t (low low))))