aboutsummaryrefslogtreecommitdiff
blob: 68b8d99ce5f985c5772839d2dcd53619b476eff2 (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
policy_module(zabbix, 1.11.0)

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

## <desc>
##	<p>
##	Determine whether zabbix can
##	connect to all TCP ports
##	</p>
## </desc>
gen_tunable(zabbix_can_network, false)

type zabbix_t;
type zabbix_exec_t;
init_daemon_domain(zabbix_t, zabbix_exec_t)

type zabbix_initrc_exec_t;
init_script_file(zabbix_initrc_exec_t)

type zabbix_agent_t;
type zabbix_agent_exec_t;
init_daemon_domain(zabbix_agent_t, zabbix_agent_exec_t)

type zabbix_agent_initrc_exec_t;
init_script_file(zabbix_agent_initrc_exec_t)

type zabbix_log_t;
logging_log_file(zabbix_log_t)

type zabbix_tmp_t;
files_tmp_file(zabbix_tmp_t)

type zabbix_tmpfs_t;
files_tmpfs_file(zabbix_tmpfs_t)

type zabbix_var_run_t;
files_pid_file(zabbix_var_run_t)

########################################
#
# Local policy
#

allow zabbix_t self:capability { dac_override dac_read_search setgid setuid };
allow zabbix_t self:process { setsched signal_perms };
allow zabbix_t self:fifo_file rw_fifo_file_perms;
allow zabbix_t self:unix_stream_socket create_stream_socket_perms;
allow zabbix_t self:sem create_sem_perms;
allow zabbix_t self:shm create_shm_perms;
allow zabbix_t self:tcp_socket create_stream_socket_perms;

allow zabbix_t zabbix_log_t:dir setattr_dir_perms;
append_files_pattern(zabbix_t, zabbix_log_t, zabbix_log_t)
create_files_pattern(zabbix_t, zabbix_log_t, zabbix_log_t)
setattr_files_pattern(zabbix_t, zabbix_log_t, zabbix_log_t)
logging_log_filetrans(zabbix_t, zabbix_log_t, file)

manage_dirs_pattern(zabbix_t, zabbix_tmp_t, zabbix_tmp_t)
manage_files_pattern(zabbix_t, zabbix_tmp_t, zabbix_tmp_t)
files_tmp_filetrans(zabbix_t, zabbix_tmp_t, { dir file })

rw_files_pattern(zabbix_t, zabbix_tmpfs_t, zabbix_tmpfs_t)
fs_tmpfs_filetrans(zabbix_t, zabbix_tmpfs_t, file)

manage_dirs_pattern(zabbix_t, zabbix_var_run_t, zabbix_var_run_t)
manage_files_pattern(zabbix_t, zabbix_var_run_t, zabbix_var_run_t)
files_pid_filetrans(zabbix_t, zabbix_var_run_t, { dir file })

kernel_read_system_state(zabbix_t)
kernel_read_kernel_sysctls(zabbix_t)

corenet_all_recvfrom_unlabeled(zabbix_t)
corenet_all_recvfrom_netlabel(zabbix_t)
corenet_tcp_sendrecv_generic_if(zabbix_t)
corenet_tcp_sendrecv_generic_node(zabbix_t)
corenet_tcp_bind_generic_node(zabbix_t)

corenet_sendrecv_ftp_client_packets(zabbix_t)
corenet_tcp_connect_ftp_port(zabbix_t)
corenet_tcp_sendrecv_ftp_port(zabbix_t)

corenet_sendrecv_http_client_packets(zabbix_t)
corenet_tcp_connect_http_port(zabbix_t)
corenet_tcp_sendrecv_http_port(zabbix_t)

corenet_sendrecv_zabbix_server_packets(zabbix_t)
corenet_tcp_bind_zabbix_port(zabbix_t)
corenet_tcp_sendrecv_zabbix_port(zabbix_t)

corecmd_exec_bin(zabbix_t)
corecmd_exec_shell(zabbix_t)

dev_read_urand(zabbix_t)

files_read_usr_files(zabbix_t)

auth_use_nsswitch(zabbix_t)

miscfiles_read_localization(zabbix_t)

zabbix_agent_tcp_connect(zabbix_t)

tunable_policy(`zabbix_can_network',`
	corenet_sendrecv_all_client_packets(zabbix_t)
	corenet_tcp_connect_all_ports(zabbix_t)
	corenet_tcp_sendrecv_all_ports(zabbix_t)
')

optional_policy(`
	netutils_domtrans_ping(zabbix_t)
')

optional_policy(`
	mysql_stream_connect(zabbix_t)
	mysql_tcp_connect(zabbix_t)
')

optional_policy(`
	postgresql_stream_connect(zabbix_t)
	postgresql_tcp_connect(zabbix_t)
')

optional_policy(`
	snmp_read_snmp_var_lib_files(zabbix_t)
')

########################################
#
# Agent local policy
#

allow zabbix_agent_t self:capability { setgid setuid };
allow zabbix_agent_t self:process { setsched getsched signal setrlimit };
allow zabbix_agent_t self:fifo_file rw_fifo_file_perms;
allow zabbix_agent_t self:sem create_sem_perms;
allow zabbix_agent_t self:shm create_shm_perms;
allow zabbix_agent_t self:tcp_socket { accept listen };
allow zabbix_agent_t self:unix_stream_socket create_stream_socket_perms;

append_files_pattern(zabbix_agent_t, zabbix_log_t, zabbix_log_t)
create_files_pattern(zabbix_agent_t, zabbix_log_t, zabbix_log_t)
setattr_files_pattern(zabbix_agent_t, zabbix_log_t, zabbix_log_t)
filetrans_pattern(zabbix_agent_t, zabbix_log_t, zabbix_log_t, file)

rw_files_pattern(zabbix_agent_t, zabbix_tmpfs_t, zabbix_tmpfs_t)
fs_tmpfs_filetrans(zabbix_agent_t, zabbix_tmpfs_t, file)

manage_files_pattern(zabbix_agent_t, zabbix_var_run_t, zabbix_var_run_t)
files_pid_filetrans(zabbix_agent_t, zabbix_var_run_t, file)

kernel_read_all_sysctls(zabbix_agent_t)
kernel_read_system_state(zabbix_agent_t)

corecmd_read_all_executables(zabbix_agent_t)

corenet_all_recvfrom_unlabeled(zabbix_agent_t)
corenet_all_recvfrom_netlabel(zabbix_agent_t)
corenet_tcp_sendrecv_generic_if(zabbix_agent_t)
corenet_tcp_sendrecv_generic_node(zabbix_agent_t)
corenet_tcp_bind_generic_node(zabbix_agent_t)

corenet_sendrecv_zabbix_agent_server_packets(zabbix_agent_t)
corenet_tcp_bind_zabbix_agent_port(zabbix_agent_t)
corenet_tcp_sendrecv_zabbix_agent_port(zabbix_agent_t)

corenet_sendrecv_ssh_client_packets(zabbix_agent_t)
corenet_tcp_connect_ssh_port(zabbix_agent_t)
corenet_tcp_sendrecv_ssh_port(zabbix_agent_t)

corenet_sendrecv_zabbix_client_packets(zabbix_agent_t)
corenet_tcp_connect_zabbix_port(zabbix_agent_t)
corenet_tcp_sendrecv_zabbix_port(zabbix_agent_t)

dev_getattr_all_blk_files(zabbix_agent_t)
dev_getattr_all_chr_files(zabbix_agent_t)

domain_read_all_domains_state(zabbix_agent_t)

files_getattr_all_dirs(zabbix_agent_t)
files_getattr_all_files(zabbix_agent_t)
files_read_all_symlinks(zabbix_agent_t)
files_read_etc_files(zabbix_agent_t)

fs_getattr_all_fs(zabbix_agent_t)

init_read_utmp(zabbix_agent_t)

logging_search_logs(zabbix_agent_t)

miscfiles_read_localization(zabbix_agent_t)

sysnet_dns_name_resolve(zabbix_agent_t)

zabbix_tcp_connect(zabbix_agent_t)