]> git.ipfire.org Git - people/stevee/selinux-policy.git/blame - policy/modules/kernel/files.te
Revert "Add files_add_entry_var_lib_dirs() interface"
[people/stevee/selinux-policy.git] / policy / modules / kernel / files.te
CommitLineData
e541d13a 1policy_module(files, 1.14.3)
960373dd 2
fd89e19f
CP
3########################################
4#
5# Declarations
6#
7
b4cd1533 8attribute file_type;
b518fc2e 9attribute files_unconfined_type;
b4cd1533 10attribute lockfile;
46410fd2 11attribute mountpoint;
b4cd1533 12attribute pidfile;
0059652b 13attribute spoolfile;
e8779130 14attribute configfile;
3eaa9939 15attribute etcfile;
a1fcff33
CP
16
17# For labeling types that are to be polyinstantiated
18attribute polydir;
19
20# And for labeling the parent directories of those polyinstantiated directories
21# This is necessary for remounting the original in the parent to give
22# security aware apps access
23attribute polyparent;
24
25# And labeling for the member directories
26attribute polymember;
27
a2868f6e
CP
28# sensitive security files whose accesses should
29# not be dontaudited for uses
30attribute security_file_type;
3338f231
CP
31# and its opposite
32attribute non_security_file_type;
a2868f6e 33
b4cd1533 34attribute tmpfile;
46410fd2 35attribute tmpfsfile;
b4cd1533 36
bbb7cc89
CP
37# this attribute is not currently used and will be removed in the future.
38# unfortunately, this attribute can not be removed yet because it may cause
39# some policies to fail to link if it is still required.
a65611d2
CP
40attribute usercanread;
41
1c1ac67f
CP
42#
43# boot_t is the type for files in /boot
44#
45type boot_t;
1c1ac67f
CP
46files_mountpoint(boot_t)
47
b4cd1533
CP
48# default_t is the default type for files that do not
49# match any specification in the file_contexts configuration
50# other than the generic /.* specification.
a65611d2
CP
51type default_t;
52files_mountpoint(default_t)
b4cd1533
CP
53
54#
55# etc_t is the type of the system etc directories.
56#
910b1d8e 57type etc_t, configfile;
a65611d2 58files_type(etc_t)
6b19be33
CP
59# compatibility aliases for removed types:
60typealias etc_t alias automount_etc_t;
788d88c9 61typealias etc_t alias snmpd_etc_t;
b4cd1533 62
3eaa9939
DW
63# system_conf_t is a new type of various
64# files in /etc/ that can be managed and
65# created by several domains.
66#
67type system_conf_t, configfile;
68files_type(system_conf_t)
69# compatibility aliases for removed type:
70typealias system_conf_t alias iptables_conf_t;
71
b4cd1533
CP
72#
73# etc_runtime_t is the type of various
74# files in /etc that are automatically
75# generated during initialization.
76#
3eaa9939 77type etc_runtime_t, configfile;
a65611d2 78files_type(etc_runtime_t)
693d4aed
CP
79#Temporarily in policy until FC5 dissappears
80typealias etc_runtime_t alias firstboot_rw_t;
b4cd1533
CP
81
82#
83# file_t is the default type of a file that has not yet been
84# assigned an extended attribute (EA) value (when using a filesystem
85# that supports EAs).
86#
a65611d2
CP
87type file_t;
88files_mountpoint(file_t)
0fd9dc55 89kernel_rootfs_mountpoint(file_t)
e02c61cf 90sid file gen_context(system_u:object_r:file_t,s0)
b4cd1533 91
b4cd1533
CP
92#
93# home_root_t is the type for the directory where user home directories
94# are created
95#
a65611d2
CP
96type home_root_t;
97files_mountpoint(home_root_t)
0f27d98d 98files_poly_parent(home_root_t)
b4cd1533
CP
99
100#
101# lost_found_t is the type for the lost+found directories.
102#
a65611d2
CP
103type lost_found_t;
104files_type(lost_found_t)
b4cd1533
CP
105
106#
107# mnt_t is the type for mount points such as /mnt/cdrom
108#
a65611d2
CP
109type mnt_t;
110files_mountpoint(mnt_t)
b4cd1533 111
1c1ac67f
CP
112#
113# modules_object_t is the type for kernel modules
114#
115type modules_object_t;
116files_type(modules_object_t)
117
a65611d2
CP
118type no_access_t;
119files_type(no_access_t)
219bcf7a 120
a65611d2
CP
121type poly_t;
122files_type(poly_t)
219bcf7a 123
a65611d2
CP
124type readable_t;
125files_type(readable_t)
219bcf7a 126
a2d8246b
CP
127#
128# root_t is the type for rootfs and the root directory.
129#
a65611d2
CP
130type root_t;
131files_mountpoint(root_t)
0f27d98d 132files_poly_parent(root_t)
0fd9dc55 133kernel_rootfs_mountpoint(root_t)
e02c61cf 134genfscon rootfs / gen_context(system_u:object_r:root_t,s0)
a2d8246b 135
b4cd1533
CP
136#
137# src_t is the type of files in the system src directories.
138#
a65611d2
CP
139type src_t;
140files_mountpoint(src_t)
b4cd1533 141
1c1ac67f
CP
142#
143# system_map_t is for the system.map files in /boot
144#
145type system_map_t;
146files_type(system_map_t)
b5d3774a 147kernel_proc_type(system_map_t)
037fc0f4 148genfscon proc /kallsyms gen_context(system_u:object_r:system_map_t,s0)
1c1ac67f 149
b4cd1533
CP
150#
151# tmp_t is the type of the temporary directories
152#
a65611d2 153type tmp_t;
c3cf6693 154files_tmp_file(tmp_t)
a65611d2
CP
155files_mountpoint(tmp_t)
156files_poly(tmp_t)
0f27d98d 157files_poly_parent(tmp_t)
b4cd1533
CP
158
159#
160# usr_t is the type for /usr.
161#
a65611d2
CP
162type usr_t;
163files_mountpoint(usr_t)
b4cd1533
CP
164
165#
166# var_t is the type of /var
167#
a65611d2
CP
168type var_t;
169files_mountpoint(var_t)
b4cd1533
CP
170
171#
172# var_lib_t is the type of /var/lib
173#
a65611d2
CP
174type var_lib_t;
175files_mountpoint(var_lib_t)
b4cd1533
CP
176
177#
178# var_lock_t is tye type of /var/lock
179#
a65611d2 180type var_lock_t;
54b4b8ab 181files_lock_file(var_lock_t)
ef1dec5b 182files_mountpoint(var_lock_t)
b4cd1533
CP
183
184#
185# var_run_t is the type of /var/run, usually
186# used for pid and other runtime files.
187#
a65611d2
CP
188type var_run_t;
189files_pid_file(var_run_t)
14c0edc7 190files_mountpoint(var_run_t)
b4cd1533
CP
191
192#
193# var_spool_t is the type of /var/spool
194#
c3cf6693
CP
195type var_spool_t;
196files_tmp_file(var_spool_t)
0059652b 197files_spool_file(var_spool_t)
a65611d2
CP
198
199########################################
200#
201# Rules for all file types
202#
203
204allow file_type self:filesystem associate;
205
206fs_associate(file_type)
207fs_associate_noxattr(file_type)
350b6ab7 208fs_associate_tmpfs(file_type)
495df416 209fs_associate_ramfs(file_type)
48e0aa86 210fs_associate_hugetlbfs(file_type)
165b42d2 211
a65611d2
CP
212########################################
213#
214# Rules for all tmp file types
215#
216
a65fd90a 217allow file_type tmp_t:filesystem associate;
a65611d2
CP
218
219fs_associate_tmpfs(tmpfile)
220
221########################################
222#
223# Rules for all tmpfs file types
224#
225
226fs_associate_tmpfs(tmpfsfile)
b518fc2e
CP
227
228########################################
229#
230# Unconfined access to this module
231#
232
233# Create/access any file in a labeled filesystem;
234allow files_unconfined_type file_type:{ file chr_file } ~execmod;
235allow files_unconfined_type file_type:{ dir lnk_file sock_file fifo_file blk_file } *;
236
dccbb80c 237# Mount/unmount any filesystem with the context= option.
b518fc2e
CP
238allow files_unconfined_type file_type:filesystem *;
239
350b6ab7
CP
240tunable_policy(`allow_execmod',`
241 allow files_unconfined_type file_type:file execmod;
b518fc2e 242')