-
Notifications
You must be signed in to change notification settings - Fork 1
/
homed.te
251 lines (188 loc) · 8.86 KB
/
homed.te
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
policy_module(homed, 0.2.0)
########################################
#
# Declarations
#
type systemd_homed_t;
type systemd_homed_exec_t;
init_daemon_domain(systemd_homed_t, systemd_homed_exec_t)
init_nnp_daemon_domain(systemd_homed_t)
type systemd_homework_t;
type systemd_homework_exec_t;
domain_type(systemd_homework_t)
domain_entry_file(systemd_homework_t, systemd_homework_exec_t)
role system_r types systemd_homework_t;
type systemd_homed_conf_dir_t;
files_config_file(systemd_homed_conf_dir_t)
type systemd_homed_conf_file_t;
files_config_file(systemd_homed_conf_file_t)
type systemd_homed_cryptsetup_dir_t;
files_pid_file(systemd_homed_cryptsetup_dir_t)
files_mountpoint(systemd_homed_cryptsetup_dir_t)
type systemd_homed_crypto_luks_t;
userdom_user_home_content(systemd_homed_crypto_luks_t)
type systemd_homed_library_dir_t;
files_type(systemd_homed_library_dir_t)
type systemd_homed_record_t;
files_auth_file(systemd_homed_record_t)
type systemd_homed_runtime_dir_t;
files_pid_file(systemd_homed_runtime_dir_t)
type systemd_homed_runtime_pipe_t;
files_pid_file(systemd_homed_runtime_pipe_t)
type systemd_homed_runtime_socket_t;
files_pid_file(systemd_homed_runtime_socket_t)
type systemd_homed_runtime_work_dir_t;
files_pid_file(systemd_homed_runtime_work_dir_t)
files_mountpoint(systemd_homed_runtime_work_dir_t)
type systemd_homed_tmpfs_t;
files_tmpfs_file(systemd_homed_tmpfs_t)
type systemd_homed_unit_file_t;
systemd_unit_file(systemd_homed_unit_file_t)
#######################################
#
# systemd_homed local policy
#
permissive systemd_homed_t; # to continue adding on to this policy
allow systemd_homed_t self:capability { sys_admin sys_resource };
allow systemd_homed_t self:capability { dac_override dac_read_search setuid setgid };
allow systemd_homed_t self:netlink_kobject_uevent_socket create_socket_perms;
allow systemd_homed_t self:unix_dgram_socket create_socket_perms;
domtrans_pattern(systemd_homed_t, systemd_homework_exec_t, systemd_homework_t)
allow systemd_homed_t systemd_homework_t:process2 nnp_transition;
# homed.conf
files_read_config_files(systemd_homed_t)
init_read_pid_files(systemd_homed_t)
libs_read_lib_files(systemd_homed_t)
# /var/home
files_watch_home(systemd_homed_t)
files_search_home(systemd_homed_t)
# labeled home directories
userdom_home_manager(systemd_homed_t)
userdom_manage_home_role(system_r, systemd_homed_t)
# unlabeled home directories
files_manage_isid_type_dirs(systemd_homed_t)
files_manage_isid_type_files(systemd_homed_t)
# /var/lib/systemd/home
manage_files_pattern(systemd_homed_t, systemd_homed_library_dir_t, systemd_homed_record_t)
init_var_lib_filetrans(systemd_homed_t, systemd_homed_library_dir_t, dir, "home")
filetrans_pattern(systemd_homed_t, systemd_homed_library_dir_t, systemd_homed_record_t, file)
# /var/run/systemd/home
create_dirs_pattern(systemd_homed_t, init_var_run_t, systemd_homed_runtime_dir_t)
init_pid_filetrans(systemd_homed_t, systemd_homed_runtime_dir_t, dir, "home")
# /var/run/systemd/home/*.dont-suspend
manage_fifo_files_pattern(systemd_homed_t, systemd_homed_runtime_dir_t, systemd_homed_runtime_pipe_t)
filetrans_pattern(systemd_homed_t, systemd_homed_runtime_dir_t, systemd_homed_runtime_pipe_t, fifo_file)
write_fifo_files_pattern(nsswitch_domain, systemd_homed_runtime_dir_t, systemd_homed_runtime_pipe_t)
# /var/run/systemd/home/notify
create_sock_files_pattern(systemd_homed_t, systemd_homed_runtime_dir_t, systemd_homed_runtime_socket_t)
delete_sock_files_pattern(systemd_homed_t, systemd_homed_runtime_dir_t, systemd_homed_runtime_socket_t)
write_sock_files_pattern(nsswitch_domain, systemd_homed_runtime_dir_t, systemd_homed_runtime_socket_t)
filetrans_pattern(systemd_homed_t, systemd_homed_runtime_dir_t, systemd_homed_runtime_socket_t, sock_file, "notify")
# /var/run/systemd/userdb/io.systemd.Home
systemd_manage_userdbd_runtime_sock_files(systemd_homed_t)
add_entry_dirs_pattern(systemd_homed_t, systemd_userdbd_runtime_t, systemd_userdbd_runtime_t)
filetrans_pattern(systemd_homed_t, systemd_userdbd_runtime_t, systemd_userdbd_runtime_t, sock_file, "io.systemd.Home")
allow nsswitch_domain systemd_homed_t:unix_stream_socket connectto;
# /tmp
rw_files_pattern(systemd_homed_t, systemd_homed_tmpfs_t, systemd_homed_tmpfs_t)
fs_tmpfs_filetrans(systemd_homed_t, systemd_homed_tmpfs_t, file)
kernel_dgram_send(systemd_homed_t)
kernel_read_system_state(systemd_homed_t)
auth_use_nsswitch(systemd_homed_t)
dev_getattr_generic_blk_files(systemd_homed_t)
dev_read_sysfs(systemd_homed_t)
fs_getattr_cgroup(systemd_homed_t)
fs_getattr_xattr_fs(systemd_homed_t)
fs_search_cgroup_dirs(systemd_homed_t)
fs_write_cgroup_files(systemd_homed_t)
logging_send_syslog_msg(systemd_homed_t)
miscfiles_read_all_certs(systemd_homed_t)
storage_getattr_fixed_disk_dev(systemd_homed_t)
storage_raw_read_removable_device(systemd_homed_t)
udev_manage_pid_files(systemd_homed_t)
usermanage_read_crack_db(systemd_homed_t)
optional_policy(`
container_runtime_read_tmpfs_files(systemd_homed_t)
')
optional_policy(`
dbus_connect_system_bus(systemd_homed_t)
init_dbus_chat(systemd_homed_t)
allow nsswitch_domain systemd_homed_t:dbus send_msg;
')
optional_policy(`
mta_getattr_spool(systemd_homed_t)
')
#######################################
#
# systemd_homework local policy
#
permissive systemd_homework_t; # to continue adding on to this policy
allow systemd_homework_t self:cap_userns { sys_admin sys_ptrace };
allow systemd_homework_t self:capability { chown fowner fsetid setfcap };
allow systemd_homework_t self:capability { dac_override dac_read_search setuid setgid };
allow systemd_homework_t self:capability { sys_admin sys_resource };
allow systemd_homework_t self:netlink_kobject_uevent_socket create_socket_perms;
allow systemd_homework_t self:process { setsched getsched };
allow systemd_homework_t self:sem create_sem_perms;
allow systemd_homework_t self:unix_dgram_socket create_socket_perms;
allow systemd_homework_t self:user_namespace create;
allow systemd_homework_t systemd_homed_t:unix_dgram_socket sendto;
# /var/home
delete_dirs_pattern(systemd_homework_t, home_root_t, home_root_t)
files_search_home(systemd_homework_t)
files_home_filetrans(systemd_homework_t, systemd_homed_crypto_luks_t, file)
files_home_filetrans(systemd_homework_t, user_home_dir_t, dir)
# labeled home directories
userdom_home_manager(systemd_homework_t)
userdom_manage_home_role(system_r, systemd_homework_t)
# unlabeled home directories
files_manage_isid_type_dirs(systemd_homework_t)
files_manage_isid_type_files(systemd_homework_t)
files_mounton_isid(systemd_homework_t)
mmap_rw_files_pattern(daemon, unlabeled_t, unlabeled_t) # colord_t
# /var/run/cryptsetup
manage_dirs_pattern(systemd_homework_t, var_run_t, systemd_homed_cryptsetup_dir_t)
manage_files_pattern(systemd_homework_t, systemd_homed_cryptsetup_dir_t, systemd_homed_cryptsetup_dir_t)
files_pid_filetrans(systemd_homework_t, systemd_homed_cryptsetup_dir_t, dir, "cryptsetup")
# /var/run/systemd/home/notify
write_sock_files_pattern(systemd_homework_t, systemd_homed_runtime_dir_t, systemd_homed_runtime_socket_t)
# /var/run/systemd/user-home-mount
create_dirs_pattern(systemd_homework_t, init_var_run_t, systemd_homed_runtime_work_dir_t)
read_files_pattern(systemd_homework_t, systemd_homed_runtime_work_dir_t, systemd_homed_record_t)
delete_files_pattern(systemd_homework_t, systemd_homed_runtime_work_dir_t, systemd_homed_record_t)
init_pid_filetrans(systemd_homework_t, systemd_homed_runtime_work_dir_t, dir, "user-home-mount")
# /tmp
rw_files_pattern(systemd_homework_t, systemd_homed_tmpfs_t, systemd_homed_tmpfs_t)
files_mounton_all_mountpoints(systemd_homework_t)
kernel_dgram_send(systemd_homework_t)
kernel_get_sysvipc_info(systemd_homework_t)
kernel_read_fs_sysctls(systemd_homework_t)
kernel_read_system_state(systemd_homework_t)
kernel_request_load_module(systemd_homework_t)
auth_read_passwd_file(systemd_homework_t)
corecmd_exec_shell(systemd_homework_t)
dev_getattr_fs(systemd_homework_t)
dev_read_rand(systemd_homework_t)
dev_read_sysfs(systemd_homework_t)
dev_rw_generic_usb_dev(systemd_homework_t)
dev_rw_loop_control(systemd_homework_t)
dev_rw_lvm_control(systemd_homework_t)
dev_watch_generic_dirs(systemd_homework_t)
domain_manage_all_domains_keyrings(systemd_homework_t)
fs_all_mount_fs_perms_xattr_fs(systemd_homework_t)
fs_getattr_cgroup(systemd_homework_t)
fs_read_nsfs_files(systemd_homework_t)
fs_relabelfrom_xattr_fs(systemd_homework_t)
fs_search_all(systemd_homework_t)
fsadm_manage_pid(systemd_homework_t)
fstools_domtrans(systemd_homework_t)
allow systemd_homework_t fsadm_t:process2 nnp_transition;
init_read_state(systemd_homework_t)
init_rw_stream_sockets(systemd_homework_t)
logging_send_syslog_msg(systemd_homework_t)
miscfiles_read_all_certs(systemd_homework_t)
storage_raw_read_removable_device(systemd_homework_t)
storage_rw_inherited_removable_device(systemd_homework_t)
storage_manage_fixed_disk(systemd_homework_t)
udev_read_pid_files(systemd_homework_t)
udev_search_pids(systemd_homework_t)