-
Notifications
You must be signed in to change notification settings - Fork 91
/
container.if
1046 lines (926 loc) · 25.9 KB
/
container.if
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
## <summary>The open-source application container engine.</summary>
########################################
## <summary>
## Execute container in the container domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
#
interface(`container_runtime_domtrans',`
gen_require(`
type container_runtime_t, container_runtime_exec_t;
type container_runtime_tmpfs_t;
')
corecmd_search_bin($1)
domtrans_pattern($1, container_runtime_exec_t, container_runtime_t)
allow container_runtime_t $1:fifo_file setattr;
')
########################################
## <summary>
## Execute container runtime in the container runtime domain
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
## <param name="role">
## <summary>
## Role allowed access.
## </summary>
## </param>
## <rolecap/>
#
interface(`container_runtime_run',`
gen_require(`
type container_runtime_t;
class dbus send_msg;
')
container_runtime_domtrans($1)
role $2 types container_runtime_t;
allow $1 container_runtime_t:dbus send_msg;
')
########################################
## <summary>
## Execute container in the caller domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
#
interface(`container_runtime_exec',`
gen_require(`
type container_runtime_exec_t;
')
corecmd_search_bin($1)
can_exec($1, container_runtime_exec_t)
')
########################################
## <summary>
## Read the process state of container runtime
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_read_state',`
gen_require(`
type container_runtime_t;
')
ps_process_pattern($1, container_runtime_t)
')
########################################
## <summary>
## Search container lib directories.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_search_lib',`
gen_require(`
type container_var_lib_t;
')
allow $1 container_var_lib_t:dir search_dir_perms;
files_search_var_lib($1)
')
########################################
## <summary>
## Execute container lib directories.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_exec_lib',`
gen_require(`
type container_var_lib_t;
')
allow $1 container_var_lib_t:dir search_dir_perms;
can_exec($1, container_var_lib_t)
')
########################################
## <summary>
## Read container lib files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_read_lib_files',`
gen_require(`
type container_var_lib_t;
')
files_search_var_lib($1)
read_files_pattern($1, container_var_lib_t, container_var_lib_t)
')
########################################
## <summary>
## Read container share files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_read_share_files',`
gen_require(`
type container_ro_file_t;
')
files_search_var_lib($1)
list_dirs_pattern($1, container_ro_file_t, container_ro_file_t)
read_files_pattern($1, container_ro_file_t, container_ro_file_t)
read_lnk_files_pattern($1, container_ro_file_t, container_ro_file_t)
')
########################################
## <summary>
## Read container runtime tmpfs files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_runtime_read_tmpfs_files',`
gen_require(`
type container_runtime_tmpfs_t;
')
files_search_var_lib($1)
list_dirs_pattern($1, container_runtime_tmpfs_t, container_runtime_tmpfs_t)
read_files_pattern($1, container_runtime_tmpfs_t, container_runtime_tmpfs_t)
read_lnk_files_pattern($1, container_runtime_tmpfs_t, container_runtime_tmpfs_t)
')
########################################
## <summary>
## Manage container share files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_manage_share_files',`
gen_require(`
type container_ro_file_t;
')
files_search_var_lib($1)
list_dirs_pattern($1, container_ro_file_t, container_ro_file_t)
manage_files_pattern($1, container_ro_file_t, container_ro_file_t)
manage_lnk_files_pattern($1, container_ro_file_t, container_ro_file_t)
')
########################################
## <summary>
## Manage container share dirs.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_manage_share_dirs',`
gen_require(`
type container_ro_file_t;
')
files_search_var_lib($1)
manage_dirs_pattern($1, container_ro_file_t, container_ro_file_t)
')
######################################
## <summary>
## Allow the specified domain to execute container shared files
## in the caller domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_exec_share_files',`
gen_require(`
type container_ro_file_t;
')
can_exec($1, container_ro_file_t)
')
########################################
## <summary>
## Manage container config files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_manage_config_files',`
gen_require(`
type container_config_t;
type kubernetes_file_t;
')
files_search_var_lib($1)
manage_files_pattern($1, container_config_t, container_config_t)
manage_dirs_pattern($1, kubernetes_file_t, kubernetes_file_t)
manage_files_pattern($1, kubernetes_file_t, kubernetes_file_t)
')
########################################
## <summary>
## Manage container lib files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_manage_lib_files',`
gen_require(`
type container_var_lib_t;
')
files_search_var_lib($1)
manage_files_pattern($1, container_var_lib_t, container_var_lib_t)
manage_lnk_files_pattern($1, container_var_lib_t, container_var_lib_t)
')
########################################
## <summary>
## Manage container files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_manage_files',`
gen_require(`
type container_file_t;
')
manage_files_pattern($1, container_file_t, container_file_t)
manage_lnk_files_pattern($1, container_file_t, container_file_t)
')
########################################
## <summary>
## Manage container directories.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_manage_dirs',`
gen_require(`
type container_file_t;
')
manage_dirs_pattern($1, container_file_t, container_file_t)
')
########################################
## <summary>
## Manage container lib directories.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_manage_lib_dirs',`
gen_require(`
type container_var_lib_t;
')
files_search_var_lib($1)
manage_dirs_pattern($1, container_var_lib_t, container_var_lib_t)
')
########################################
## <summary>
## Create objects in a container var lib directory
## with an automatic type transition to
## a specified private type.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <param name="private_type">
## <summary>
## The type of the object to create.
## </summary>
## </param>
## <param name="object_class">
## <summary>
## The class of the object to be created.
## </summary>
## </param>
## <param name="name" optional="true">
## <summary>
## The name of the object being created.
## </summary>
## </param>
#
interface(`container_lib_filetrans',`
gen_require(`
type container_var_lib_t;
')
filetrans_pattern($1, container_var_lib_t, $2, $3, $4)
')
########################################
## <summary>
## Read container PID files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_read_pid_files',`
gen_require(`
type container_var_run_t;
')
files_search_pids($1)
read_files_pattern($1, container_var_run_t, container_var_run_t)
')
########################################
## <summary>
## Execute container server in the container domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
#
interface(`container_systemctl',`
gen_require(`
type container_runtime_t;
type container_unit_file_t;
')
systemd_exec_systemctl($1)
init_reload_services($1)
systemd_read_fifo_file_passwd_run($1)
allow $1 container_unit_file_t:file read_file_perms;
allow $1 container_unit_file_t:service manage_service_perms;
ps_process_pattern($1, container_runtime_t)
')
########################################
## <summary>
## Read and write container shared memory.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_rw_sem',`
gen_require(`
type container_runtime_t;
')
allow $1 container_runtime_t:sem rw_sem_perms;
')
########################################
## <summary>
## Allow the specified domain to append
## to container files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_append_file',`
gen_require(`
type container_file_t;
')
append_files_pattern($1, container_file_t, container_file_t)
')
#######################################
## <summary>
## Read and write the container pty type.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_use_ptys',`
gen_require(`
type container_devpts_t;
')
allow $1 container_devpts_t:chr_file rw_term_perms;
')
#######################################
## <summary>
## Allow domain to create container content
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_filetrans_named_content',`
gen_require(`
type container_var_lib_t;
type container_file_t;
type container_ro_file_t;
type container_log_t;
type container_var_run_t;
type container_home_t;
type kubernetes_file_t;
type container_runtime_tmpfs_t;
type container_kvm_var_run_t;
type data_home_t;
')
files_pid_filetrans($1, container_var_run_t, file, "container.pid")
files_pid_filetrans($1, container_var_run_t, file, "docker.pid")
files_pid_filetrans($1, container_var_run_t, sock_file, "container.sock")
files_pid_filetrans($1, container_var_run_t, dir, "container-client")
files_pid_filetrans($1, container_var_run_t, dir, "docker")
files_pid_filetrans($1, container_var_run_t, dir, "containerd")
files_pid_filetrans($1, container_var_run_t, dir, "buildkit")
files_pid_filetrans($1, container_var_run_t, dir, "ocid")
files_pid_filetrans($1, container_var_run_t, dir, "containers")
files_pid_filetrans($1, container_kvm_var_run_t, dir, "kata-containers")
logging_log_filetrans($1, container_log_t, dir, "kube-apiserver")
logging_log_filetrans($1, container_log_t, dir, "lxc")
files_var_lib_filetrans($1, container_var_lib_t, dir, "containers")
files_var_lib_filetrans($1, container_file_t, dir, "origin")
files_var_lib_filetrans($1, container_var_lib_t, dir, "ocid")
files_var_lib_filetrans($1, container_var_lib_t, dir, "docker")
files_var_lib_filetrans($1, container_var_lib_t, dir, "docker-latest")
files_var_filetrans($1, container_ro_file_t, dir, "kata-containers")
files_var_lib_filetrans($1, container_ro_file_t, dir, "kata-containers")
files_var_lib_filetrans($1, container_var_lib_t, dir, "containerd")
files_var_lib_filetrans($1, container_var_lib_t, dir, "buildkit")
files_var_lib_filetrans($1, container_ro_file_t, dir, "shared")
filetrans_pattern($1, container_var_lib_t, container_file_t, dir, "_data")
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, file, "config.env")
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, file, "hosts")
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, file, "hostname")
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, file, "resolv.conf")
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, dir, "sandboxes")
# The "snapshots" directory of containerd and BuildKit must be writable, as it is used as an upperdir as well as a lowerdir.
# (lowerdir=/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/3/fs,
# upperdir=/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/4/fs,
# workdir=/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/4/work)
filetrans_pattern($1, container_var_lib_t, container_file_t, dir, "snapshots")
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, dir, "init")
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, dir, "overlay")
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, dir, "overlay-images")
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, dir, "overlay-layers")
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, dir, "overlay2")
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, dir, "overlay2-images")
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, dir, "overlay2-layers")
# "/var/lib/buildkit/runc-<SNAPSHOTTER>/executor" contains "resolv.conf" and "hosts.<RANDOM>", for OCI (runc) worker mode.
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, dir, "executor")
# "/var/lib/buildkit/containerd-<SNAPSHOTTER>" contains resolv.conf and hosts.<RANDOM>, for containerd worker mode.
# Unlike the runc-<SNAPSHOTTER> directory, this directory does not contain the "executor" directory inside it.
# Core snapshotters
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, dir, "containerd-overlayfs")
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, dir, "containerd-native")
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, dir, "containerd-btrfs")
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, dir, "containerd-zfs")
# Non-core snapshotters
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, dir, "containerd-fuse-overlayfs")
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, dir, "containerd-nydus")
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, dir, "containerd-overlaybd")
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, dir, "containerd-stargz")
# Third-party snapshotters
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, dir, "containerd-soci")
filetrans_pattern($1, data_home_t, container_ro_file_t, dir, "ramalama")
filetrans_pattern($1, data_home_t, container_ro_file_t, dir, "overlay")
filetrans_pattern($1, data_home_t, container_ro_file_t, dir, "overlay-images")
filetrans_pattern($1, data_home_t, container_ro_file_t, dir, "overlay-layers")
filetrans_pattern($1, data_home_t, container_ro_file_t, dir, "overlay2")
filetrans_pattern($1, data_home_t, container_ro_file_t, dir, "overlay2-images")
filetrans_pattern($1, data_home_t, container_ro_file_t, dir, "overlay2-layers")
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, dir, "atomic")
userdom_admin_home_dir_filetrans($1, container_home_t, dir, ".container")
filetrans_pattern($1, container_var_lib_t, container_ro_file_t, dir, "kata-containers")
filetrans_pattern($1, data_home_t, container_ro_file_t, dir, "kata-containers")
filetrans_pattern($1, container_var_run_t, container_runtime_tmpfs_t, dir, "shm")
files_etc_filetrans($1, kubernetes_file_t, dir, "kubernetes")
')
########################################
## <summary>
## Connect to container over a unix stream socket.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_stream_connect',`
gen_require(`
type container_runtime_t, container_var_run_t, container_runtime_tmpfs_t;
')
files_search_pids($1)
stream_connect_pattern($1, container_var_run_t, container_var_run_t, container_runtime_t)
stream_connect_pattern($1, container_runtime_tmpfs_t, container_runtime_tmpfs_t, container_runtime_t)
allow $1 container_runtime_tmpfs_t:lnk_file read_lnk_file_perms;
')
########################################
## <summary>
## Connect to SPC containers over a unix stream socket.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_spc_stream_connect',`
gen_require(`
type spc_t, spc_var_run_t;
')
files_search_pids($1)
allow $1 spc_t:unix_stream_socket connectto;
')
########################################
## <summary>
## All of the rules required to administrate
## an container environment
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_admin',`
gen_require(`
type container_runtime_t;
type container_var_lib_t, container_var_run_t;
type container_unit_file_t;
type container_lock_t;
type container_log_t;
type container_config_t;
type container_file_t;
')
allow $1 container_runtime_t:process { ptrace signal_perms };
ps_process_pattern($1, container_runtime_t)
admin_pattern($1, container_config_t)
files_search_var_lib($1)
admin_pattern($1, container_var_lib_t)
files_search_pids($1)
admin_pattern($1, container_var_run_t)
files_search_locks($1)
admin_pattern($1, container_lock_t)
logging_search_logs($1)
admin_pattern($1, container_log_t)
container_systemctl($1)
admin_pattern($1, container_unit_file_t)
allow $1 container_unit_file_t:service all_service_perms;
admin_pattern($1, container_file_t)
optional_policy(`
systemd_passwd_agent_exec($1)
systemd_read_fifo_file_passwd_run($1)
')
')
########################################
## <summary>
## Execute container_auth_exec_t in the container_auth domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
#
interface(`container_auth_domtrans',`
gen_require(`
type container_auth_t, container_auth_exec_t;
')
corecmd_search_bin($1)
domtrans_pattern($1, container_auth_exec_t, container_auth_t)
')
######################################
## <summary>
## Execute container_auth in the caller domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_auth_exec',`
gen_require(`
type container_auth_exec_t;
')
corecmd_search_bin($1)
can_exec($1, container_auth_exec_t)
')
########################################
## <summary>
## Connect to container_auth over a unix stream socket.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_auth_stream_connect',`
gen_require(`
type container_auth_t, container_plugin_var_run_t;
')
files_search_pids($1)
stream_connect_pattern($1, container_plugin_var_run_t, container_plugin_var_run_t, container_auth_t)
')
########################################
## <summary>
## container domain typebounds calling domain.
## </summary>
## <param name="domain">
## <summary>
## Domain to be typebound.
## </summary>
## </param>
#
interface(`container_runtime_typebounds',`
gen_require(`
type container_runtime_t;
')
allow container_runtime_t $1:process2 nnp_transition;
')
########################################
## <summary>
## Allow any container_runtime_exec_t to be an entrypoint of this domain
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <rolecap/>
#
interface(`container_runtime_entrypoint',`
gen_require(`
type container_runtime_exec_t;
')
allow $1 container_runtime_exec_t:file entrypoint;
')
interface(`docker_exec_lib',`
container_exec_lib($1)
')
interface(`docker_read_share_files',`
container_read_share_files($1)
')
interface(`docker_exec_share_files',`
container_exec_share_files($1)
')
interface(`docker_manage_lib_files',`
container_manage_lib_files($1)
')
interface(`docker_manage_lib_dirs',`
container_manage_lib_dirs($1)
')
interface(`docker_lib_filetrans',`
container_lib_filetrans($1, $2, $3, $4)
')
interface(`docker_read_pid_files',`
container_read_pid_files($1)
')
interface(`docker_systemctl',`
container_systemctl($1)
')
interface(`docker_use_ptys',`
container_use_ptys($1)
')
interface(`docker_stream_connect',`
container_stream_connect($1)
')
interface(`docker_spc_stream_connect',`
container_spc_stream_connect($1)
')
########################################
## <summary>
## Read the process state of spc containers
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_spc_read_state',`
gen_require(`
type spc_t;
')
ps_process_pattern($1, spc_t)
')
########################################
## <summary>
## Creates types and rules for a basic
## container runtime process domain.
## </summary>
## <param name="prefix">
## <summary>
## Prefix for the domain.
## </summary>
## </param>
#
template(`container_runtime_domain_template',`
gen_require(`
attribute container_runtime_domain;
type container_runtime_t;
type container_var_lib_t;
type container_ro_file_t;
role system_r, sysadm_r;
')
type $1_t, container_runtime_domain;
role system_r types $1_t;
role sysadm_r types $1_t;
domain_type($1_t)
domain_subj_id_change_exemption($1_t)
domain_role_change_exemption($1_t)
kernel_read_system_state($1_t)
kernel_read_all_proc($1_t)
mls_file_read_to_clearance($1_t)
mls_file_write_to_clearance($1_t)
storage_raw_rw_fixed_disk($1_t)
auth_use_nsswitch($1_t)
logging_send_syslog_msg($1_t)
')
########################################
## <summary>
## Creates types and rules for a basic
## container process domain.
## </summary>
## <param name="prefix">
## <summary>
## Prefix for the domain.
## </summary>
## </param>
## <param name="prefix">
## <summary>
## Prefix for the file type.
## </summary>
## </param>
#
template(`container_domain_template',`
gen_require(`
attribute container_domain;
type container_runtime_t;
type container_var_lib_t;
type container_ro_file_t;
')
type $1_t, container_domain;
domain_type($1_t)
domain_user_exemption_target($1_t)
allow $1_t $2_file_t:file entrypoint;
container_manage_files_template($1, $2)
')
########################################
## <summary>
## Manage container files template
## </summary>
## <param name="prefix">
## <summary>
## Prefix for the domain.
## </summary>
## </param>
## <param name="prefix">
## <summary>
## Prefix for the file type.
## </summary>
## </param>
#
template(`container_manage_files_template',`
gen_require(`
attribute container_domain;
type container_runtime_t;
type container_var_lib_t;
type container_ro_file_t;
')
mls_rangetrans_target($1_t)
mcs_constrained($1_t)
role system_r types $1_t;
kernel_read_all_proc($1_t)
allow $1_t $2_file_t:dir_file_class_set { relabelfrom relabelto map };
manage_files_pattern($1_t, $2_file_t, $2_file_t)
exec_files_pattern($1_t, $2_file_t, $2_file_t)
manage_lnk_files_pattern($1_t, $2_file_t, $2_file_t)
manage_dirs_pattern($1_t, $2_file_t, $2_file_t)
manage_chr_files_pattern($1_t, $2_file_t, $2_file_t)
allow $1_t $2_file_t:chr_file { mmap_file_perms watch watch_reads };
manage_blk_files_pattern($1_t, $2_file_t, $2_file_t)
manage_fifo_files_pattern($1_t, $2_file_t, $2_file_t)
manage_sock_files_pattern($1_t, $2_file_t, $2_file_t)
allow $1_t $2_file_t:{file dir} mounton;
allow $1_t $2_file_t:filesystem { mount remount unmount };
allow $1_t $2_file_t:dir_file_class_set { relabelfrom relabelto map };
fs_tmpfs_filetrans($1_t, $2_file_t, { dir file lnk_file })
')
########################################
## <summary>
## Read and write a spc_t unnamed pipe.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`container_spc_rw_pipes',`
gen_require(`
type spc_t;
')
allow $1 spc_t:fifo_file rw_inherited_fifo_file_perms;
')
########################################
## <summary>
## Execute container in the container domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
#
interface(`container_kubelet_domtrans',`
gen_require(`
type kubelet_t, kubelet_exec_t;
')
corecmd_search_bin($1)
domtrans_pattern($1, kubelet_exec_t, kubelet_t)
')
########################################
## <summary>
## Execute kubelet_exec_t in the kubelet_t domain
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
## <param name="role">
## <summary>
## Role allowed access.
## </summary>
## </param>
## <rolecap/>
#
interface(`container_kubelet_run',`