aboutsummaryrefslogtreecommitdiff
blob: 3edbc98ef8294d9be6b18e2778243c929be2d9b5 (plain)
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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
policy_module(systemd, 1.8.14)

#########################################
#
# Declarations
#

## <desc>
## <p>
## Enable support for systemd-tmpfiles to manage all non-security files.
## </p>
## </desc>
gen_tunable(systemd_tmpfiles_manage_all, false)

## <desc>
## <p>
## Allow systemd-nspawn to create a labelled namespace with the same types
## as parent environment
## </p>
## </desc>
gen_tunable(systemd_nspawn_labeled_namespace, false)

## <desc>
## <p>
## Allow systemd-logind to interact with the bootloader (read which one is
## installed on fixed disks, enumerate entries for dbus property
## BootLoaderEntries, etc.)
## </p>
## </desc>
gen_tunable(systemd_logind_get_bootloader, false)

attribute systemd_log_parse_env_type;
attribute systemd_tmpfiles_conf_type;
attribute systemd_user_session_type;

type systemd_activate_t;
type systemd_activate_exec_t;
init_system_domain(systemd_activate_t, systemd_activate_exec_t)

type systemd_analyze_t;
type systemd_analyze_exec_t;
init_daemon_domain(systemd_analyze_t, systemd_analyze_exec_t)

type systemd_backlight_t;
type systemd_backlight_exec_t;
init_system_domain(systemd_backlight_t, systemd_backlight_exec_t)

type systemd_backlight_unit_t;
init_unit_file(systemd_backlight_unit_t)

type systemd_backlight_var_lib_t;
files_type(systemd_backlight_var_lib_t)

type systemd_binfmt_t;
type systemd_binfmt_exec_t;
init_system_domain(systemd_binfmt_t, systemd_binfmt_exec_t)

type systemd_binfmt_unit_t;
init_unit_file(systemd_binfmt_unit_t)

type systemd_conf_t;
files_config_file(systemd_conf_t)

type systemd_fstab_generator_t;
type systemd_fstab_generator_exec_t;
init_system_domain(systemd_fstab_generator_t, systemd_fstab_generator_exec_t)

type systemd_gpt_generator_t;
type systemd_gpt_generator_exec_t;
init_system_domain(systemd_gpt_generator_t, systemd_gpt_generator_exec_t)

type systemd_cgroups_t;
type systemd_cgroups_exec_t;
domain_type(systemd_cgroups_t)
domain_entry_file(systemd_cgroups_t, systemd_cgroups_exec_t)
role system_r types systemd_cgroups_t;

type systemd_cgroups_runtime_t alias systemd_cgroups_var_run_t;
files_pid_file(systemd_cgroups_runtime_t)
init_daemon_pid_file(systemd_cgroups_runtime_t, dir, "systemd_cgroups")

type systemd_cgtop_t;
type systemd_cgtop_exec_t;
init_daemon_domain(systemd_cgtop_t, systemd_cgtop_exec_t)

type systemd_coredump_t;
type systemd_coredump_exec_t;
init_system_domain(systemd_coredump_t, systemd_coredump_exec_t)

type systemd_coredump_var_lib_t;
files_type(systemd_coredump_var_lib_t)

type systemd_detect_virt_t;
type systemd_detect_virt_exec_t;
init_daemon_domain(systemd_detect_virt_t, systemd_detect_virt_exec_t)

type systemd_hostnamed_t;
type systemd_hostnamed_exec_t;
init_daemon_domain(systemd_hostnamed_t, systemd_hostnamed_exec_t)

type systemd_hw_t;
type systemd_hw_exec_t;
init_system_domain(systemd_hw_t, systemd_hw_exec_t)

type systemd_hwdb_t;
files_type(systemd_hwdb_t)

type systemd_journal_t;
files_type(systemd_journal_t)
logging_log_file(systemd_journal_t)

type systemd_locale_t;
type systemd_locale_exec_t;
init_system_domain(systemd_locale_t, systemd_locale_exec_t)

type systemd_logind_t;
type systemd_logind_exec_t;
init_daemon_domain(systemd_logind_t, systemd_logind_exec_t)
init_named_socket_activation(systemd_logind_t, systemd_logind_runtime_t)

type systemd_logind_inhibit_runtime_t alias systemd_logind_inhibit_var_run_t;
files_pid_file(systemd_logind_inhibit_runtime_t)

type systemd_logind_runtime_t alias systemd_logind_var_run_t;
files_pid_file(systemd_logind_runtime_t)
init_daemon_pid_file(systemd_logind_runtime_t, dir, "systemd_logind")

type systemd_logind_var_lib_t;
files_type(systemd_logind_var_lib_t)

type systemd_machined_t;
type systemd_machined_exec_t;
init_daemon_domain(systemd_machined_t, systemd_machined_exec_t)

type systemd_machined_runtime_t alias systemd_machined_var_run_t;
files_pid_file(systemd_machined_runtime_t)
init_daemon_pid_file(systemd_machined_runtime_t, dir, "machines")

type systemd_modules_load_t;
type systemd_modules_load_exec_t;
init_daemon_domain(systemd_modules_load_t, systemd_modules_load_exec_t)

type systemd_networkd_t;
type systemd_networkd_exec_t;
init_system_domain(systemd_networkd_t, systemd_networkd_exec_t)

type systemd_networkd_runtime_t alias systemd_networkd_var_run_t;
files_pid_file(systemd_networkd_runtime_t)

type systemd_networkd_unit_t;
init_unit_file(systemd_networkd_unit_t)

type systemd_notify_t;
type systemd_notify_exec_t;
init_daemon_domain(systemd_notify_t, systemd_notify_exec_t)

type systemd_nspawn_t;
type systemd_nspawn_exec_t;
init_system_domain(systemd_nspawn_t, systemd_nspawn_exec_t)
mcs_killall(systemd_nspawn_t)

type systemd_nspawn_runtime_t alias systemd_nspawn_var_run_t;
files_pid_file(systemd_nspawn_runtime_t)

type systemd_nspawn_tmp_t;
files_tmp_file(systemd_nspawn_tmp_t)

type systemd_resolved_t;
type systemd_resolved_exec_t;
init_system_domain(systemd_resolved_t, systemd_resolved_exec_t)

type systemd_resolved_runtime_t alias systemd_resolved_var_run_t;
files_pid_file(systemd_resolved_runtime_t)

type systemd_run_t;
type systemd_run_exec_t;
init_daemon_domain(systemd_run_t, systemd_run_exec_t)

