|
Michael Thomas |
eeaa625 |
policy_module(xpilotd,1.0.0)
|
|
Michael Thomas |
eeaa625 |
|
|
Michael Thomas |
eeaa625 |
########################################
|
|
Michael Thomas |
eeaa625 |
#
|
|
Michael Thomas |
eeaa625 |
# Declarations
|
|
Michael Thomas |
eeaa625 |
#
|
|
Michael Thomas |
eeaa625 |
|
|
Michael Thomas |
eeaa625 |
gen_require(`
|
|
Michael Thomas |
eeaa625 |
type port_t;
|
|
Michael Thomas |
eeaa625 |
attribute port_type;
|
|
Michael Thomas |
eeaa625 |
type var_log_t;
|
|
Michael Thomas |
eeaa625 |
')
|
|
Michael Thomas |
eeaa625 |
|
|
Michael Thomas |
eeaa625 |
type xpilotd_port_t, port_type;
|
|
Michael Thomas |
eeaa625 |
|
|
Michael Thomas |
eeaa625 |
type xpilotd_t;
|
|
Michael Thomas |
eeaa625 |
type xpilotd_exec_t;
|
|
Michael Thomas |
eeaa625 |
domain_type(xpilotd_t)
|
|
Michael Thomas |
eeaa625 |
init_daemon_domain(xpilotd_t, xpilotd_exec_t)
|
|
Michael Thomas |
eeaa625 |
|
|
Michael Thomas |
eeaa625 |
# pid files
|
|
Michael Thomas |
eeaa625 |
type xpilotd_var_run_t;
|
|
Michael Thomas |
eeaa625 |
files_pid_file(xpilotd_var_run_t)
|
|
Michael Thomas |
eeaa625 |
|
|
Michael Thomas |
eeaa625 |
# Game data files
|
|
Michael Thomas |
eeaa625 |
type xpilotd_private_data_t;
|
|
Michael Thomas |
eeaa625 |
files_type(xpilotd_private_data_t);
|
|
Michael Thomas |
eeaa625 |
|
|
Michael Thomas |
eeaa625 |
########################################
|
|
Michael Thomas |
eeaa625 |
#
|
|
Michael Thomas |
eeaa625 |
# xpilot local policy
|
|
Michael Thomas |
eeaa625 |
#
|
|
Michael Thomas |
eeaa625 |
# Check in /etc/selinux/refpolicy/include for macros to use instead of allow rules.
|
|
Michael Thomas |
eeaa625 |
# Note: /usr/share/selinux/devel/include/support/obj_perm_sets.spt contains
|
|
Michael Thomas |
eeaa625 |
# the definitions of many permissions, such as 'rw_dir_perms'
|
|
Michael Thomas |
eeaa625 |
|
|
Michael Thomas |
eeaa625 |
# Some common macros (you might be able to remove some)
|
|
Michael Thomas |
eeaa625 |
files_read_usr_files(xpilotd_t)
|
|
Michael Thomas |
eeaa625 |
files_read_etc_files(xpilotd_t)
|
|
Michael Thomas |
eeaa625 |
libs_use_ld_so(xpilotd_t)
|
|
Michael Thomas |
eeaa625 |
libs_use_shared_libs(xpilotd_t)
|
|
Michael Thomas |
eeaa625 |
miscfiles_read_localization(xpilotd_t)
|
|
Michael Thomas |
eeaa625 |
## internal communication is often done using fifo and unix sockets.
|
|
Michael Thomas |
eeaa625 |
allow xpilotd_t self:fifo_file { read write };
|
|
Michael Thomas |
eeaa625 |
allow xpilotd_t self:unix_stream_socket create_stream_socket_perms;
|
|
Michael Thomas |
eeaa625 |
|
|
Michael Thomas |
eeaa625 |
# log files
|
|
Michael Thomas |
eeaa625 |
allow xpilotd_t var_log_t:file rw_file_perms ;
|
|
Michael Thomas |
eeaa625 |
|
|
Michael Thomas |
eeaa625 |
## Networking basics (adjust to your needs!)
|
|
Michael Thomas |
eeaa625 |
sysnet_dns_name_resolve(xpilotd_t)
|
|
Michael Thomas |
eeaa625 |
corenet_udp_bind_all_nodes(xpilotd_t)
|
|
Michael Thomas |
64cce06 |
corenet_all_recvfrom_unlabeled(xpilotd_t)
|
|
Michael Thomas |
eeaa625 |
|
|
Michael Thomas |
eeaa625 |
corenet_udp_sendrecv_all_ports(xpilotd_t)
|
|
Michael Thomas |
eeaa625 |
|
|
Michael Thomas |
eeaa625 |
allow xpilotd_t xpilotd_port_t:udp_socket { name_bind };
|
|
Michael Thomas |
eeaa625 |
|
|
Michael Thomas |
eeaa625 |
|
|
Michael Thomas |
eeaa625 |
|
|
Michael Thomas |
eeaa625 |
# Init script handling
|
|
Michael Thomas |
eeaa625 |
init_use_fds(xpilotd_t)
|
|
Michael Thomas |
eeaa625 |
init_use_script_ptys(xpilotd_t)
|
|
Michael Thomas |
eeaa625 |
domain_use_interactive_fds(xpilotd_t)
|
|
Michael Thomas |
eeaa625 |
|
|
Michael Thomas |
eeaa625 |
# Game private data
|
|
Michael Thomas |
eeaa625 |
allow xpilotd_t xpilotd_private_data_t:file { r_file_perms };
|
|
Michael Thomas |
eeaa625 |
allow xpilotd_t xpilotd_private_data_t:dir search;
|
|
Michael Thomas |
eeaa625 |
|
|
Michael Thomas |
eeaa625 |
|
|
Michael Thomas |
eeaa625 |
# Misc rules that are needed. I don't understand the meaning of some
|
|
Michael Thomas |
eeaa625 |
# of these, and for others I don't yet understand why the game needs
|
|
Michael Thomas |
eeaa625 |
# them
|
|
Michael Thomas |
eeaa625 |
kernel_read_system_state(xpilotd_t)
|
|
Michael Thomas |
eeaa625 |
allow xpilotd_t self:process signal;
|