The zabbix agent has its own dedicated port (10050) on which it needs to bind/listen. Also, the agent connects to the server so we add the zabbix_tcp_connect interface (shamelessly copied from mysql_tcp_connect) and use it for the zabbix_agent_t domain. Update: structure interface calls more closely to styleguide Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
114 lines
3.0 KiB
Plaintext
114 lines
3.0 KiB
Plaintext
policy_module(zabbix, 1.3.0)
|
|
|
|
########################################
|
|
#
|
|
# Declarations
|
|
#
|
|
|
|
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)
|
|
|
|
# agent definition
|
|
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)
|
|
|
|
# log files
|
|
type zabbix_log_t;
|
|
logging_log_file(zabbix_log_t)
|
|
|
|
# shared memory
|
|
type zabbix_tmpfs_t;
|
|
files_tmpfs_file(zabbix_tmpfs_t);
|
|
|
|
# pid files
|
|
type zabbix_var_run_t;
|
|
files_pid_file(zabbix_var_run_t)
|
|
|
|
########################################
|
|
#
|
|
# zabbix local policy
|
|
#
|
|
|
|
allow zabbix_t self:capability { setuid setgid };
|
|
allow zabbix_t self:fifo_file rw_file_perms;
|
|
allow zabbix_t self:process { setsched getsched signal };
|
|
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;
|
|
|
|
# log files
|
|
allow zabbix_t zabbix_log_t:dir setattr;
|
|
manage_files_pattern(zabbix_t, zabbix_log_t, zabbix_log_t)
|
|
logging_log_filetrans(zabbix_t, zabbix_log_t, file)
|
|
|
|
# pid 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 })
|
|
|
|
# shared memory
|
|
rw_files_pattern(zabbix_t, zabbix_tmpfs_t, zabbix_tmpfs_t)
|
|
fs_tmpfs_filetrans(zabbix_t, zabbix_tmpfs_t, file)
|
|
|
|
files_read_etc_files(zabbix_t)
|
|
|
|
corenet_tcp_bind_generic_node(zabbix_t)
|
|
corenet_tcp_bind_zabbix_port(zabbix_t)
|
|
|
|
miscfiles_read_localization(zabbix_t)
|
|
|
|
optional_policy(`
|
|
mysql_stream_connect(zabbix_t)
|
|
')
|
|
|
|
optional_policy(`
|
|
postgresql_stream_connect(zabbix_t)
|
|
')
|
|
|
|
########################################
|
|
#
|
|
# zabbix agent local policy
|
|
#
|
|
|
|
allow zabbix_agent_t self:capability { setuid setgid };
|
|
allow zabbix_agent_t self:process { setsched getsched signal };
|
|
allow zabbix_agent_t self:fifo_file rw_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 create_stream_socket_perms;
|
|
allow zabbix_agent_t self:unix_stream_socket create_stream_socket_perms;
|
|
|
|
## Rules related to the types managed by this policy file
|
|
|
|
# Logging access
|
|
filetrans_pattern(zabbix_agent_t, zabbix_log_t, zabbix_log_t, file)
|
|
manage_files_pattern(zabbix_agent_t, zabbix_log_t, zabbix_log_t)
|
|
|
|
# PID file management
|
|
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)
|
|
|
|
# Network access to zabbix server
|
|
zabbix_tcp_connect(zabbix_agent_t)
|
|
|
|
# Shared Memory support
|
|
rw_files_pattern(zabbix_agent_t, zabbix_tmpfs_t, zabbix_tmpfs_t)
|
|
fs_tmpfs_filetrans(zabbix_agent_t, zabbix_tmpfs_t, file)
|
|
|
|
## Kernel layer module calls
|
|
|
|
## System layer module calls
|
|
|
|
# sysnetwork module
|
|
sysnet_dns_name_resolve(zabbix_agent_t)
|
|
|