type systemd_stdio_bridge_t;
type systemd_stdio_bridge_exec_t;
init_system_domain(systemd_stdio_bridge_t, systemd_stdio_bridge_exec_t)

type systemd_passwd_agent_t;
type systemd_passwd_agent_exec_t;
init_system_domain(systemd_passwd_agent_t, systemd_passwd_agent_exec_t)

type systemd_passwd_runtime_t alias systemd_passwd_var_run_t;
files_pid_file(systemd_passwd_runtime_t)
init_path_unit_location_file(systemd_passwd_runtime_t)

type systemd_rfkill_t;
type systemd_rfkill_exec_t;
init_daemon_domain(systemd_rfkill_t, systemd_rfkill_exec_t)

type systemd_rfkill_unit_t;
init_unit_file(systemd_rfkill_unit_t)

type systemd_rfkill_var_lib_t;
files_type(systemd_rfkill_var_lib_t)

type systemd_sessions_t;
type systemd_sessions_exec_t;
init_system_domain(systemd_sessions_t, systemd_sessions_exec_t)

type systemd_sessions_runtime_t alias systemd_sessions_var_run_t;
files_pid_file(systemd_sessions_runtime_t)
init_daemon_pid_file(systemd_sessions_runtime_t, dir, "systemd_sessions")

type systemd_tmpfiles_t;
type systemd_tmpfiles_exec_t;
init_daemon_domain(systemd_tmpfiles_t, systemd_tmpfiles_exec_t)

type systemd_tmpfiles_conf_t;
files_config_file(systemd_tmpfiles_conf_t)

type systemd_update_done_t;
type systemd_update_done_exec_t;
init_system_domain(systemd_update_done_t, systemd_update_done_exec_t)

type systemd_update_run_t;
files_type(systemd_update_run_t)

type systemd_user_runtime_notify_t;
userdom_user_runtime_content(systemd_user_runtime_notify_t)

type systemd_user_runtime_t;
userdom_user_runtime_content(systemd_user_runtime_t)

#
# Unit file types
#

type power_unit_t;
init_unit_file(power_unit_t)

######################################
#
# Backlight local policy
#

allow systemd_backlight_t self:unix_dgram_socket { connect connected_socket_perms };

allow systemd_backlight_t systemd_backlight_var_lib_t:dir manage_dir_perms;
init_var_lib_filetrans(systemd_backlight_t, systemd_backlight_var_lib_t, dir)
manage_files_pattern(systemd_backlight_t, systemd_backlight_var_lib_t, systemd_backlight_var_lib_t)

systemd_log_parse_environment(systemd_backlight_t)

# Allow systemd-backlight to write to /sys/class/backlight/*/brightness
dev_rw_sysfs(systemd_backlight_t)

# for udev.conf
files_read_etc_files(systemd_backlight_t)

# for /run/udev/data/+backlight*
udev_read_pid_files(systemd_backlight_t)

files_search_var_lib(systemd_backlight_t)

#######################################
#
# Binfmt local policy
#

kernel_read_kernel_sysctls(systemd_binfmt_t)

systemd_log_parse_environment(systemd_binfmt_t)

# Allow to read /etc/binfmt.d/ files
files_read_etc_files(systemd_binfmt_t)

fs_register_binary_executable_type(systemd_binfmt_t)

#######################################
#
# fstab generator local policy
#

corecmd_search_bin(systemd_fstab_generator_t)

files_read_etc_files(systemd_fstab_generator_t)
files_search_pids(systemd_fstab_generator_t)

fstools_exec(systemd_fstab_generator_t)

init_create_pid_files(systemd_fstab_generator_t)
init_manage_pid_dirs(systemd_fstab_generator_t)
init_manage_pid_symlinks(systemd_fstab_generator_t)
init_search_pids(systemd_fstab_generator_t)
init_write_pid_files(systemd_fstab_generator_t)

kernel_read_kernel_sysctls(systemd_fstab_generator_t)

systemd_log_parse_environment(systemd_fstab_generator_t)

#######################################
#
# GPT auto generator local policy
#

kernel_read_kernel_sysctls(systemd_gpt_generator_t)

dev_read_sysfs(systemd_gpt_generator_t)
files_list_usr(systemd_gpt_generator_t)
files_read_etc_files(systemd_gpt_generator_t)
fs_getattr_xattr_fs(systemd_gpt_generator_t)
storage_raw_read_fixed_disk(systemd_gpt_generator_t)

systemd_log_parse_environment(systemd_gpt_generator_t)

######################################
#
# Cgroups local policy
#

allow systemd_cgroups_t self:capability net_admin;

kernel_domtrans_to(systemd_cgroups_t, systemd_cgroups_exec_t)
# for /proc/cmdline
kernel_read_system_state(systemd_cgroups_t)

mls_fd_use_all_levels(systemd_cgroups_t)

selinux_getattr_fs(systemd_cgroups_t)

# write to /run/systemd/cgroups-agent
init_dgram_send(systemd_cgroups_t)
init_stream_connect(systemd_cgroups_t)
# for /proc/1/environ
init_read_state(systemd_cgroups_t)

seutil_libselinux_linked(systemd_cgroups_t)

systemd_log_parse_environment(systemd_cgroups_t)

