summaryrefslogtreecommitdiff
path: root/policy/modules/services/samba.te
blob: 5577c67fb333343c2c411fbd8bbd738cf81a690c (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

policy_module(samba,1.2.8)

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

type nmbd_t;
type nmbd_exec_t;
init_daemon_domain(nmbd_t,nmbd_exec_t)

type nmbd_var_run_t;
files_pid_file(nmbd_var_run_t)

type samba_etc_t;
files_config_file(samba_etc_t)

type samba_log_t;
logging_log_file(samba_log_t)

type samba_net_t;
domain_type(samba_net_t)
role system_r types samba_net_t;

type samba_net_exec_t;
domain_entry_file(samba_net_t,samba_net_exec_t)

type samba_net_tmp_t;
files_tmp_file(samba_net_tmp_t)

type samba_secrets_t;
files_type(samba_secrets_t)

type samba_share_t; # customizable
files_type(samba_share_t)

type samba_var_t;
files_type(samba_var_t)

type smbd_t;
type smbd_exec_t;
init_daemon_domain(smbd_t,smbd_exec_t)

type smbd_tmp_t;
files_tmp_file(smbd_tmp_t)

type smbd_var_run_t;
files_pid_file(smbd_var_run_t)

type smbmount_t;
domain_type(smbmount_t)

type smbmount_exec_t;
domain_entry_file(smbmount_t,smbmount_exec_t)

type swat_t;
type swat_exec_t;
inetd_service_domain(swat_t,swat_exec_t)
role system_r types swat_t;

type swat_tmp_t;
files_tmp_file(swat_tmp_t)

type swat_var_run_t;
files_pid_file(swat_var_run_t)

type winbind_t;
type winbind_exec_t;
init_daemon_domain(winbind_t,winbind_exec_t)

type winbind_helper_t;
domain_type(winbind_helper_t)
role system_r types winbind_helper_t;

type winbind_helper_exec_t;
domain_entry_file(winbind_helper_t,winbind_helper_exec_t)

type winbind_log_t;
logging_log_file(winbind_log_t)

type winbind_tmp_t;
files_tmp_file(winbind_tmp_t)

type winbind_var_run_t;
files_pid_file(winbind_var_run_t)

########################################
#
# Samba net local policy
#

allow samba_net_t self:unix_dgram_socket create_socket_perms;
allow samba_net_t self:unix_stream_socket create_stream_socket_perms;
allow samba_net_t self:udp_socket create_socket_perms;
allow samba_net_t self:tcp_socket create_socket_perms;

allow samba_net_t samba_etc_t:file r_file_perms;

allow samba_net_t samba_secrets_t:file create_file_perms;
allow samba_net_t samba_etc_t:dir rw_dir_perms;
type_transition samba_net_t samba_etc_t:file samba_secrets_t;

allow samba_net_t samba_net_tmp_t:dir create_dir_perms;
allow samba_net_t samba_net_tmp_t:file create_file_perms;
files_tmp_filetrans(samba_net_t, samba_net_tmp_t, { file dir })

allow samba_net_t samba_var_t:dir rw_dir_perms;
allow samba_net_t samba_var_t:lnk_file create_lnk_perms;
allow samba_net_t samba_var_t:file create_file_perms;

kernel_read_proc_symlinks(samba_net_t)

corenet_tcp_sendrecv_all_if(samba_net_t)
corenet_udp_sendrecv_all_if(samba_net_t)
corenet_raw_sendrecv_all_if(samba_net_t)
corenet_tcp_sendrecv_all_nodes(samba_net_t)
corenet_udp_sendrecv_all_nodes(samba_net_t)
corenet_raw_sendrecv_all_nodes(samba_net_t)
corenet_tcp_sendrecv_all_ports(samba_net_t)
corenet_udp_sendrecv_all_ports(samba_net_t)
corenet_non_ipsec_sendrecv(samba_net_t)
corenet_tcp_bind_all_nodes(samba_net_t)
corenet_udp_bind_all_nodes(samba_net_t)
corenet_tcp_connect_smbd_port(samba_net_t)

dev_read_urand(samba_net_t)

domain_use_interactive_fds(samba_net_t)

files_read_etc_files(samba_net_t)

libs_use_ld_so(samba_net_t)
libs_use_shared_libs(samba_net_t)

logging_send_syslog_msg(samba_net_t)

miscfiles_read_localization(samba_net_t) 

sysnet_read_config(samba_net_t)

userdom_dontaudit_search_sysadm_home_dirs(samba_net_t)

ifdef(`targeted_policy',`
	term_use_generic_ptys(samba_net_t)
	term_use_unallocated_ttys(samba_net_t)
')

optional_policy(`
	kerberos_use(samba_net_t)
')

optional_policy(`
	allow samba_net_t self:tcp_socket create_socket_perms;
	corenet_tcp_sendrecv_all_if(samba_net_t)
	corenet_raw_sendrecv_all_if(samba_net_t)
	corenet_tcp_sendrecv_all_nodes(samba_net_t)
	corenet_raw_sendrecv_all_nodes(samba_net_t)
	corenet_tcp_sendrecv_ldap_port(samba_net_t)
	corenet_non_ipsec_sendrecv(samba_net_t)
	corenet_tcp_bind_all_nodes(samba_net_t)
	sysnet_read_config(samba_net_t)
        corenet_tcp_connect_ldap_port(samba_net_t)
')

optional_policy(`
	nscd_socket_use(samba_net_t)
')

########################################
#
# smbd Local policy
#
allow smbd_t self:capability { setgid setuid sys_resource lease dac_override dac_read_search };
dontaudit smbd_t self:capability sys_tty_config;
allow smbd_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
allow smbd_t self:process setrlimit;
allow smbd_t self:fd use;
allow smbd_t self:fifo_file rw_file_perms;
allow smbd_t self:msg { send receive };
allow smbd_t self:msgq create_msgq_perms;
allow smbd_t self:sem create_sem_perms;
allow smbd_t self:shm create_shm_perms;
allow smbd_t self:sock_file r_file_perms;
allow smbd_t self:tcp_socket create_stream_socket_perms;
allow smbd_t self:udp_socket create_socket_perms;
allow smbd_t self:unix_dgram_socket { create_socket_perms sendto };
allow smbd_t self:unix_stream_socket { create_stream_socket_perms connectto };

allow smbd_t samba_etc_t:dir rw_dir_perms;
allow smbd_t samba_etc_t:file { rw_file_perms setattr };

allow smbd_t samba_log_t:dir ra_dir_perms;
dontaudit smbd_t samba_log_t:dir remove_name;
allow smbd_t samba_log_t:file { create ra_file_perms };

allow smbd_t samba_net_tmp_t:file getattr;

allow smbd_t samba_secrets_t:dir rw_dir_perms;
allow smbd_t samba_secrets_t:file create_file_perms;
type_transition smbd_t samba_etc_t:file samba_secrets_t;

allow smbd_t samba_share_t:dir create_dir_perms;
allow smbd_t samba_share_t:file create_file_perms;
allow smbd_t samba_share_t:lnk_file create_lnk_perms;

allow smbd_t samba_var_t:dir create_dir_perms;
allow smbd_t samba_var_t:file create_file_perms;
allow smbd_t samba_var_t:lnk_file create_lnk_perms;
allow smbd_t samba_var_t:sock_file create_file_perms;

allow smbd_t smbd_tmp_t:dir create_dir_perms;
allow smbd_t smbd_tmp_t:file create_file_perms;
files_tmp_filetrans(smbd_t, smbd_tmp_t, { file dir })

allow smbd_t nmbd_var_run_t:file rw_file_perms;

allow smbd_t smbd_var_run_t:dir create_dir_perms;
allow smbd_t smbd_var_run_t:file create_file_perms;
allow smbd_t smbd_var_run_t:sock_file create_file_perms;
files_pid_filetrans(smbd_t,smbd_var_run_t,file)

allow smbd_t winbind_var_run_t:sock_file { read write getattr };

kernel_getattr_core_if(smbd_t)
kernel_getattr_message_if(smbd_t)
kernel_read_network_state(smbd_t)
kernel_read_fs_sysctls(smbd_t)
kernel_read_kernel_sysctls(smbd_t)
kernel_read_software_raid_state(smbd_t)
kernel_read_system_state(smbd_t)

corenet_tcp_sendrecv_all_if(smbd_t)
corenet_udp_sendrecv_all_if(smbd_t)
corenet_raw_sendrecv_all_if(smbd_t)
corenet_tcp_sendrecv_all_nodes(smbd_t)
corenet_udp_sendrecv_all_nodes(smbd_t)
corenet_raw_sendrecv_all_nodes(smbd_t)
corenet_tcp_sendrecv_all_ports(smbd_t)
corenet_udp_sendrecv_all_ports(smbd_t)
corenet_non_ipsec_sendrecv(smbd_t)
corenet_tcp_bind_all_nodes(smbd_t)
corenet_udp_bind_all_nodes(smbd_t)
corenet_tcp_bind_smbd_port(smbd_t)
corenet_tcp_connect_ipp_port(smbd_t)
corenet_tcp_connect_smbd_port(smbd_t)

dev_read_sysfs(smbd_t)
dev_read_urand(smbd_t)
dev_getattr_mtrr_dev(smbd_t)
dev_dontaudit_getattr_usbfs_dirs(smbd_t)

fs_getattr_all_fs(smbd_t)
fs_get_xattr_fs_quotas(smbd_t)
fs_search_auto_mountpoints(smbd_t)
fs_getattr_rpc_dirs(smbd_t)

term_dontaudit_use_console(smbd_t)

auth_use_nsswitch(smbd_t)
auth_domtrans_chk_passwd(smbd_t)

domain_use_interactive_fds(smbd_t)

files_list_var_lib(smbd_t)
files_read_etc_files(smbd_t)
files_read_etc_runtime_files(smbd_t)
files_read_usr_files(smbd_t)
files_search_spool(smbd_t)
# Allow samba to list mnt_t for potential mounted dirs
files_list_mnt(smbd_t)

init_use_fds(smbd_t)
init_use_script_ptys(smbd_t)
init_rw_utmp(smbd_t)

libs_use_ld_so(smbd_t)
libs_use_shared_libs(smbd_t)

logging_search_logs(smbd_t)
logging_send_syslog_msg(smbd_t)

miscfiles_read_localization(smbd_t)
miscfiles_read_public_files(smbd_t)

sysnet_read_config(smbd_t)

userdom_dontaudit_search_sysadm_home_dirs(smbd_t)
userdom_dontaudit_use_unpriv_user_fds(smbd_t)
userdom_use_unpriv_users_fds(smbd_t)

ifdef(`hide_broken_symptoms', `
	files_dontaudit_getattr_default_dirs(smbd_t)
	files_dontaudit_getattr_boot_dirs(smbd_t)
	fs_dontaudit_getattr_tmpfs_dirs(smbd_t)
')

ifdef(`targeted_policy', `
	files_dontaudit_read_root_files(smbd_t)
	term_dontaudit_use_generic_ptys(smbd_t)
	term_dontaudit_use_unallocated_ttys(smbd_t)
')

tunable_policy(`allow_smbd_anon_write',`
	miscfiles_manage_public_files(smbd_t)
') 

# Support Samba sharing of NFS mount points
tunable_policy(`samba_share_nfs',`
	fs_manage_nfs_dirs(smbd_t)
	fs_manage_nfs_files(smbd_t)
')

optional_policy(`
	cups_read_rw_config(smbd_t)
')

optional_policy(`
	kerberos_use(smbd_t)
')

optional_policy(`
	nis_use_ypbind(smbd_t)
')

optional_policy(`
	nscd_socket_use(smbd_t)
')

optional_policy(`
	rpc_search_nfs_state_data(smbd_t)
')

optional_policy(`
	seutil_sigchld_newrole(smbd_t)
')

optional_policy(`
	udev_read_db(smbd_t)
')

########################################
#
# nmbd Local policy
#

dontaudit nmbd_t self:capability sys_tty_config;
allow nmbd_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
allow nmbd_t self:fd use;
allow nmbd_t self:fifo_file rw_file_perms;
allow nmbd_t self:msg { send receive };
allow nmbd_t self:msgq create_msgq_perms;
allow nmbd_t self:sem create_sem_perms;
allow nmbd_t self:shm create_shm_perms;
allow nmbd_t self:sock_file r_file_perms;
allow nmbd_t self:tcp_socket create_stream_socket_perms;
allow nmbd_t self:udp_socket create_socket_perms;
allow nmbd_t self:unix_dgram_socket { create_socket_perms sendto };
allow nmbd_t self:unix_stream_socket { create_stream_socket_perms connectto };

allow nmbd_t nmbd_var_run_t:file create_file_perms;
allow nmbd_t nmbd_var_run_t:dir rw_dir_perms;
files_pid_filetrans(nmbd_t,nmbd_var_run_t,file)

allow nmbd_t samba_etc_t:dir { search getattr };
allow nmbd_t samba_etc_t:file { getattr read };

allow nmbd_t samba_log_t:dir ra_dir_perms;
allow nmbd_t samba_log_t:file { create ra_file_perms };

allow nmbd_t samba_var_t:dir rw_dir_perms;
allow nmbd_t samba_var_t:file { lock unlink create write setattr read getattr rename };

allow nmbd_t smbd_var_run_t:dir rw_dir_perms;

kernel_getattr_core_if(nmbd_t)
kernel_getattr_message_if(nmbd_t)
kernel_read_kernel_sysctls(nmbd_t)
kernel_read_network_state(nmbd_t)
kernel_read_software_raid_state(nmbd_t)
kernel_read_system_state(nmbd_t)

corenet_non_ipsec_sendrecv(nmbd_t)
corenet_tcp_sendrecv_all_if(nmbd_t)
corenet_udp_sendrecv_all_if(nmbd_t)
corenet_tcp_sendrecv_all_nodes(nmbd_t)
corenet_udp_sendrecv_all_nodes(nmbd_t)
corenet_tcp_sendrecv_all_ports(nmbd_t)
corenet_udp_sendrecv_all_ports(nmbd_t)
corenet_udp_bind_all_nodes(nmbd_t)
corenet_udp_bind_nmbd_port(nmbd_t)
corenet_sendrecv_nmbd_server_packets(nmbd_t)
corenet_sendrecv_nmbd_client_packets(nmbd_t)

dev_read_sysfs(nmbd_t)
dev_getattr_mtrr_dev(nmbd_t)

fs_getattr_all_fs(nmbd_t)
fs_search_auto_mountpoints(nmbd_t)

term_dontaudit_use_console(nmbd_t)

domain_use_interactive_fds(nmbd_t)

files_read_usr_files(nmbd_t)
files_read_etc_files(nmbd_t)

init_use_fds(nmbd_t)
init_use_script_ptys(nmbd_t)

libs_use_ld_so(nmbd_t)
libs_use_shared_libs(nmbd_t)

logging_search_logs(nmbd_t)
logging_send_syslog_msg(nmbd_t)

miscfiles_read_localization(nmbd_t)

sysnet_read_config(nmbd_t)

userdom_dontaudit_search_sysadm_home_dirs(nmbd_t)
userdom_dontaudit_use_unpriv_user_fds(nmbd_t)
userdom_use_unpriv_users_fds(nmbd_t)

ifdef(`targeted_policy', `
	files_dontaudit_read_root_files(nmbd_t)
	term_dontaudit_use_generic_ptys(nmbd_t)
	term_dontaudit_use_unallocated_ttys(nmbd_t)
')

optional_policy(`
	nis_use_ypbind(nmbd_t)
')

optional_policy(`
	seutil_sigchld_newrole(nmbd_t)
')

optional_policy(`
	udev_read_db(nmbd_t)
')

########################################
#
# smbmount Local policy
#

allow smbmount_t self:capability { sys_rawio sys_admin dac_override chown }; # FIXME: is all of this really necessary?
allow smbmount_t self:process { fork signal_perms };
allow smbmount_t self:tcp_socket create_stream_socket_perms;
allow smbmount_t self:udp_socket connect;
allow smbmount_t self:unix_dgram_socket create_socket_perms;
allow smbmount_t self:unix_stream_socket create_socket_perms;

allow smbmount_t samba_etc_t:dir r_dir_perms;
allow smbmount_t samba_etc_t:file r_file_perms;

can_exec(smbmount_t, smbmount_exec_t)

allow smbmount_t samba_log_t:dir r_dir_perms; 
allow smbmount_t samba_log_t:file create_file_perms;

allow smbmount_t samba_secrets_t:file create_file_perms;

allow smbmount_t samba_var_t:dir rw_dir_perms;
allow smbmount_t samba_var_t:file create_file_perms;
allow smbmount_t samba_var_t:lnk_file create_lnk_perms;

kernel_read_system_state(smbmount_t)

corenet_tcp_sendrecv_all_if(smbmount_t)
corenet_raw_sendrecv_all_if(smbmount_t)
corenet_udp_sendrecv_all_if(smbmount_t)
corenet_tcp_sendrecv_all_nodes(smbmount_t)
corenet_raw_sendrecv_all_nodes(smbmount_t)
corenet_udp_sendrecv_all_nodes(smbmount_t)
corenet_tcp_sendrecv_all_ports(smbmount_t)
corenet_udp_sendrecv_all_ports(smbmount_t)
corenet_non_ipsec_sendrecv(smbmount_t)
corenet_tcp_bind_all_nodes(smbmount_t)
corenet_udp_bind_all_nodes(smbmount_t)
corenet_tcp_connect_all_ports(smbmount_t)

fs_getattr_cifs(smbmount_t)
fs_mount_cifs(smbmount_t)
fs_remount_cifs(smbmount_t)
fs_unmount_cifs(smbmount_t)
fs_list_cifs(smbmount_t)
fs_read_cifs_files(smbmount_t)

storage_raw_read_fixed_disk(smbmount_t)
storage_raw_write_fixed_disk(smbmount_t)

term_list_ptys(smbmount_t)
term_use_controlling_term(smbmount_t)

corecmd_list_bin(smbmount_t)

files_list_mnt(smbmount_t)
files_mounton_mnt(smbmount_t)
files_manage_etc_runtime_files(smbmount_t)
files_etc_filetrans_etc_runtime(smbmount_t,file)
files_read_etc_files(smbmount_t)

miscfiles_read_localization(smbmount_t)

mount_use_fds(smbmount_t)

libs_use_ld_so(smbmount_t)
libs_use_shared_libs(smbmount_t)

locallogin_use_fds(smbmount_t)

logging_search_logs(smbmount_t)

sysnet_read_config(smbmount_t)

userdom_use_all_users_fds(smbmount_t)
userdom_use_sysadm_ttys(smbmount_t)

optional_policy(`
	cups_read_rw_config(smbd_t)
')

optional_policy(`
	nis_use_ypbind(smbmount_t)
')

optional_policy(`
	nscd_socket_use(smbmount_t)
')

########################################
#
# SWAT Local policy
#

allow swat_t self:capability { setuid setgid };
allow swat_t self:process signal_perms;
allow swat_t self:fifo_file rw_file_perms;
allow swat_t self:netlink_tcpdiag_socket r_netlink_socket_perms;
allow swat_t self:netlink_audit_socket create;
allow swat_t self:tcp_socket create_stream_socket_perms;
allow swat_t self:udp_socket create_socket_perms;


allow swat_t nmbd_exec_t:file { execute read };

allow swat_t samba_etc_t:dir search;
allow swat_t samba_etc_t:file { getattr write read };

allow swat_t samba_log_t:dir search;
allow swat_t samba_log_t:file append;

allow swat_t smbd_exec_t:file execute ;

allow swat_t smbd_t:process signull;

allow swat_t smbd_var_run_t:file read;

allow swat_t swat_tmp_t:dir create_dir_perms;
allow swat_t swat_tmp_t:file create_file_perms;
files_tmp_filetrans(swat_t, swat_tmp_t, { file dir })

allow swat_t swat_var_run_t:file create_file_perms;
allow swat_t swat_var_run_t:dir rw_dir_perms;
files_pid_filetrans(swat_t,swat_var_run_t,file)

allow swat_t winbind_exec_t:file execute;

kernel_read_kernel_sysctls(swat_t)
kernel_read_system_state(swat_t)
kernel_read_network_state(swat_t)

corecmd_search_sbin(swat_t)

corenet_non_ipsec_sendrecv(swat_t)
corenet_tcp_sendrecv_generic_if(swat_t)
corenet_udp_sendrecv_generic_if(swat_t)
corenet_raw_sendrecv_generic_if(swat_t)
corenet_tcp_sendrecv_all_nodes(swat_t)
corenet_udp_sendrecv_all_nodes(swat_t)
corenet_raw_sendrecv_all_nodes(swat_t)
corenet_tcp_sendrecv_all_ports(swat_t)
corenet_udp_sendrecv_all_ports(swat_t)
corenet_tcp_bind_all_nodes(swat_t)
corenet_udp_bind_all_nodes(swat_t)
corenet_tcp_connect_smbd_port(swat_t)

dev_read_urand(swat_t)

files_read_etc_files(swat_t)
files_search_home(swat_t)
files_read_usr_files(swat_t)
fs_getattr_xattr_fs(swat_t)

auth_domtrans_chk_passwd(swat_t)

libs_use_ld_so(swat_t)
libs_use_shared_libs(swat_t)

logging_send_syslog_msg(swat_t)
logging_search_logs(swat_t)

miscfiles_read_localization(swat_t)

sysnet_read_config(swat_t)

optional_policy(`
	cups_read_rw_config(swat_t)
')

optional_policy(`
	kerberos_use(swat_t)
')

optional_policy(`
	nis_use_ypbind(swat_t)
')

optional_policy(`
	nscd_socket_use(swat_t)
')

########################################
#
# Winbind local policy
#

dontaudit winbind_t self:capability sys_tty_config;
allow winbind_t self:process signal_perms;
allow winbind_t self:fifo_file { read write };
allow winbind_t self:unix_dgram_socket create_socket_perms;
allow winbind_t self:unix_stream_socket create_stream_socket_perms;
allow winbind_t self:netlink_route_socket r_netlink_socket_perms;
allow winbind_t self:tcp_socket create_stream_socket_perms;
allow winbind_t self:udp_socket create_socket_perms;

allow winbind_t samba_etc_t:dir r_dir_perms;
allow winbind_t samba_etc_t:lnk_file { getattr read };
allow winbind_t samba_etc_t:file r_file_perms;

allow winbind_t samba_secrets_t:file create_file_perms;
allow winbind_t samba_etc_t:dir rw_dir_perms;
type_transition winbind_t samba_etc_t:file samba_secrets_t;

allow winbind_t samba_log_t:dir rw_dir_perms;
allow winbind_t samba_log_t:file create_file_perms;
allow winbind_t samba_log_t:lnk_file create_lnk_perms;

allow winbind_t samba_var_t:dir rw_dir_perms;
allow winbind_t samba_var_t:file create_file_perms;
allow winbind_t samba_var_t:lnk_file create_lnk_perms;

allow winbind_t winbind_log_t:file create_file_perms;
logging_log_filetrans(winbind_t,winbind_log_t,file)

allow winbind_t winbind_tmp_t:dir create_dir_perms;
allow winbind_t winbind_tmp_t:file create_file_perms;
files_tmp_filetrans(winbind_t, winbind_tmp_t, { file dir })

allow winbind_t winbind_var_run_t:file create_file_perms;
allow winbind_t winbind_var_run_t:sock_file create_file_perms;
allow winbind_t winbind_var_run_t:dir rw_dir_perms;
files_pid_filetrans(winbind_t,winbind_var_run_t,file)

kernel_read_kernel_sysctls(winbind_t)
kernel_list_proc(winbind_t)
kernel_read_proc_symlinks(winbind_t)

corenet_tcp_sendrecv_all_if(winbind_t)
corenet_udp_sendrecv_all_if(winbind_t)
corenet_raw_sendrecv_all_if(winbind_t)
corenet_tcp_sendrecv_all_nodes(winbind_t)
corenet_udp_sendrecv_all_nodes(winbind_t)
corenet_raw_sendrecv_all_nodes(winbind_t)
corenet_tcp_sendrecv_all_ports(winbind_t)
corenet_udp_sendrecv_all_ports(winbind_t)
corenet_non_ipsec_sendrecv(winbind_t)
corenet_tcp_bind_all_nodes(winbind_t)
corenet_udp_bind_all_nodes(winbind_t)
corenet_tcp_connect_smbd_port(winbind_t)

dev_read_sysfs(winbind_t)
dev_read_urand(winbind_t)

fs_getattr_all_fs(winbind_t)
fs_search_auto_mountpoints(winbind_t)

term_dontaudit_use_console(winbind_t)

auth_domtrans_chk_passwd(winbind_t)

domain_use_interactive_fds(winbind_t)

files_read_etc_files(winbind_t)

init_use_fds(winbind_t)
init_use_script_ptys(winbind_t)

libs_use_ld_so(winbind_t)
libs_use_shared_libs(winbind_t)

logging_send_syslog_msg(winbind_t)

miscfiles_read_localization(winbind_t)

sysnet_read_config(winbind_t)
sysnet_dns_name_resolve(winbind_t)

userdom_dontaudit_use_unpriv_user_fds(winbind_t)
userdom_dontaudit_search_sysadm_home_dirs(winbind_t)
userdom_priveleged_home_dir_manager(winbind_t)

ifdef(`targeted_policy', `
	term_dontaudit_use_unallocated_ttys(winbind_t)
	term_dontaudit_use_generic_ptys(winbind_t)
	files_dontaudit_read_root_files(winbind_t)
')

optional_policy(`
	kerberos_use(winbind_t)
')

optional_policy(`
	nscd_socket_use(winbind_t)
')

optional_policy(`
	seutil_sigchld_newrole(winbind_t)
')

optional_policy(`
	udev_read_db(winbind_t)
')

########################################
#
# Winbind helper local policy
#

allow winbind_helper_t self:unix_dgram_socket create_socket_perms;
allow winbind_helper_t self:unix_stream_socket create_stream_socket_perms;

allow winbind_helper_t samba_etc_t:dir r_dir_perms;
allow winbind_helper_t samba_etc_t:lnk_file { getattr read };
allow winbind_helper_t samba_etc_t:file r_file_perms;

allow winbind_helper_t samba_var_t:dir search;

allow winbind_helper_t winbind_var_run_t:dir r_dir_perms;
allow winbind_helper_t winbind_var_run_t:sock_file { getattr read write };
allow winbind_helper_t winbind_t:unix_stream_socket connectto;

term_list_ptys(winbind_helper_t)

domain_use_interactive_fds(winbind_helper_t)

libs_use_ld_so(winbind_helper_t)
libs_use_shared_libs(winbind_helper_t)

logging_send_syslog_msg(winbind_helper_t)

miscfiles_read_localization(winbind_helper_t) 

ifdef(`targeted_policy',`
	term_use_generic_ptys(winbind_helper_t)
	term_use_unallocated_ttys(winbind_helper_t)
')

optional_policy(`
	nscd_socket_use(winbind_helper_t)
')

optional_policy(`
	squid_read_log(winbind_helper_t)
	squid_append_log(winbind_helper_t)
')