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
|
policy_module(xserver, 3.1.0)
gen_require(`
class x_drawable all_x_drawable_perms;
class x_screen all_x_screen_perms;
class x_gc all_x_gc_perms;
class x_font all_x_font_perms;
class x_colormap all_x_colormap_perms;
class x_property all_x_property_perms;
class x_selection all_x_selection_perms;
class x_cursor all_x_cursor_perms;
class x_client all_x_client_perms;
class x_device all_x_device_perms;
class x_server all_x_server_perms;
class x_extension all_x_extension_perms;
class x_resource all_x_resource_perms;
class x_event all_x_event_perms;
class x_synthetic_event all_x_synthetic_event_perms;
')
########################################
#
# Declarations
#
## <desc>
## <p>
## Allows clients to write to the X server shared
## memory segments.
## </p>
## </desc>
gen_tunable(allow_write_xshm, false)
## <desc>
## <p>
## Allow xdm logins as sysadm
## </p>
## </desc>
gen_tunable(xdm_sysadm_login, false)
## <desc>
## <p>
## Support X userspace object manager
## </p>
## </desc>
gen_tunable(xserver_object_manager, false)
attribute input_xevent_type;
attribute xserver_unconfined_type;
attribute x_domain;
attribute x_userdomain;
attribute xproperty_type;
attribute xselection_type;
attribute xextension_type;
attribute xevent_type;
type accelgraphics_xext_t, xextension_type;
type client_xevent_t, xevent_type;
type clipboard_xproperty_t, xproperty_type;
type clipboard_xselection_t, xselection_type;
type debug_xext_t, xextension_type;
type directhw_xext_t alias disallowed_xext_t, xextension_type;
type focus_xevent_t, xevent_type;
type iceauth_t;
type iceauth_exec_t;
typealias iceauth_t alias { user_iceauth_t staff_iceauth_t sysadm_iceauth_t };
typealias iceauth_t alias { auditadm_iceauth_t secadm_iceauth_t };
application_domain(iceauth_t, iceauth_exec_t)
ubac_constrained(iceauth_t)
type iceauth_home_t;
typealias iceauth_home_t alias { user_iceauth_home_t staff_iceauth_home_t sysadm_iceauth_home_t };
typealias iceauth_home_t alias { auditadm_iceauth_home_t secadm_iceauth_home_t };
files_poly_member(iceauth_home_t)
userdom_user_home_content(iceauth_home_t)
type info_xproperty_t, xproperty_type;
type input_xevent_t, xevent_type;
type manage_xevent_t, xevent_type;
type output_xext_t, xextension_type;
type property_xevent_t, xevent_type;
type remote_xclient_t;
type rootwindow_t;
typealias rootwindow_t alias { user_rootwindow_t staff_rootwindow_t sysadm_rootwindow_t };
typealias rootwindow_t alias { auditadm_rootwindow_t secadm_rootwindow_t };
ubac_constrained(rootwindow_t)
type screensaver_xext_t, xextension_type;
type security_xext_t, xextension_type;
type shmem_xext_t, xextension_type;
type std_xext_t, xextension_type;
type video_xext_t, xextension_type;
type unknown_xevent_t, xevent_type;
xserver_object_types_template(user)
typealias user_xproperty_t alias { staff_xproperty_t sysadm_xproperty_t };
typealias user_xproperty_t alias { auditadm_xproperty_t secadm_xproperty_t };
typealias user_input_xevent_t alias { staff_input_xevent_t sysadm_input_xevent_t };
typealias user_input_xevent_t alias { auditadm_input_xevent_t secadm_input_xevent_t };
typealias user_property_xevent_t alias { staff_property_xevent_t sysadm_property_xevent_t };
typealias user_property_xevent_t alias { auditadm_property_xevent_t secadm_property_xevent_t };
typealias user_focus_xevent_t alias { staff_focus_xevent_t sysadm_focus_xevent_t };
typealias user_focus_xevent_t alias { auditadm_focus_xevent_t secadm_focus_xevent_t };
typealias user_manage_xevent_t alias { staff_manage_xevent_t sysadm_manage_xevent_t };
typealias user_manage_xevent_t alias { auditadm_manage_xevent_t secadm_manage_xevent_t };
typealias user_default_xevent_t alias { staff_default_xevent_t sysadm_default_xevent_t };
typealias user_default_xevent_t alias { auditadm_default_xevent_t secadm_default_xevent_t };
typealias user_client_xevent_t alias { staff_client_xevent_t sysadm_client_xevent_t };
typealias user_client_xevent_t alias { auditadm_client_xevent_t secadm_client_xevent_t };
type user_fonts_t;
typealias user_fonts_t alias { staff_fonts_t sysadm_fonts_t };
typealias user_fonts_t alias { auditadm_fonts_t secadm_fonts_t };
userdom_user_home_content(user_fonts_t)
type user_fonts_cache_t;
typealias user_fonts_cache_t alias { staff_fonts_cache_t sysadm_fonts_cache_t };
typealias user_fonts_cache_t alias { auditadm_fonts_cache_t secadm_fonts_cache_t };
userdom_user_home_content(user_fonts_cache_t)
type user_fonts_config_t;
typealias user_fonts_config_t alias { staff_fonts_config_t sysadm_fonts_config_t };
typealias user_fonts_config_t alias { auditadm_fonts_config_t secadm_fonts_config_t };
userdom_user_home_content(user_fonts_config_t)
type xevent_t alias default_xevent_t, xevent_type;
type xext_t alias unknown_xext_t, xextension_type;
type xproperty_t alias default_xproperty_t, xproperty_type;
type xselection_t alias default_xselection_t, xselection_type;
type xauth_t;
type xauth_exec_t;
typealias xauth_t alias { user_xauth_t staff_xauth_t sysadm_xauth_t };
typealias xauth_t alias { auditadm_xauth_t secadm_xauth_t };
application_domain(xauth_t, xauth_exec_t)
ubac_constrained(xauth_t)
type xauth_home_t;
typealias xauth_home_t alias { user_xauth_home_t staff_xauth_home_t sysadm_xauth_home_t };
typealias xauth_home_t alias { auditadm_xauth_home_t secadm_xauth_home_t };
files_poly_member(xauth_home_t)
userdom_user_home_content(xauth_home_t)
type xauth_tmp_t;
typealias xauth_tmp_t alias { user_xauth_tmp_t staff_xauth_tmp_t sysadm_xauth_tmp_t };
typealias xauth_tmp_t alias { auditadm_xauth_tmp_t secadm_xauth_tmp_t };
files_tmp_file(xauth_tmp_t)
ubac_constrained(xauth_tmp_t)
# this is not actually a device, its a pipe
type xconsole_device_t;
files_type(xconsole_device_t)
fs_associate_tmpfs(xconsole_device_t)
files_associate_tmp(xconsole_device_t)
type xdm_t;
type xdm_exec_t;
auth_login_pgm_domain(xdm_t)
init_domain(xdm_t, xdm_exec_t)
init_daemon_domain(xdm_t, xdm_exec_t)
type xdm_lock_t;
files_lock_file(xdm_lock_t)
type xdm_rw_etc_t;
files_type(xdm_rw_etc_t)
type xdm_var_lib_t;
files_type(xdm_var_lib_t)
type xdm_var_run_t;
files_pid_file(xdm_var_run_t)
type xdm_tmp_t;
files_tmp_file(xdm_tmp_t)
typealias xdm_tmp_t alias ice_tmp_t;
type xdm_tmpfs_t;
files_tmpfs_file(xdm_tmpfs_t)
# type for /var/lib/xkb
type xkb_var_lib_t;
files_type(xkb_var_lib_t)
# Type for the executable used to start the X server, e.g. Xwrapper.
type xserver_t;
type xserver_exec_t;
typealias xserver_t alias { user_xserver_t staff_xserver_t sysadm_xserver_t };
typealias xserver_t alias { auditadm_xserver_t secadm_xserver_t };
xserver_object_types_template(xdm)
xserver_common_x_domain_template(xdm,xdm_t)
init_system_domain(xserver_t, xserver_exec_t)
ubac_constrained(xserver_t)
type xserver_tmp_t;
typealias xserver_tmp_t alias { user_xserver_tmp_t staff_xserver_tmp_t sysadm_xserver_tmp_t };
typealias xserver_tmp_t alias { auditadm_xserver_tmp_t secadm_xserver_tmp_t };
files_tmp_file(xserver_tmp_t)
ubac_constrained(xserver_tmp_t)
type xserver_tmpfs_t;
typealias xserver_tmpfs_t alias { user_xserver_tmpfs_t staff_xserver_tmpfs_t sysadm_xserver_tmpfs_t };
typealias xserver_tmpfs_t alias { auditadm_xserver_tmpfs_t secadm_xserver_tmpfs_t };
files_tmpfs_file(xserver_tmpfs_t)
ubac_constrained(xserver_tmpfs_t)
type xsession_exec_t;
corecmd_executable_file(xsession_exec_t)
# Type for the X server log file.
type xserver_log_t;
logging_log_file(xserver_log_t)
ifdef(`enable_mcs',`
init_ranged_domain(xdm_t,xdm_exec_t,s0 - mcs_systemhigh)
init_ranged_daemon_domain(xdm_t,xdm_exec_t,s0 - mcs_systemhigh)
')
optional_policy(`
prelink_object_file(xkb_var_lib_t)
')
########################################
#
# Iceauth local policy
#
allow iceauth_t iceauth_home_t:file manage_file_perms;
userdom_user_home_dir_filetrans(iceauth_t, iceauth_home_t, file)
allow xdm_t iceauth_home_t:file read_file_perms;
fs_search_auto_mountpoints(iceauth_t)
userdom_use_user_terminals(iceauth_t)
tunable_policy(`use_nfs_home_dirs',`
fs_manage_nfs_files(iceauth_t)
')
tunable_policy(`use_samba_home_dirs',`
fs_manage_cifs_files(iceauth_t)
')
########################################
#
# Xauth local policy
#
allow xauth_t self:process signal;
allow xauth_t self:unix_stream_socket create_stream_socket_perms;
allow xauth_t xauth_home_t:file manage_file_perms;
userdom_user_home_dir_filetrans(xauth_t, xauth_home_t, file)
manage_dirs_pattern(xauth_t, xauth_tmp_t, xauth_tmp_t)
manage_files_pattern(xauth_t, xauth_tmp_t, xauth_tmp_t)
files_tmp_filetrans(xauth_t, xauth_tmp_t, { file dir })
allow xdm_t xauth_home_t:file manage_file_perms;
userdom_user_home_dir_filetrans(xdm_t, xauth_home_t, file)
domain_use_interactive_fds(xauth_t)
files_read_etc_files(xauth_t)
files_search_pids(xauth_t)
fs_getattr_xattr_fs(xauth_t)
fs_search_auto_mountpoints(xauth_t)
# cjp: why?
term_use_ptmx(xauth_t)
auth_use_nsswitch(xauth_t)
userdom_use_user_terminals(xauth_t)
userdom_read_user_tmp_files(xauth_t)
xserver_rw_xdm_tmp_files(xauth_t)
tunable_policy(`use_nfs_home_dirs',`
fs_manage_nfs_files(xauth_t)
')
tunable_policy(`use_samba_home_dirs',`
fs_manage_cifs_files(xauth_t)
')
optional_policy(`
ssh_sigchld(xauth_t)
ssh_read_pipes(xauth_t)
ssh_dontaudit_rw_tcp_sockets(xauth_t)
')
########################################
#
# XDM Local policy
#
allow xdm_t self:capability { setgid setuid sys_resource kill sys_tty_config mknod chown dac_override dac_read_search fowner fsetid ipc_owner sys_nice sys_rawio net_bind_service };
allow xdm_t self:process { setexec setpgid getsched setsched setrlimit signal_perms setkeycreate };
allow xdm_t self:fifo_file rw_fifo_file_perms;
allow xdm_t self:shm create_shm_perms;
allow xdm_t self:sem create_sem_perms;
allow xdm_t self:unix_stream_socket { connectto create_stream_socket_perms };
allow xdm_t self:unix_dgram_socket create_socket_perms;
allow xdm_t self:tcp_socket create_stream_socket_perms;
allow xdm_t self:udp_socket create_socket_perms;
allow xdm_t self:socket create_socket_perms;
allow xdm_t self:appletalk_socket create_socket_perms;
allow xdm_t self:key { search link write };
allow xdm_t xconsole_device_t:fifo_file { getattr setattr };
# Allow gdm to run gdm-binary
can_exec(xdm_t, xdm_exec_t)
allow xdm_t xdm_lock_t:file manage_file_perms;
files_lock_filetrans(xdm_t, xdm_lock_t, file)
# wdm has its own config dir /etc/X11/wdm
# this is ugly, daemons should not create files under /etc!
manage_files_pattern(xdm_t, xdm_rw_etc_t, xdm_rw_etc_t)
manage_dirs_pattern(xdm_t, xdm_tmp_t, xdm_tmp_t)
manage_files_pattern(xdm_t, xdm_tmp_t, xdm_tmp_t)
manage_sock_files_pattern(xdm_t, xdm_tmp_t, xdm_tmp_t)
files_tmp_filetrans(xdm_t, xdm_tmp_t, { file dir sock_file })
manage_dirs_pattern(xdm_t, xdm_tmpfs_t, xdm_tmpfs_t)
manage_files_pattern(xdm_t, xdm_tmpfs_t, xdm_tmpfs_t)
manage_lnk_files_pattern(xdm_t, xdm_tmpfs_t, xdm_tmpfs_t)
manage_fifo_files_pattern(xdm_t, xdm_tmpfs_t, xdm_tmpfs_t)
manage_sock_files_pattern(xdm_t, xdm_tmpfs_t, xdm_tmpfs_t)
fs_tmpfs_filetrans(xdm_t, xdm_tmpfs_t,{ dir file lnk_file sock_file fifo_file })
manage_dirs_pattern(xdm_t, xdm_var_lib_t, xdm_var_lib_t)
manage_files_pattern(xdm_t, xdm_var_lib_t, xdm_var_lib_t)
files_var_lib_filetrans(xdm_t, xdm_var_lib_t, file)
manage_dirs_pattern(xdm_t, xdm_var_run_t, xdm_var_run_t)
manage_files_pattern(xdm_t, xdm_var_run_t, xdm_var_run_t)
manage_fifo_files_pattern(xdm_t, xdm_var_run_t, xdm_var_run_t)
files_pid_filetrans(xdm_t, xdm_var_run_t, { dir file fifo_file })
allow xdm_t xserver_t:process signal;
allow xdm_t xserver_t:unix_stream_socket connectto;
allow xdm_t xserver_tmp_t:sock_file rw_sock_file_perms;
allow xdm_t xserver_tmp_t:dir { setattr list_dir_perms };
# transition to the xdm xserver
domtrans_pattern(xdm_t, xserver_exec_t, xserver_t)
allow xserver_t xdm_t:process signal;
allow xdm_t xserver_t:process { noatsecure siginh rlimitinh signal sigkill };
allow xdm_t xserver_t:shm rw_shm_perms;
# connect to xdm xserver over stream socket
stream_connect_pattern(xdm_t,xserver_tmp_t,xserver_tmp_t,xserver_t)
# Remove /tmp/.X11-unix/X0.
delete_files_pattern(xdm_t,xserver_tmp_t,xserver_tmp_t)
delete_sock_files_pattern(xdm_t,xserver_tmp_t,xserver_tmp_t)
manage_dirs_pattern(xdm_t, xserver_log_t, xserver_log_t)
manage_files_pattern(xdm_t, xserver_log_t, xserver_log_t)
manage_fifo_files_pattern(xdm_t, xserver_log_t, xserver_log_t)
logging_log_filetrans(xdm_t, xserver_log_t, file)
kernel_read_system_state(xdm_t)
kernel_read_kernel_sysctls(xdm_t)
kernel_read_net_sysctls(xdm_t)
kernel_read_network_state(xdm_t)
corecmd_exec_shell(xdm_t)
corecmd_exec_bin(xdm_t)
corenet_all_recvfrom_unlabeled(xdm_t)
corenet_all_recvfrom_netlabel(xdm_t)
corenet_tcp_sendrecv_generic_if(xdm_t)
corenet_udp_sendrecv_generic_if(xdm_t)
corenet_tcp_sendrecv_all_nodes(xdm_t)
corenet_udp_sendrecv_all_nodes(xdm_t)
corenet_tcp_sendrecv_all_ports(xdm_t)
corenet_udp_sendrecv_all_ports(xdm_t)
corenet_tcp_bind_all_nodes(xdm_t)
corenet_udp_bind_all_nodes(xdm_t)
corenet_tcp_connect_all_ports(xdm_t)
corenet_sendrecv_all_client_packets(xdm_t)
# xdm tries to bind to biff_port_t
corenet_dontaudit_tcp_bind_all_ports(xdm_t)
dev_read_rand(xdm_t)
dev_read_sysfs(xdm_t)
dev_getattr_framebuffer_dev(xdm_t)
dev_setattr_framebuffer_dev(xdm_t)
dev_getattr_mouse_dev(xdm_t)
dev_setattr_mouse_dev(xdm_t)
dev_rw_apm_bios(xdm_t)
dev_setattr_apm_bios_dev(xdm_t)
dev_rw_dri(xdm_t)
dev_rw_agp(xdm_t)
dev_getattr_xserver_misc_dev(xdm_t)
dev_setattr_xserver_misc_dev(xdm_t)
dev_getattr_misc_dev(xdm_t)
dev_setattr_misc_dev(xdm_t)
dev_dontaudit_rw_misc(xdm_t)
dev_getattr_video_dev(xdm_t)
dev_setattr_video_dev(xdm_t)
dev_getattr_scanner_dev(xdm_t)
dev_setattr_scanner_dev(xdm_t)
dev_getattr_sound_dev(xdm_t)
dev_setattr_sound_dev(xdm_t)
dev_getattr_power_mgmt_dev(xdm_t)
dev_setattr_power_mgmt_dev(xdm_t)
domain_use_interactive_fds(xdm_t)
# Do not audit denied probes of /proc.
domain_dontaudit_read_all_domains_state(xdm_t)
files_read_etc_files(xdm_t)
files_read_var_files(xdm_t)
files_read_etc_runtime_files(xdm_t)
files_exec_etc_files(xdm_t)
files_list_mnt(xdm_t)
# Read /usr/share/terminfo/l/linux and /usr/share/icons/default/index.theme...
files_read_usr_files(xdm_t)
# Poweroff wants to create the /poweroff file when run from xdm
files_create_boot_flag(xdm_t)
fs_getattr_all_fs(xdm_t)
fs_search_auto_mountpoints(xdm_t)
storage_dontaudit_read_fixed_disk(xdm_t)
storage_dontaudit_write_fixed_disk(xdm_t)
storage_dontaudit_setattr_fixed_disk_dev(xdm_t)
storage_dontaudit_raw_read_removable_device(xdm_t)
storage_dontaudit_raw_write_removable_device(xdm_t)
storage_dontaudit_setattr_removable_dev(xdm_t)
storage_dontaudit_rw_scsi_generic(xdm_t)
term_setattr_console(xdm_t)
term_use_unallocated_ttys(xdm_t)
term_setattr_unallocated_ttys(xdm_t)
auth_domtrans_pam_console(xdm_t)
auth_manage_pam_pid(xdm_t)
auth_manage_pam_console_data(xdm_t)
auth_rw_faillog(xdm_t)
auth_write_login_records(xdm_t)
# Run telinit->init to shutdown.
init_telinit(xdm_t)
libs_exec_lib_files(xdm_t)
logging_read_generic_logs(xdm_t)
miscfiles_read_localization(xdm_t)
miscfiles_read_fonts(xdm_t)
sysnet_read_config(xdm_t)
userdom_dontaudit_use_unpriv_user_fds(xdm_t)
userdom_create_all_users_keys(xdm_t)
# for .dmrc
userdom_read_user_home_content_files(xdm_t)
# Search /proc for any user domain processes.
userdom_read_all_users_state(xdm_t)
userdom_signal_all_users(xdm_t)
xserver_rw_session(xdm_t,xdm_tmpfs_t)
xserver_unconfined(xdm_t)
tunable_policy(`use_nfs_home_dirs',`
fs_manage_nfs_dirs(xdm_t)
fs_manage_nfs_files(xdm_t)
fs_manage_nfs_symlinks(xdm_t)
fs_exec_nfs_files(xdm_t)
')
tunable_policy(`use_samba_home_dirs',`
fs_manage_cifs_dirs(xdm_t)
fs_manage_cifs_files(xdm_t)
fs_manage_cifs_symlinks(xdm_t)
fs_exec_cifs_files(xdm_t)
')
tunable_policy(`xdm_sysadm_login',`
userdom_xsession_spec_domtrans_all_users(xdm_t)
# FIXME:
# xserver_rw_session_template(xdm,userdomain)
',`
userdom_xsession_spec_domtrans_unpriv_users(xdm_t)
# FIXME:
# xserver_rw_session_template(xdm,unpriv_userdomain)
# dontaudit xserver_t sysadm_t:shm { unix_read unix_write };
# allow xserver_t xdm_tmpfs_t:file rw_file_perms;
')
optional_policy(`
alsa_domtrans(xdm_t)
')
optional_policy(`
consolekit_dbus_chat(xdm_t)
')
optional_policy(`
consoletype_exec(xdm_t)
')
optional_policy(`
# Talk to the console mouse server.
gpm_stream_connect(xdm_t)
gpm_setattr_gpmctl(xdm_t)
')
optional_policy(`
hostname_exec(xdm_t)
')
optional_policy(`
loadkeys_exec(xdm_t)
')
optional_policy(`
locallogin_signull(xdm_t)
')
optional_policy(`
# Do not audit attempts to check whether user root has email
mta_dontaudit_getattr_spool_files(xdm_t)
')
optional_policy(`
resmgr_stream_connect(xdm_t)
')
optional_policy(`
seutil_sigchld_newrole(xdm_t)
')
optional_policy(`
udev_read_db(xdm_t)
')
optional_policy(`
unconfined_domain(xdm_t)
unconfined_domtrans(xdm_t)
ifndef(`distro_redhat',`
allow xdm_t self:process { execheap execmem };
')
ifdef(`distro_rhel4',`
allow xdm_t self:process { execheap execmem };
')
')
optional_policy(`
userhelper_dontaudit_search_config(xdm_t)
')
optional_policy(`
usermanage_read_crack_db(xdm_t)
')
optional_policy(`
xfs_stream_connect(xdm_t)
')
########################################
#
# X server local policy
#
# setuid/setgid for the wrapper program to change UID
# sys_rawio is for iopl access - should not be needed for frame-buffer
# sys_admin, locking shared mem? chowning IPC message queues or semaphores?
# admin of APM bios?
# sys_nice is so that the X server can set a negative nice value
# execheap needed until the X module loader is fixed.
# NVIDIA Needs execstack
allow xserver_t self:capability { dac_override fowner fsetid setgid setuid ipc_owner sys_rawio sys_admin sys_nice sys_tty_config mknod net_bind_service };
dontaudit xserver_t self:capability chown;
allow xserver_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
allow xserver_t self:memprotect mmap_zero;
allow xserver_t self:fd use;
allow xserver_t self:fifo_file rw_fifo_file_perms;
allow xserver_t self:sock_file read_sock_file_perms;
allow xserver_t self:shm create_shm_perms;
allow xserver_t self:sem create_sem_perms;
allow xserver_t self:msgq create_msgq_perms;
allow xserver_t self:msg { send receive };
allow xserver_t self:unix_dgram_socket { create_socket_perms sendto };
allow xserver_t self:unix_stream_socket { create_stream_socket_perms connectto };
allow xserver_t self:tcp_socket create_stream_socket_perms;
allow xserver_t self:udp_socket create_socket_perms;
# Device rules
allow x_domain xserver_t:x_device { read getattr use setattr setfocus grab bell };
allow xserver_t { input_xevent_t input_xevent_type }:x_event send;
domtrans_pattern(xserver_t, xauth_exec_t, xauth_t)
allow xserver_t xauth_home_t:file read_file_perms;
# Labeling rules for root windows and colormaps
type_transition xserver_t xserver_t:{ x_drawable x_colormap } rootwindow_t;
allow xserver_t { rootwindow_t x_domain }:x_drawable send;
manage_dirs_pattern(xserver_t, xserver_tmp_t, xserver_tmp_t)
manage_files_pattern(xserver_t, xserver_tmp_t, xserver_tmp_t)
manage_sock_files_pattern(xserver_t, xserver_tmp_t, xserver_tmp_t)
files_tmp_filetrans(xserver_t, xserver_tmp_t, { file dir sock_file })
filetrans_pattern(xserver_t, xserver_tmp_t, xserver_tmp_t,sock_file)
manage_dirs_pattern(xserver_t, xserver_tmpfs_t, xserver_tmpfs_t)
manage_files_pattern(xserver_t, xserver_tmpfs_t, xserver_tmpfs_t)
manage_lnk_files_pattern(xserver_t, xserver_tmpfs_t, xserver_tmpfs_t)
manage_fifo_files_pattern(xserver_t, xserver_tmpfs_t, xserver_tmpfs_t)
manage_sock_files_pattern(xserver_t, xserver_tmpfs_t, xserver_tmpfs_t)
fs_tmpfs_filetrans(xserver_t, xserver_tmpfs_t, { dir file lnk_file sock_file fifo_file })
manage_files_pattern(xserver_t, xkb_var_lib_t, xkb_var_lib_t)
manage_lnk_files_pattern(xserver_t, xkb_var_lib_t, xkb_var_lib_t)
files_search_var_lib(xserver_t)
# Create files in /var/log with the xserver_log_t type.
manage_files_pattern(xserver_t, xserver_log_t, xserver_log_t)
logging_log_filetrans(xserver_t, xserver_log_t,file)
kernel_read_system_state(xserver_t)
kernel_read_device_sysctls(xserver_t)
kernel_read_modprobe_sysctls(xserver_t)
# Xorg wants to check if kernel is tainted
kernel_read_kernel_sysctls(xserver_t)
kernel_write_proc_files(xserver_t)
# Run helper programs in xserver_t.
corecmd_exec_bin(xserver_t)
corecmd_exec_shell(xserver_t)
corenet_all_recvfrom_unlabeled(xserver_t)
corenet_all_recvfrom_netlabel(xserver_t)
corenet_tcp_sendrecv_generic_if(xserver_t)
corenet_udp_sendrecv_generic_if(xserver_t)
corenet_tcp_sendrecv_all_nodes(xserver_t)
corenet_udp_sendrecv_all_nodes(xserver_t)
corenet_tcp_sendrecv_all_ports(xserver_t)
corenet_udp_sendrecv_all_ports(xserver_t)
corenet_tcp_bind_all_nodes(xserver_t)
corenet_tcp_bind_xserver_port(xserver_t)
corenet_tcp_connect_all_ports(xserver_t)
corenet_sendrecv_xserver_server_packets(xserver_t)
corenet_sendrecv_all_client_packets(xserver_t)
dev_rw_sysfs(xserver_t)
dev_rw_mouse(xserver_t)
dev_rw_mtrr(xserver_t)
dev_rw_apm_bios(xserver_t)
dev_rw_agp(xserver_t)
dev_rw_framebuffer(xserver_t)
dev_manage_dri_dev(xserver_t)
dev_create_generic_dirs(xserver_t)
dev_setattr_generic_dirs(xserver_t)
# raw memory access is needed if not using the frame buffer
dev_read_raw_memory(xserver_t)
dev_wx_raw_memory(xserver_t)
# for other device nodes such as the NVidia binary-only driver
dev_rw_xserver_misc(xserver_t)
# read events - the synaptics touchpad driver reads raw events
dev_rw_input_dev(xserver_t)
dev_rwx_zero(xserver_t)
domain_mmap_low(xserver_t)
files_read_etc_files(xserver_t)
files_read_etc_runtime_files(xserver_t)
files_read_usr_files(xserver_t)
# brought on by rhgb
files_search_mnt(xserver_t)
# for nscd
files_dontaudit_search_pids(xserver_t)
fs_getattr_xattr_fs(xserver_t)
fs_search_nfs(xserver_t)
fs_search_auto_mountpoints(xserver_t)
fs_search_ramfs(xserver_t)
mls_xwin_read_to_clearance(xserver_t)
selinux_validate_context(xserver_t)
selinux_compute_access_vector(xserver_t)
selinux_compute_create_context(xserver_t)
auth_use_nsswitch(xserver_t)
init_getpgid(xserver_t)
term_setattr_unallocated_ttys(xserver_t)
term_use_unallocated_ttys(xserver_t)
getty_use_fds(xserver_t)
locallogin_use_fds(xserver_t)
logging_send_syslog_msg(xserver_t)
logging_send_audit_msgs(xserver_t)
miscfiles_read_localization(xserver_t)
miscfiles_read_fonts(xserver_t)
modutils_domtrans_insmod(xserver_t)
# read x_contexts
seutil_read_default_contexts(xserver_t)
userdom_search_user_home_dirs(xserver_t)
userdom_use_user_ttys(xserver_t)
userdom_setattr_user_ttys(xserver_t)
userdom_rw_user_tmpfs_files(xserver_t)
xserver_use_user_fonts(xserver_t)
ifndef(`distro_redhat',`
allow xserver_t self:process { execmem execheap execstack };
')
ifdef(`distro_rhel4',`
allow xserver_t self:process { execmem execheap execstack };
')
ifdef(`enable_mls',`
range_transition xserver_t xserver_tmp_t:sock_file s0 - mls_systemhigh;
range_transition xserver_t xserver_t:x_drawable s0 - mls_systemhigh;
')
tunable_policy(`!xserver_object_manager',`
# should be xserver_unconfined(xserver_t),
# but typeattribute doesnt work in conditionals
allow xserver_t xserver_t:x_server *;
allow xserver_t { x_domain rootwindow_t }:x_drawable *;
allow xserver_t xserver_t:x_screen *;
allow xserver_t x_domain:x_gc *;
allow xserver_t { x_domain rootwindow_t }:x_colormap *;
allow xserver_t xproperty_type:x_property *;
allow xserver_t xselection_type:x_selection *;
allow xserver_t x_domain:x_cursor *;
allow xserver_t { x_domain remote_xclient_t }:x_client *;
allow xserver_t { x_domain xserver_t }:x_device *;
allow xserver_t xextension_type:x_extension *;
allow xserver_t { x_domain xserver_t }:x_resource *;
allow xserver_t xevent_type:{ x_event x_synthetic_event } *;
')
optional_policy(`
apm_stream_connect(xserver_t)
')
optional_policy(`
auth_search_pam_console_data(xserver_t)
')
optional_policy(`
rhgb_getpgid(xserver_t)
rhgb_signal(xserver_t)
')
optional_policy(`
unconfined_domain_noaudit(xserver_t)
unconfined_domtrans(xserver_t)
')
optional_policy(`
userhelper_search_config(xserver_t)
')
optional_policy(`
xfs_stream_connect(xserver_t)
')
########################################
#
# XDM Xserver local policy
#
# cjp: when xdm is configurable via tunable these
# rules will be enabled only when xdm is enabled
allow xserver_t xdm_t:process { signal getpgid };
allow xserver_t xdm_t:shm rw_shm_perms;
# NB we do NOT allow xserver_t xdm_var_lib_t:dir, only access to an open
# handle of a file inside the dir!!!
allow xserver_t xdm_var_lib_t:file { getattr read };
dontaudit xserver_t xdm_var_lib_t:dir search;
allow xserver_t xdm_var_run_t:file read_file_perms;
# Label pid and temporary files with derived types.
manage_files_pattern(xserver_t, xdm_tmp_t, xdm_tmp_t)
manage_lnk_files_pattern(xserver_t, xdm_tmp_t, xdm_tmp_t)
manage_sock_files_pattern(xserver_t, xdm_tmp_t, xdm_tmp_t)
# Run xkbcomp.
allow xserver_t xkb_var_lib_t:lnk_file read;
can_exec(xserver_t, xkb_var_lib_t)
# VNC v4 module in X server
corenet_tcp_bind_vnc_port(xserver_t)
init_use_fds(xserver_t)
# FIXME: After per user fonts are properly working
# xserver_t may no longer have any reason
# to read ROLE_home_t - examine this in more detail
# (xauth?)
userdom_read_user_home_content_files(xserver_t)
xserver_use_user_fonts(xserver_t)
tunable_policy(`use_nfs_home_dirs',`
fs_manage_nfs_dirs(xserver_t)
fs_manage_nfs_files(xserver_t)
fs_manage_nfs_symlinks(xserver_t)
')
tunable_policy(`use_samba_home_dirs',`
fs_manage_cifs_dirs(xserver_t)
fs_manage_cifs_files(xserver_t)
fs_manage_cifs_symlinks(xserver_t)
')
optional_policy(`
dbus_system_bus_client(xserver_t)
hal_dbus_chat(xserver_t)
')
optional_policy(`
resmgr_stream_connect(xdm_t)
')
optional_policy(`
rhgb_rw_shm(xserver_t)
rhgb_rw_tmpfs_files(xserver_t)
')
########################################
#
# Rules common to all X window domains
#
# Hacks
# everyone can get the input focus of everyone else
# this is a fundamental brokenness in the X protocol
allow x_domain { x_domain xserver_t }:x_device getfocus;
# everyone can grab the server
# everyone does it, it is basically a free DOS attack
allow x_domain xserver_t:x_server grab;
# everyone can get the font path, etc.
# this could leak out sensitive information
allow x_domain xserver_t:x_server getattr;
# everyone can do override-redirect windows.
# this could be used to spoof labels
allow x_domain self:x_drawable override;
# everyone can receive management events on the root window
# allows to know when new windows appear, among other things
allow x_domain manage_xevent_t:x_event receive;
# X Server
# can read server-owned resources
allow x_domain xserver_t:x_resource read;
# can mess with own clients
allow x_domain self:x_client { manage destroy };
# X Protocol Extensions
allow x_domain std_xext_t:x_extension { query use };
allow x_domain shmem_xext_t:x_extension { query use };
dontaudit x_domain xextension_type:x_extension { query use };
# X Properties
# can read and write cut buffers
allow x_domain clipboard_xproperty_t:x_property { create read write append };
# can read info properties
allow x_domain info_xproperty_t:x_property read;
# can change properties of root window
allow x_domain rootwindow_t:x_drawable { list_property get_property set_property };
# can change properties of own windows
allow x_domain self:x_drawable { list_property get_property set_property };
# X Windows
# operations allowed on root windows
allow x_domain rootwindow_t:x_drawable { getattr list_child add_child remove_child send receive };
# operations allowed on my windows
allow x_domain self:x_drawable { create destroy getattr setattr read write show hide list_child add_child remove_child manage send receive };
# X Colormaps
# can use the default colormap
allow x_domain rootwindow_t:x_colormap { read use add_color };
# X Input
# can receive certain root window events
allow x_domain focus_xevent_t:x_event receive;
allow x_domain property_xevent_t:x_event receive;
allow x_domain client_xevent_t:x_synthetic_event receive;
allow x_domain manage_xevent_t:x_synthetic_event receive;
# can send ICCCM events to the root window
allow x_domain manage_xevent_t:x_synthetic_event send;
allow x_domain client_xevent_t:x_synthetic_event send;
# X Selections
# can use the clipboard
allow x_domain clipboard_xselection_t:x_selection { getattr setattr read };
# can query all other selections
allow x_domain xselection_t:x_selection { getattr read };
# Other X Objects
# can create and use cursors
allow x_domain self:x_cursor *;
# can create and use graphics contexts
allow x_domain self:x_gc *;
# can create and use colormaps
allow x_domain self:x_colormap *;
# can read and write own objects
allow x_domain self:x_resource { read write };
tunable_policy(`! xserver_object_manager',`
# should be xserver_unconfined(x_domain),
# but typeattribute doesnt work in conditionals
allow x_domain xserver_t:x_server *;
allow x_domain { x_domain rootwindow_t }:x_drawable *;
allow x_domain xserver_t:x_screen *;
allow x_domain x_domain:x_gc *;
allow x_domain { x_domain rootwindow_t }:x_colormap *;
allow x_domain xproperty_type:x_property *;
allow x_domain xselection_type:x_selection *;
allow x_domain x_domain:x_cursor *;
allow x_domain { x_domain remote_xclient_t }:x_client *;
allow x_domain { x_domain xserver_t }:x_device *;
allow x_domain xextension_type:x_extension *;
allow x_domain { x_domain xserver_t }:x_resource *;
allow x_domain xevent_type:{ x_event x_synthetic_event } *;
')
########################################
#
# Rules for unconfined access to this module
#
allow xserver_unconfined_type xserver_t:x_server *;
allow xserver_unconfined_type { x_domain rootwindow_t }:x_drawable *;
allow xserver_unconfined_type xserver_t:x_screen *;
allow xserver_unconfined_type x_domain:x_gc *;
allow xserver_unconfined_type { x_domain rootwindow_t }:x_colormap *;
allow xserver_unconfined_type xproperty_type:x_property *;
allow xserver_unconfined_type xselection_type:x_selection *;
allow xserver_unconfined_type x_domain:x_cursor *;
allow xserver_unconfined_type { x_domain remote_xclient_t }:x_client *;
allow xserver_unconfined_type { x_domain xserver_t }:x_device *;
allow xserver_unconfined_type xextension_type:x_extension *;
allow xserver_unconfined_type { x_domain xserver_t }:x_resource *;
allow xserver_unconfined_type xevent_type:{ x_event x_synthetic_event } *;
ifdef(`TODO',`
tunable_policy(`allow_polyinstantiation',`
# xdm needs access for linking .X11-unix to poly /tmp
allow xdm_t polymember:dir { add_name remove_name write };
allow xdm_t polymember:lnk_file { create unlink };
# xdm needs access for copying .Xauthority into new home
allow xdm_t polymember:file { create getattr write };
')
#
# Wants to delete .xsession-errors file
#
allow xdm_t user_home_type:file unlink;
') dnl end TODO
|