ifdef(`enable_mls',`
	kernel_ranged_domtrans_to(systemd_cgroups_t, systemd_cgroups_exec_t, s0 - mls_systemhigh)
')

######################################
#
# coredump local policy
#

allow systemd_coredump_t self:unix_dgram_socket { create write connect getopt setopt };
allow systemd_coredump_t self:capability { setgid setuid setpcap };
allow systemd_coredump_t self:process { getcap setcap setfscreate };

manage_files_pattern(systemd_coredump_t, systemd_coredump_var_lib_t, systemd_coredump_var_lib_t)

kernel_domtrans_to(systemd_coredump_t, systemd_coredump_exec_t)
kernel_read_kernel_sysctls(systemd_coredump_t)
kernel_read_system_state(systemd_coredump_t)
kernel_rw_pipes(systemd_coredump_t)
kernel_use_fds(systemd_coredump_t)

corecmd_exec_bin(systemd_coredump_t)
corecmd_read_all_executables(systemd_coredump_t)

dev_write_kmsg(systemd_coredump_t)

files_read_etc_files(systemd_coredump_t)
files_search_var_lib(systemd_coredump_t)

fs_getattr_xattr_fs(systemd_coredump_t)

selinux_getattr_fs(systemd_coredump_t)

init_list_var_lib_dirs(systemd_coredump_t)
init_read_state(systemd_coredump_t)
init_search_pids(systemd_coredump_t)
init_write_runtime_socket(systemd_coredump_t)

logging_send_syslog_msg(systemd_coredump_t)

seutil_search_default_contexts(systemd_coredump_t)


#######################################
#
# Hostnamed policy
#

allow systemd_hostnamed_t self:capability sys_admin;

kernel_read_kernel_sysctls(systemd_hostnamed_t)

dev_read_sysfs(systemd_hostnamed_t)

files_read_etc_files(systemd_hostnamed_t)

seutil_read_file_contexts(systemd_hostnamed_t)

sysnet_etc_filetrans_config(systemd_hostnamed_t)
sysnet_manage_config(systemd_hostnamed_t)

systemd_log_parse_environment(systemd_hostnamed_t)

optional_policy(`
	dbus_connect_system_bus(systemd_hostnamed_t)
	dbus_system_bus_client(systemd_hostnamed_t)
	init_dbus_chat(systemd_hostnamed_t)
')

optional_policy(`
	networkmanager_dbus_chat(systemd_hostnamed_t)
')

#########################################
#
# hw local policy
#

kernel_read_kernel_sysctls(systemd_hw_t)

allow systemd_hw_t systemd_hwdb_t:file { manage_file_perms relabelfrom relabelto };
files_etc_filetrans(systemd_hw_t, systemd_hwdb_t, file)

files_search_pids(systemd_hw_t)

selinux_get_fs_mount(systemd_hw_t)

init_read_state(systemd_hw_t)

seutil_read_config(systemd_hw_t)
seutil_read_file_contexts(systemd_hw_t)

#######################################
#
# locale local policy
#

kernel_read_kernel_sysctls(systemd_locale_t)

files_read_etc_files(systemd_locale_t)

seutil_read_file_contexts(systemd_locale_t)

systemd_log_parse_environment(systemd_locale_t)

optional_policy(`
	dbus_connect_system_bus(systemd_locale_t)
	dbus_system_bus_client(systemd_locale_t)
')

######################################
#
# systemd log parse enviroment
#

# Do not audit setsockopt(fd, SOL_SOCKET, SO_SNDBUFFORCE, ...) failure (e.g. when using create_log_socket() internal function)
dontaudit systemd_log_parse_env_type self:capability net_admin;

kernel_read_system_state(systemd_log_parse_env_type)

dev_write_kmsg(systemd_log_parse_env_type)

# For /sys/firmware/efi/efivars/SystemdOptions-8cf2644b-4b0b-428f-9387-6d876050dc67
fs_read_efivarfs_files(systemd_log_parse_env_type)

term_use_console(systemd_log_parse_env_type)

init_read_state(systemd_log_parse_env_type)

logging_send_syslog_msg(systemd_log_parse_env_type)

#########################################
#
# Logind local policy
#

allow systemd_logind_t self:capability { chown dac_override dac_read_search fowner sys_admin sys_tty_config };
allow systemd_logind_t self:process { getcap setfscreate };
allow systemd_logind_t self:netlink_kobject_uevent_socket create_socket_perms;
allow systemd_logind_t self:unix_dgram_socket create_socket_perms;
allow systemd_logind_t self:fifo_file rw_fifo_file_perms;

allow systemd_logind_t systemd_logind_var_lib_t:dir manage_dir_perms;
init_var_lib_filetrans(systemd_logind_t, systemd_logind_var_lib_t, dir)

manage_fifo_files_pattern(systemd_logind_t, systemd_logind_runtime_t, systemd_logind_runtime_t)
manage_files_pattern(systemd_logind_t, systemd_logind_runtime_t, systemd_logind_runtime_t)
allow systemd_logind_t systemd_logind_runtime_t:dir manage_dir_perms;

manage_dirs_pattern(systemd_logind_t, systemd_logind_inhibit_runtime_t, systemd_logind_inhibit_runtime_t)
manage_files_pattern(systemd_logind_t, systemd_logind_inhibit_runtime_t, systemd_logind_inhibit_runtime_t)
manage_fifo_files_pattern(systemd_logind_t, systemd_logind_inhibit_runtime_t, systemd_logind_inhibit_runtime_t)
init_pid_filetrans(systemd_logind_t, systemd_logind_inhibit_runtime_t, dir, "inhibit")

allow systemd_logind_t systemd_sessions_runtime_t:dir manage_dir_perms;
allow systemd_logind_t systemd_sessions_runtime_t:file manage_file_perms;
allow systemd_logind_t systemd_sessions_runtime_t:fifo_file manage_fifo_file_perms;

kernel_read_kernel_sysctls(systemd_logind_t)

dev_getattr_dri_dev(systemd_logind_t)
dev_getattr_generic_usb_dev(systemd_logind_t)
dev_getattr_kvm_dev(systemd_logind_t)
dev_getattr_sound_dev(systemd_logind_t)
dev_getattr_video_dev(systemd_logind_t)
dev_manage_wireless(systemd_logind_t)
dev_read_urand(systemd_logind_t)
dev_rw_dri(systemd_logind_t)
dev_rw_input_dev(systemd_logind_t)
dev_rw_sysfs(systemd_logind_t)
dev_setattr_dri_dev(systemd_logind_t)
dev_setattr_generic_usb_dev(systemd_logind_t)
dev_setattr_input_dev(systemd_logind_t)
dev_setattr_kvm_dev(systemd_logind_t)
dev_setattr_sound_dev(systemd_logind_t)
dev_setattr_video_dev(systemd_logind_t)

domain_obj_id_change_exemption(systemd_logind_t)

files_read_etc_files(systemd_logind_t)
files_search_pids(systemd_logind_t)

fs_getattr_cgroup(systemd_logind_t)
fs_getattr_tmpfs(systemd_logind_t)
fs_getattr_tmpfs_dirs(systemd_logind_t)
fs_list_tmpfs(systemd_logind_t)
fs_mount_tmpfs(systemd_logind_t)
fs_read_cgroup_files(systemd_logind_t)
fs_read_efivarfs_files(systemd_logind_t)
fs_relabelfrom_tmpfs_dirs(systemd_logind_t)
fs_unmount_tmpfs(systemd_logind_t)

selinux_get_enforce_mode(systemd_logind_t)

storage_getattr_removable_dev(systemd_logind_t)
storage_getattr_scsi_generic_dev(systemd_logind_t)
storage_setattr_removable_dev(systemd_logind_t)
storage_setattr_scsi_generic_dev(systemd_logind_t)

term_setattr_unallocated_ttys(systemd_logind_t)
term_use_unallocated_ttys(systemd_logind_t)

auth_manage_faillog(systemd_logind_t)

init_dbus_send_script(systemd_logind_t)
init_get_all_units_status(systemd_logind_t)
init_get_system_status(systemd_logind_t)
init_read_utmp(systemd_logind_t)
init_service_start(systemd_logind_t)
init_service_status(systemd_logind_t)
init_start_all_units(systemd_logind_t)
init_stop_all_units(systemd_logind_t)
init_start_system(systemd_logind_t)
init_stop_system(systemd_logind_t)

locallogin_read_state(systemd_logind_t)

seutil_libselinux_linked(systemd_logind_t)
seutil_read_default_contexts(systemd_logind_t)
seutil_read_file_contexts(systemd_logind_t)

systemd_log_parse_environment(systemd_logind_t)
systemd_start_power_units(systemd_logind_t)

udev_list_pids(systemd_logind_t)
udev_read_db(systemd_logind_t)
udev_read_pid_files(systemd_logind_t)

userdom_delete_all_user_runtime_dirs(systemd_logind_t)
userdom_delete_all_user_runtime_files(systemd_logind_t)
userdom_delete_all_user_runtime_named_pipes(systemd_logind_t)
userdom_delete_all_user_runtime_named_sockets(systemd_logind_t)
userdom_delete_all_user_runtime_symlinks(systemd_logind_t)
userdom_delete_user_tmp_dirs(systemd_logind_t)
userdom_delete_user_tmp_files(systemd_logind_t)
userdom_delete_user_tmp_symlinks(systemd_logind_t)
userdom_delete_user_tmp_named_pipes(systemd_logind_t)
userdom_delete_user_tmp_named_sockets(systemd_logind_t)
# user_tmp_t is for the dbus-1 directory
userdom_list_user_tmp(systemd_logind_t)
userdom_manage_user_runtime_dirs(systemd_logind_t)
userdom_manage_user_runtime_root_dirs(systemd_logind_t)
userdom_mounton_user_runtime_dirs(systemd_logind_t)
userdom_read_all_users_state(systemd_logind_t)
userdom_relabel_user_tmpfs_dirs(systemd_logind_t)
userdom_relabel_user_tmpfs_files(systemd_logind_t)
userdom_relabelfrom_user_runtime_dirs(systemd_logind_t)
userdom_relabelto_user_runtime_dirs(systemd_logind_t)
userdom_setattr_user_ttys(systemd_logind_t)
userdom_use_user_ttys(systemd_logind_t)

# Needed to work around patch not yet merged into the systemd-logind supported on RHEL 7.x
# The change in systemd by Nicolas Iooss on 02-Feb-2016 with hash 4b51966cf6c06250036e428608da92f8640beb96
# should fix the problem where user directories in /run/user/$UID/ are not getting the proper context
# Once a newer systemd (v229 or later) is in RHEL (or patch is cherry-picked) this should be able to be removed.
ifdef(`distro_redhat',`
	userdom_user_run_filetrans_user_runtime(systemd_logind_t, dir)
	userdom_user_runtime_root_filetrans_user_runtime(systemd_logind_t, dir)
')

tunable_policy(`systemd_logind_get_bootloader',`
	fs_getattr_dos_fs(systemd_logind_t)
	fs_list_dos(systemd_logind_t)
	fs_read_dos_files(systemd_logind_t)
')
# systemd-logind uses util-linux's blkid in order to find the ESP (EFI System Partition).
# This reads the first sectors of fixed disk devices.
storage_raw_read_fixed_disk_cond(systemd_logind_t, systemd_logind_get_bootloader)

optional_policy(`
	dbus_connect_system_bus(systemd_logind_t)
	dbus_system_bus_client(systemd_logind_t)
')

optional_policy(`
	devicekit_dbus_chat_disk(systemd_logind_t)
	devicekit_dbus_chat_power(systemd_logind_t)
')

optional_policy(`
	modemmanager_dbus_chat(systemd_logind_t)
')

optional_policy(`
	networkmanager_dbus_chat(systemd_logind_t)
')

optional_policy(`
	policykit_dbus_chat(systemd_logind_t)
')

optional_policy(`
	xserver_read_state(systemd_logind_t)
	xserver_dbus_chat(systemd_logind_t)
	xserver_dbus_chat_xdm(systemd_logind_t)
	xserver_read_xdm_state(systemd_logind_t)
')

optional_policy(`
	unconfined_dbus_send(systemd_logind_t)
')

#########################################
#
# machined local policy
#

allow systemd_machined_t self:capability { setgid sys_chroot sys_ptrace };
allow systemd_machined_t self:process setfscreate;
allow systemd_machined_t self:unix_dgram_socket { connected_socket_perms connect };

manage_files_pattern(systemd_machined_t, systemd_machined_runtime_t, systemd_machined_runtime_t)
allow systemd_machined_t systemd_machined_runtime_t:lnk_file manage_lnk_file_perms;

kernel_read_kernel_sysctls(systemd_machined_t)
kernel_read_system_state(systemd_machined_t)

files_read_etc_files(systemd_machined_t)

fs_getattr_cgroup(systemd_machined_t)
fs_getattr_tmpfs(systemd_machined_t)
fs_read_nsfs_files(systemd_machined_t)

selinux_getattr_fs(systemd_machined_t)

init_read_script_state(systemd_machined_t)
init_get_system_status(systemd_machined_t)
init_read_state(systemd_machined_t)
init_service_start(systemd_machined_t)
init_service_status(systemd_machined_t)
init_start_system(systemd_machined_t)
init_stop_system(systemd_machined_t)
init_get_generic_units_status(systemd_machined_t)
init_start_generic_units(systemd_machined_t)
init_stop_generic_units(systemd_machined_t)

logging_send_syslog_msg(systemd_machined_t)

seutil_search_default_contexts(systemd_machined_t)

optional_policy(`
	init_dbus_chat(systemd_machined_t)
	init_dbus_send_script(systemd_machined_t)

	dbus_connect_system_bus(systemd_machined_t)
	dbus_system_bus_client(systemd_machined_t)
')

########################################
#
# modules-load local policy
#

kernel_load_module(systemd_modules_load_t)
kernel_read_kernel_sysctls(systemd_modules_load_t)
kernel_request_load_module(systemd_modules_load_t)

dev_read_sysfs(systemd_modules_load_t)

files_read_etc_files(systemd_modules_load_t)

modutils_read_module_config(systemd_modules_load_t)
modutils_read_module_deps(systemd_modules_load_t)
modutils_read_module_objects(systemd_modules_load_t)

systemd_log_parse_environment(systemd_modules_load_t)

########################################
#
# networkd local policy
#

allow systemd_networkd_t self:capability { chown dac_override fowner net_admin net_raw setgid setpcap setuid };
allow systemd_networkd_t self:netlink_generic_socket create_socket_perms;
allow systemd_networkd_t self:netlink_kobject_uevent_socket create_socket_perms;
allow systemd_networkd_t self:netlink_route_socket { create_socket_perms nlmsg_read nlmsg_write };
allow systemd_networkd_t self:packet_socket create_socket_perms;
allow systemd_networkd_t self:process { getcap setcap setfscreate };
allow systemd_networkd_t self:rawip_socket create_socket_perms;
allow systemd_networkd_t self:tun_socket { create_socket_perms relabelfrom relabelto };
allow systemd_networkd_t self:udp_socket create_socket_perms;
allow systemd_networkd_t self:unix_dgram_socket create_socket_perms;

manage_dirs_pattern(systemd_networkd_t, systemd_networkd_runtime_t, systemd_networkd_runtime_t)
manage_files_pattern(systemd_networkd_t, systemd_networkd_runtime_t, systemd_networkd_runtime_t)
manage_lnk_files_pattern(systemd_networkd_t, systemd_networkd_runtime_t, systemd_networkd_runtime_t)

kernel_read_system_state(systemd_networkd_t)
kernel_read_kernel_sysctls(systemd_networkd_t)
kernel_read_network_state(systemd_networkd_t)
kernel_request_load_module(systemd_networkd_t)
kernel_rw_net_sysctls(systemd_networkd_t)

corecmd_bin_entry_type(systemd_networkd_t)
corecmd_exec_bin(systemd_networkd_t)

corenet_rw_tun_tap_dev(systemd_networkd_t)
corenet_udp_bind_dhcpc_port(systemd_networkd_t)
corenet_udp_bind_generic_node(systemd_networkd_t)

dev_read_urand(systemd_networkd_t)
dev_read_sysfs(systemd_networkd_t)
dev_write_kmsg(systemd_networkd_t)

files_read_etc_files(systemd_networkd_t)
files_watch_runtime_dirs(systemd_networkd_t)
files_watch_root_dirs(systemd_networkd_t)

auth_use_nsswitch(systemd_networkd_t)

init_dgram_send(systemd_networkd_t)
init_read_state(systemd_networkd_t)

logging_send_syslog_msg(systemd_networkd_t)

miscfiles_read_localization(systemd_networkd_t)

sysnet_read_config(systemd_networkd_t)

systemd_log_parse_environment(systemd_networkd_t)

optional_policy(`
	dbus_system_bus_client(systemd_networkd_t)
	dbus_connect_system_bus(systemd_networkd_t)
	dbus_watch_system_bus_runtime_dirs(systemd_networkd_t)
	dbus_watch_system_bus_runtime_named_sockets(systemd_networkd_t)

	systemd_dbus_chat_hostnamed(systemd_networkd_t)
')

optional_policy(`
	udev_read_db(systemd_networkd_t)
	udev_read_pid_files(systemd_networkd_t)
')

########################################
#
# systemd_notify local policy
#
allow systemd_notify_t self:capability chown;
allow systemd_notify_t self:process { setfscreate setsockcreate };

allow systemd_notify_t self:fifo_file rw_fifo_file_perms;
allow systemd_notify_t self:unix_stream_socket create_stream_socket_perms;

domain_use_interactive_fds(systemd_notify_t)

files_read_etc_files(systemd_notify_t)
files_read_usr_files(systemd_notify_t)

fs_getattr_cgroup_files(systemd_notify_t)

auth_use_nsswitch(systemd_notify_t)

init_rw_stream_sockets(systemd_notify_t)

miscfiles_read_localization(systemd_notify_t)

########################################
#
# Nspawn local policy
#

allow systemd_nspawn_t self:process { signal getcap setcap setfscreate setrlimit sigkill };
allow systemd_nspawn_t self:capability { dac_override dac_read_search fsetid mknod net_admin setgid setuid setpcap sys_admin sys_chroot };
allow systemd_nspawn_t self:capability2 wake_alarm;
allow systemd_nspawn_t self:unix_dgram_socket connected_socket_perms;
allow systemd_nspawn_t self:unix_stream_socket create_stream_socket_perms;

allow systemd_nspawn_t systemd_journal_t:dir search;

allow systemd_nspawn_t systemd_machined_t:dbus send_msg;

allow systemd_nspawn_t systemd_nspawn_runtime_t:dir manage_dir_perms;
allow systemd_nspawn_t systemd_nspawn_runtime_t:file manage_file_perms;
init_pid_filetrans(systemd_nspawn_t, systemd_nspawn_runtime_t, dir)

files_tmp_filetrans(systemd_nspawn_t, systemd_nspawn_tmp_t, { dir file })
allow systemd_nspawn_t systemd_nspawn_tmp_t:dir manage_dir_perms;
allow systemd_nspawn_t systemd_nspawn_tmp_t:dir mounton;
# for /tmp/.#inaccessible*
allow systemd_nspawn_t systemd_nspawn_tmp_t:file manage_file_perms;

# for /run/systemd/nspawn/incoming in chroot
allow systemd_nspawn_t systemd_nspawn_runtime_t:dir mounton;

kernel_mount_proc(systemd_nspawn_t)
kernel_mounton_sysctl_dirs(systemd_nspawn_t)
kernel_mounton_kernel_sysctl_files(systemd_nspawn_t)
kernel_mounton_message_if(systemd_nspawn_t)
kernel_mounton_proc(systemd_nspawn_t)
kernel_mounton_sysctl_dirs(systemd_nspawn_t)
kernel_read_kernel_sysctls(systemd_nspawn_t)
kernel_read_system_state(systemd_nspawn_t)
kernel_remount_proc(systemd_nspawn_t)

corecmd_exec_shell(systemd_nspawn_t)
corecmd_search_bin(systemd_nspawn_t)

corenet_rw_tun_tap_dev(systemd_nspawn_t)

dev_getattr_fs(systemd_nspawn_t)
dev_manage_sysfs_dirs(systemd_nspawn_t)
dev_mounton_sysfs_dirs(systemd_nspawn_t)
dev_mount_sysfs(systemd_nspawn_t)
dev_read_rand(systemd_nspawn_t)
dev_read_urand(systemd_nspawn_t)

files_getattr_tmp_dirs(systemd_nspawn_t)
files_manage_etc_files(systemd_nspawn_t)
files_manage_mnt_dirs(systemd_nspawn_t)
files_mounton_mnt(systemd_nspawn_t)
files_mounton_root(systemd_nspawn_t)
files_mounton_tmp(systemd_nspawn_t)
files_read_kernel_symbol_table(systemd_nspawn_t)
files_setattr_pid_dirs(systemd_nspawn_t)

fs_getattr_tmpfs(systemd_nspawn_t)
fs_manage_tmpfs_chr_files(systemd_nspawn_t)
fs_mount_tmpfs(systemd_nspawn_t)
fs_remount_tmpfs(systemd_nspawn_t)
fs_remount_xattr_fs(systemd_nspawn_t)
fs_read_cgroup_files(systemd_nspawn_t)

term_getattr_generic_ptys(systemd_nspawn_t)
term_getattr_pty_fs(systemd_nspawn_t)
term_mount_devpts(systemd_nspawn_t)
term_search_ptys(systemd_nspawn_t)
term_setattr_generic_ptys(systemd_nspawn_t)
term_use_ptmx(systemd_nspawn_t)

init_domtrans_script(systemd_nspawn_t)
init_getrlimit(systemd_nspawn_t)
init_kill_scripts(systemd_nspawn_t)
init_read_state(systemd_nspawn_t)
init_search_run(systemd_nspawn_t)
init_write_runtime_socket(systemd_nspawn_t)
init_spec_domtrans_script(systemd_nspawn_t)

miscfiles_manage_localization(systemd_nspawn_t)

# for writing inside chroot
sysnet_manage_config(systemd_nspawn_t)

userdom_manage_user_home_dirs(systemd_nspawn_t)

tunable_policy(`systemd_nspawn_labeled_namespace',`
	corecmd_exec_bin(systemd_nspawn_t)
	corecmd_exec_shell(systemd_nspawn_t)

	dev_mounton(systemd_nspawn_t)
	dev_setattr_generic_dirs(systemd_nspawn_t)

	# manage etc symlinks for /etc/localtime
	files_manage_etc_symlinks(systemd_nspawn_t)
	files_mounton_pid_dirs(systemd_nspawn_t)
	files_search_home(systemd_nspawn_t)

	fs_getattr_cgroup(systemd_nspawn_t)
	fs_manage_cgroup_dirs(systemd_nspawn_t)
	fs_manage_tmpfs_dirs(systemd_nspawn_t)
	fs_manage_tmpfs_files(systemd_nspawn_t)
	fs_manage_tmpfs_symlinks(systemd_nspawn_t)
	fs_mount_cgroup(systemd_nspawn_t)
	fs_mounton_cgroup(systemd_nspawn_t)
	fs_mounton_tmpfs(systemd_nspawn_t)
	fs_mounton_tmpfs_files(systemd_nspawn_t)
	fs_remount_cgroup(systemd_nspawn_t)
	fs_search_tmpfs(systemd_nspawn_t)
	fs_unmount_cgroup(systemd_nspawn_t)
	fs_write_cgroup_files(systemd_nspawn_t)

	selinux_getattr_fs(systemd_nspawn_t)
	selinux_remount_fs(systemd_nspawn_t)
	selinux_search_fs(systemd_nspawn_t)

	init_domtrans(systemd_nspawn_t)

	logging_search_logs(systemd_nspawn_t)

	seutil_search_default_contexts(systemd_nspawn_t)
')

optional_policy(`
	allow systemd_machined_t systemd_nspawn_t:dbus send_msg;

	dbus_system_bus_client(systemd_nspawn_t)

	optional_policy(`
		unconfined_dbus_send(systemd_machined_t)
	')
')

optional_policy(`
	virt_manage_virt_content(systemd_nspawn_t)
')

#######################################
#
# systemd_passwd_agent_t local policy
#

allow systemd_passwd_agent_t self:capability { chown sys_tty_config dac_override };
allow systemd_passwd_agent_t self:process { setfscreate setsockcreate signal };
allow systemd_passwd_agent_t self:unix_dgram_socket create_socket_perms;

manage_dirs_pattern(systemd_passwd_agent_t, systemd_passwd_runtime_t, systemd_passwd_runtime_t)
manage_files_pattern(systemd_passwd_agent_t, systemd_passwd_runtime_t, systemd_passwd_runtime_t)
manage_sock_files_pattern(systemd_passwd_agent_t, systemd_passwd_runtime_t, systemd_passwd_runtime_t)
manage_fifo_files_pattern(systemd_passwd_agent_t, systemd_passwd_runtime_t, systemd_passwd_runtime_t)
init_pid_filetrans(systemd_passwd_agent_t, systemd_passwd_runtime_t, { dir fifo_file file })

kernel_read_system_state(systemd_passwd_agent_t)
kernel_stream_connect(systemd_passwd_agent_t)

dev_create_generic_dirs(systemd_passwd_agent_t)
dev_read_generic_files(systemd_passwd_agent_t)
dev_write_generic_sock_files(systemd_passwd_agent_t)
dev_write_kmsg(systemd_passwd_agent_t)

files_read_etc_files(systemd_passwd_agent_t)

fs_getattr_xattr_fs(systemd_passwd_agent_t)

selinux_get_enforce_mode(systemd_passwd_agent_t)
selinux_getattr_fs(systemd_passwd_agent_t)

term_read_console(systemd_passwd_agent_t)

auth_use_nsswitch(systemd_passwd_agent_t)

init_create_runtime_dirs(systemd_passwd_agent_t)
init_read_runtime_pipes(systemd_passwd_agent_t)
init_read_state(systemd_passwd_agent_t)
init_read_utmp(systemd_passwd_agent_t)
init_stream_connect(systemd_passwd_agent_t)

logging_send_syslog_msg(systemd_passwd_agent_t)

miscfiles_read_localization(systemd_passwd_agent_t)

seutil_search_default_contexts(systemd_passwd_agent_t)

userdom_use_user_ttys(systemd_passwd_agent_t)
userdom_use_user_ptys(systemd_passwd_agent_t)

optional_policy(`
	getty_use_fds(systemd_passwd_agent_t)
')

optional_policy(`
	lvm_signull(systemd_passwd_agent_t)
')

optional_policy(`
	plymouthd_stream_connect(systemd_passwd_agent_t)
')


#######################################
#
# Rfkill local policy
#

manage_dirs_pattern(systemd_rfkill_t, systemd_rfkill_var_lib_t, systemd_rfkill_var_lib_t)
manage_files_pattern(systemd_rfkill_t, systemd_rfkill_var_lib_t, systemd_rfkill_var_lib_t)
init_var_lib_filetrans(systemd_rfkill_t, systemd_rfkill_var_lib_t, dir)

kernel_read_kernel_sysctls(systemd_rfkill_t)

dev_read_sysfs(systemd_rfkill_t)
dev_rw_wireless(systemd_rfkill_t)

# Allow reading /etc/udev/udev.conf
files_read_etc_files(systemd_rfkill_t)

# Allow reading /run/udev/data/+rfkill:rfkill0
udev_read_pid_files(systemd_rfkill_t)

systemd_log_parse_environment(systemd_rfkill_t)

#########################################
#
# Resolved local policy
#

allow systemd_resolved_t self:capability { chown net_raw setgid setpcap setuid };
allow systemd_resolved_t self:process { getcap setcap setfscreate signal };

allow systemd_resolved_t self:tcp_socket { accept listen };

allow systemd_resolved_t systemd_networkd_runtime_t:dir watch;

manage_dirs_pattern(systemd_resolved_t, systemd_resolved_runtime_t, systemd_resolved_runtime_t)
manage_files_pattern(systemd_resolved_t, systemd_resolved_runtime_t, systemd_resolved_runtime_t)
init_pid_filetrans(systemd_resolved_t, systemd_resolved_runtime_t, dir)

dev_read_sysfs(systemd_resolved_t)

kernel_read_crypto_sysctls(systemd_resolved_t)
kernel_read_kernel_sysctls(systemd_resolved_t)
kernel_read_net_sysctls(systemd_resolved_t)

corenet_tcp_bind_generic_node(systemd_resolved_t)
corenet_tcp_bind_dns_port(systemd_resolved_t)
corenet_tcp_bind_llmnr_port(systemd_resolved_t)
corenet_udp_bind_generic_node(systemd_resolved_t)
corenet_udp_bind_dns_port(systemd_resolved_t)
corenet_udp_bind_llmnr_port(systemd_resolved_t)

auth_use_nsswitch(systemd_resolved_t)

files_watch_root_dirs(systemd_resolved_t)
files_watch_runtime_dirs(systemd_resolved_t)

init_dgram_send(systemd_resolved_t)

seutil_read_file_contexts(systemd_resolved_t)

systemd_log_parse_environment(systemd_resolved_t)
systemd_read_networkd_runtime(systemd_resolved_t)

optional_policy(`
	dbus_connect_system_bus(systemd_resolved_t)
	dbus_system_bus_client(systemd_resolved_t)
	dbus_watch_system_bus_runtime_dirs(systemd_resolved_t)
	dbus_watch_system_bus_runtime_named_sockets(systemd_resolved_t)
')

#########################################
#
# Sessions local policy
#

allow systemd_sessions_t self:process setfscreate;

allow systemd_sessions_t systemd_sessions_runtime_t:file manage_file_perms;
files_pid_filetrans(systemd_sessions_t, systemd_sessions_runtime_t, file)

kernel_read_kernel_sysctls(systemd_sessions_t)

selinux_get_enforce_mode(systemd_sessions_t)
selinux_get_fs_mount(systemd_sessions_t)

seutil_read_config(systemd_sessions_t)
seutil_read_default_contexts(systemd_sessions_t)
seutil_read_file_contexts(systemd_sessions_t)

systemd_log_parse_environment(systemd_sessions_t)

#########################################
#
# Tmpfiles local policy
#

allow systemd_tmpfiles_t self:capability { chown dac_override dac_read_search fowner fsetid mknod net_admin sys_admin };
allow systemd_tmpfiles_t self:process { setfscreate getcap };

allow systemd_tmpfiles_t systemd_coredump_var_lib_t:dir { relabelfrom relabelto manage_dir_perms };
allow systemd_tmpfiles_t systemd_coredump_var_lib_t:file manage_file_perms;

allow systemd_tmpfiles_t systemd_sessions_runtime_t:file { relabelfrom relabelto manage_file_perms };

manage_dirs_pattern(systemd_tmpfiles_t, systemd_journal_t, systemd_journal_t)
manage_files_pattern(systemd_tmpfiles_t, systemd_journal_t, systemd_journal_t)
allow systemd_tmpfiles_t systemd_journal_t:dir { relabelfrom relabelto };
allow systemd_tmpfiles_t systemd_journal_t:file { relabelfrom relabelto };

allow systemd_tmpfiles_t systemd_tmpfiles_conf_t:dir list_dir_perms;
allow systemd_tmpfiles_t systemd_tmpfiles_conf_type:file read_file_perms;

kernel_getattr_proc(systemd_tmpfiles_t)
kernel_read_kernel_sysctls(systemd_tmpfiles_t)
kernel_read_network_state(systemd_tmpfiles_t)

dev_getattr_fs(systemd_tmpfiles_t)
dev_manage_all_dev_nodes(systemd_tmpfiles_t)
dev_read_urand(systemd_tmpfiles_t)
dev_relabel_all_sysfs(systemd_tmpfiles_t)
dev_read_urand(systemd_tmpfiles_t)
dev_setattr_all_sysfs(systemd_tmpfiles_t)
dev_manage_all_dev_nodes(systemd_tmpfiles_t)

files_create_lock_dirs(systemd_tmpfiles_t)
files_manage_all_pid_dirs(systemd_tmpfiles_t)
files_delete_usr_files(systemd_tmpfiles_t)
files_list_home(systemd_tmpfiles_t)
files_list_locks(systemd_tmpfiles_t)
files_manage_generic_tmp_dirs(systemd_tmpfiles_t)
files_manage_var_dirs(systemd_tmpfiles_t)
files_manage_var_lib_dirs(systemd_tmpfiles_t)
files_purge_tmp(systemd_tmpfiles_t)
files_read_etc_files(systemd_tmpfiles_t)
files_read_etc_runtime_files(systemd_tmpfiles_t)
files_relabel_all_lock_dirs(systemd_tmpfiles_t)
files_relabel_all_pid_dirs(systemd_tmpfiles_t)
files_relabel_all_tmp_dirs(systemd_tmpfiles_t)
files_relabel_var_dirs(systemd_tmpfiles_t)
files_relabel_var_lib_dirs(systemd_tmpfiles_t)
files_relabelfrom_home(systemd_tmpfiles_t)
files_relabelto_home(systemd_tmpfiles_t)
files_relabelto_etc_dirs(systemd_tmpfiles_t)
# for /etc/mtab
files_manage_etc_symlinks(systemd_tmpfiles_t)

fs_getattr_tmpfs(systemd_tmpfiles_t)
fs_getattr_xattr_fs(systemd_tmpfiles_t)
fs_list_tmpfs(systemd_tmpfiles_t)

selinux_get_fs_mount(systemd_tmpfiles_t)
selinux_search_fs(systemd_tmpfiles_t)

auth_append_lastlog(systemd_tmpfiles_t)
auth_manage_faillog(systemd_tmpfiles_t)
auth_manage_lastlog(systemd_tmpfiles_t)
auth_manage_login_records(systemd_tmpfiles_t)
auth_manage_var_auth(systemd_tmpfiles_t)
auth_relabel_lastlog(systemd_tmpfiles_t)
auth_relabel_login_records(systemd_tmpfiles_t)
auth_setattr_login_records(systemd_tmpfiles_t)

init_manage_utmp(systemd_tmpfiles_t)
init_manage_var_lib_files(systemd_tmpfiles_t)
# for /proc/1/environ
init_read_state(systemd_tmpfiles_t)

init_relabel_utmp(systemd_tmpfiles_t)
init_relabel_var_lib_dirs(systemd_tmpfiles_t)

logging_manage_generic_logs(systemd_tmpfiles_t)
logging_manage_generic_log_dirs(systemd_tmpfiles_t)
logging_relabel_generic_log_dirs(systemd_tmpfiles_t)
logging_relabel_syslogd_tmp_files(systemd_tmpfiles_t)
logging_relabel_syslogd_tmp_dirs(systemd_tmpfiles_t)
logging_setattr_syslogd_tmp_files(systemd_tmpfiles_t)
logging_setattr_syslogd_tmp_dirs(systemd_tmpfiles_t)

miscfiles_manage_man_pages(systemd_tmpfiles_t)
miscfiles_relabel_man_cache(systemd_tmpfiles_t)

seutil_read_config(systemd_tmpfiles_t)
seutil_read_file_contexts(systemd_tmpfiles_t)

sysnet_manage_config(systemd_tmpfiles_t)
sysnet_relabel_config(systemd_tmpfiles_t)

systemd_log_parse_environment(systemd_tmpfiles_t)

userdom_manage_user_runtime_root_dirs(systemd_tmpfiles_t)
userdom_relabel_user_runtime_root_dirs(systemd_tmpfiles_t)

tunable_policy(`systemd_tmpfiles_manage_all',`
	# systemd-tmpfiles can be configured to manage anything.
	# have a last-resort option for users to do this.
	files_manage_non_security_dirs(systemd_tmpfiles_t)
	files_manage_non_security_files(systemd_tmpfiles_t)
	files_relabel_non_security_dirs(systemd_tmpfiles_t)
	files_relabel_non_security_files(systemd_tmpfiles_t)
')

optional_policy(`
	dbus_read_lib_files(systemd_tmpfiles_t)
	dbus_relabel_lib_dirs(systemd_tmpfiles_t)
')

optional_policy(`
	apt_use_fds(systemd_tmpfiles_t)
	dpkg_script_rw_inherited_pipes(systemd_tmpfiles_t)
')

optional_policy(`
	xfs_create_tmp_dirs(systemd_tmpfiles_t)
')

optional_policy(`
	xserver_create_console_pipes(systemd_tmpfiles_t)
	xserver_create_xdm_tmp_dirs(systemd_tmpfiles_t)
	xserver_relabel_console_pipes(systemd_tmpfiles_t)
	xserver_setattr_console_pipes(systemd_tmpfiles_t)
')

#########################################
#
# Update Done local policy
#

allow systemd_update_done_t self:process setfscreate;

allow systemd_update_done_t systemd_update_run_t:file manage_file_perms;

files_etc_filetrans(systemd_update_done_t, systemd_update_run_t, file)
files_var_filetrans(systemd_update_done_t, systemd_update_run_t, file)

kernel_read_kernel_sysctls(systemd_update_done_t)

seutil_read_file_contexts(systemd_update_done_t)

systemd_log_parse_environment(systemd_update_done_t)

#########################################
#
# User session (systemd --user) local policy
#

allow systemd_user_session_type self:capability { dac_read_search sys_resource };
dontaudit systemd_user_session_type self:capability dac_override;
allow systemd_user_session_type self:process { setfscreate setsockcreate };
allow systemd_user_session_type self:udp_socket create_socket_perms;
allow systemd_user_session_type self:unix_stream_socket create_stream_socket_perms;
allow systemd_user_session_type self:netlink_kobject_uevent_socket { bind create getattr read setopt };

allow systemd_user_session_type systemd_user_runtime_t:dir manage_dir_perms;
allow systemd_user_session_type systemd_user_runtime_t:sock_file { create write };
userdom_user_runtime_filetrans(systemd_user_session_type, systemd_user_runtime_t, dir)

allow systemd_user_session_type systemd_user_runtime_notify_t:sock_file create;
type_transition systemd_user_session_type systemd_user_runtime_t:sock_file systemd_user_runtime_notify_t "notify";

dev_write_sysfs_dirs(systemd_user_session_type)
dev_read_sysfs(systemd_user_session_type)

files_read_etc_files(systemd_user_session_type)
files_list_usr(systemd_user_session_type)

fs_getattr_cgroup(systemd_user_session_type)
fs_getattr_tmpfs(systemd_user_session_type)
fs_rw_cgroup_files(systemd_user_session_type)
fs_manage_cgroup_dirs(systemd_user_session_type)

# for /run/systemd/notify
init_dgram_send(systemd_user_session_type)
init_signal(systemd_user_session_type)

# for /proc/sys/fs/nr_open
kernel_read_fs_sysctls(systemd_user_session_type)
kernel_read_kernel_sysctls(systemd_user_session_type)

mount_list_runtime(systemd_user_session_type)

selinux_compute_create_context(systemd_user_session_type)

storage_getattr_fixed_disk_dev(systemd_user_session_type)

# for systemd to read udev status
udev_read_pid_files(systemd_user_session_type)
udev_list_pids(systemd_user_session_type)