Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / selinux / ceph.te
1 policy_module(ceph, 1.1.1)
2
3 require {
4         type sysfs_t;
5         type var_run_t;
6         type random_device_t;
7         type urandom_device_t;
8         type setfiles_t;
9         type nvme_device_t;
10         class sock_file unlink;
11         class lnk_file read;
12         class dir read;
13         class file { getattr read open };
14         class blk_file { getattr ioctl open read write };
15 }
16
17 ########################################
18 #
19 # Declarations
20 #
21
22 type ceph_t;
23 type ceph_exec_t;
24 init_daemon_domain(ceph_t, ceph_exec_t)
25
26 permissive ceph_t;
27
28 type ceph_initrc_exec_t;
29 init_script_file(ceph_initrc_exec_t)
30
31 type ceph_log_t;
32 logging_log_file(ceph_log_t)
33
34 type ceph_var_lib_t;
35 files_type(ceph_var_lib_t)
36
37 type ceph_var_run_t;
38 files_pid_file(ceph_var_run_t)
39
40 ########################################
41 #
42 # ceph local policy
43 #
44
45 allow ceph_t self:process { signal_perms };
46 allow ceph_t self:fifo_file rw_fifo_file_perms;
47 allow ceph_t self:unix_stream_socket create_stream_socket_perms;
48 allow ceph_t self:capability { setuid setgid dac_override };
49
50 manage_dirs_pattern(ceph_t, ceph_log_t, ceph_log_t)
51 manage_files_pattern(ceph_t, ceph_log_t, ceph_log_t)
52 manage_lnk_files_pattern(ceph_t, ceph_log_t, ceph_log_t)
53
54 manage_dirs_pattern(ceph_t, ceph_var_lib_t, ceph_var_lib_t)
55 manage_files_pattern(ceph_t, ceph_var_lib_t, ceph_var_lib_t)
56 manage_lnk_files_pattern(ceph_t, ceph_var_lib_t, ceph_var_lib_t)
57
58 manage_dirs_pattern(ceph_t, ceph_var_run_t, ceph_var_run_t)
59 manage_files_pattern(ceph_t, ceph_var_run_t, ceph_var_run_t)
60 manage_lnk_files_pattern(ceph_t, ceph_var_run_t, ceph_var_run_t)
61
62 kernel_read_system_state(ceph_t)
63 kernel_read_network_state(ceph_t)
64
65 corenet_all_recvfrom_unlabeled(ceph_t)
66 corenet_all_recvfrom_netlabel(ceph_t)
67 corenet_udp_sendrecv_generic_if(ceph_t)
68 corenet_udp_sendrecv_generic_node(ceph_t)
69 corenet_udp_bind_generic_node(ceph_t)
70 corenet_tcp_bind_generic_node(ceph_t)
71
72 corenet_sendrecv_cyphesis_server_packets(ceph_t)
73 corenet_tcp_bind_cyphesis_port(ceph_t)
74 corenet_tcp_sendrecv_cyphesis_port(ceph_t)
75
76 corecmd_exec_bin(ceph_t)
77 corecmd_exec_shell(ceph_t)
78
79 dev_read_urand(ceph_t)
80
81 domain_read_all_domains_state(ceph_t)
82
83 fs_getattr_all_fs(ceph_t)
84
85 auth_use_nsswitch(ceph_t)
86
87 logging_send_syslog_msg(ceph_t)
88
89 sysnet_dns_name_resolve(ceph_t)
90
91 allow ceph_t nvme_device_t:blk_file { getattr ioctl open read write };
92
93 # basis for future security review
94 allow ceph_t ceph_var_run_t:sock_file { create unlink write setattr };
95 allow ceph_t self:capability { sys_rawio chown };
96
97 allow ceph_t self:tcp_socket { accept listen };
98 corenet_tcp_connect_cyphesis_port(ceph_t)
99 corenet_tcp_connect_generic_port(ceph_t)
100 files_list_tmp(ceph_t)
101 files_manage_generic_tmp_files(ceph_t)
102 fstools_exec(ceph_t)
103 nis_use_ypbind_uncond(ceph_t)
104 storage_raw_rw_fixed_disk(ceph_t)
105 files_manage_generic_locks(ceph_t)
106
107 allow ceph_t sysfs_t:dir read;
108 allow ceph_t sysfs_t:file { read getattr open };
109 allow ceph_t sysfs_t:lnk_file { read getattr };
110
111 allow ceph_t random_device_t:chr_file getattr;
112 allow ceph_t urandom_device_t:chr_file getattr;
113 allow ceph_t self:process setpgid;
114 allow ceph_t var_run_t:dir { write create add_name };
115 allow ceph_t var_run_t:file { read write create open getattr };
116
117 fsadm_manage_pid(ceph_t)
118
119 #============= setfiles_t ==============
120 allow setfiles_t ceph_var_lib_t:file write;