## DNS forwarder and DHCP server.
########################################
##
## Execute dnsmasq server in the dnsmasq domain.
##
##
##
## Domain allowed to transition.
##
##
#
interface(`dnsmasq_domtrans',`
gen_require(`
type dnsmasq_exec_t, dnsmasq_t;
')
corecmd_search_bin($1)
domtrans_pattern($1, dnsmasq_exec_t, dnsmasq_t)
')
#######################################
##
## Execute dnsmasq server in the caller domain.
##
##
##
## Domain allowed to transition.
##
##
#
interface(`dnsmasq_exec',`
gen_require(`
type dnsmasq_exec_t;
')
can_exec($1, dnsmasq_exec_t)
')
########################################
##
## Allow read/write dnsmasq pipes
##
##
##
## Domain allowed access.
##
##
#
interface(`dnsmasq_rw_inherited_pipes',`
gen_require(`
type dnsmasq_t;
')
allow $1 dnsmasq_t:fifo_file rw_inherited_fifo_file_perms;
')
########################################
##
## Execute the dnsmasq init script in
## the init script domain.
##
##
##
## Domain allowed to transition.
##
##
#
#
interface(`dnsmasq_initrc_domtrans',`
gen_require(`
type dnsmasq_initrc_exec_t;
')
init_labeled_script_domtrans($1, dnsmasq_initrc_exec_t)
')
########################################
##
## Execute dnsmasq server in the dnsmasq domain.
##
##
##
## Domain allowed to transition.
##
##
#
interface(`dnsmasq_systemctl',`
gen_require(`
type dnsmasq_unit_file_t;
type dnsmasq_t;
')
systemd_exec_systemctl($1)
init_reload_services($1)
allow $1 dnsmasq_unit_file_t:file read_file_perms;
allow $1 dnsmasq_unit_file_t:service manage_service_perms;
ps_process_pattern($1, dnsmasq_t)
')
########################################
##
## Send sigchld to dnsmasq.
##
##
##
## Domain allowed access.
##
##
#
#
interface(`dnsmasq_sigchld',`
gen_require(`
type dnsmasq_t;
')
allow $1 dnsmasq_t:process sigchld;
')
########################################
##
## Send generic signals to dnsmasq.
##
##
##
## Domain allowed access.
##
##
#
#
interface(`dnsmasq_signal',`
gen_require(`
type dnsmasq_t;
')
allow $1 dnsmasq_t:process signal;
')
########################################
##
## Send null signals to dnsmasq.
##
##
##
## Domain allowed access.
##
##
#
#
interface(`dnsmasq_signull',`
gen_require(`
type dnsmasq_t;
')
allow $1 dnsmasq_t:process signull;
')
########################################
##
## Send kill signals to dnsmasq.
##
##
##
## Domain allowed access.
##
##
#
#
interface(`dnsmasq_kill',`
gen_require(`
type dnsmasq_t;
')
allow $1 dnsmasq_t:process sigkill;
')
########################################
##
## Allow the specified domain to read
## dnsmasq configuration files.
##
##
##
## Domain allowed access.
##
##
#
interface(`dnsmasq_read_config',`
gen_require(`
type dnsmasq_etc_t;
')
files_search_etc($1)
allow $1 dnsmasq_etc_t:dir list_dir_perms;
allow $1 dnsmasq_etc_t:file read_file_perms;
')
########################################
##
## Allow the specified domain to manage
## dnsmasq configuration files.
##
##
##
## Domain allowed access.
##
##
#
interface(`dnsmasq_manage_config',`
gen_require(`
type dnsmasq_etc_t;
')
files_search_etc($1)
allow $1 dnsmasq_etc_t:dir manage_dir_perms;
allow $1 dnsmasq_etc_t:file manage_file_perms;
')
########################################
##
## Allow the specified domain to write
## dnsmasq configuration files.
##
##
##
## Domain allowed access.
##
##
#
interface(`dnsmasq_write_config',`
gen_require(`
type dnsmasq_etc_t;
')
files_search_etc($1)
allow $1 dnsmasq_etc_t:dir list_dir_perms;
allow $1 dnsmasq_etc_t:file write_file_perms;
')
########################################
##
## Delete dnsmasq pid files.
##
##
##
## Domain allowed access.
##
##
#
interface(`dnsmasq_delete_pid_files',`
gen_require(`
type dnsmasq_var_run_t;
')
files_search_pids($1)
delete_files_pattern($1, dnsmasq_var_run_t, dnsmasq_var_run_t)
')
########################################
##
## Create, read, write, and delete
## dnsmasq pid files
##
##
##
## Domain allowed access.
##
##
#
interface(`dnsmasq_manage_pid_files',`
gen_require(`
type dnsmasq_var_run_t;
')
files_search_pids($1)
manage_files_pattern($1, dnsmasq_var_run_t, dnsmasq_var_run_t)
')
########################################
##
## Read dnsmasq pid files
##
##
##
## Domain allowed access.
##
##
#
interface(`dnsmasq_read_pid_files',`
gen_require(`
type dnsmasq_var_run_t;
')
files_search_pids($1)
read_files_pattern($1, dnsmasq_var_run_t, dnsmasq_var_run_t)
')
########################################
##
## Create dnsmasq pid directories.
##
##
##
## Domain allowed access.
##
##
#
interface(`dnsmasq_create_pid_dirs',`
gen_require(`
type dnsmasq_var_run_t;
')
files_search_pids($1)
allow $1 dnsmasq_var_run_t:dir create_dir_perms;
')
########################################
##
## Create dnsmasq pid directories.
##
##
##
## Domain allowed access.
##
##
#
interface(`dnsmasq_read_state',`
gen_require(`
type dnsmasq_t;
')
ps_process_pattern($1, dnsmasq_t)
')
########################################
##
## Transition to dnsmasq named content
##
##
##
## Domain allowed access.
##
##
##
##
## The type of the directory for the object to be created.
##
##
#
interface(`dnsmasq_filetrans_named_content_fromdir',`
gen_require(`
type dnsmasq_var_run_t;
')
filetrans_pattern($1, $2, dnsmasq_var_run_t, dir, "network")
filetrans_pattern($1, $2, dnsmasq_var_run_t, file, "dnsmasq.pid")
')
#######################################
##
## Transition to dnsmasq named content
##
##
##
## Domain allowed access.
##
##
#
interface(`dnsmasq_filetrans_named_content',`
gen_require(`
type dnsmasq_etc_t;
type dnsmasq_var_run_t;
')
files_pid_filetrans($1, dnsmasq_var_run_t, dir, "network")
files_pid_filetrans($1, dnsmasq_var_run_t, file, "dnsmasq.pid")
virt_pid_filetrans($1, dnsmasq_var_run_t, file, "network")
files_etc_filetrans($1, dnsmasq_etc_t, file, "dnsmasq.conf")
files_etc_filetrans($1, dnsmasq_etc_t, dir, "dnsmasq.d")
')
########################################
##
## All of the rules required to
## administrate an dnsmasq environment.
##
##
##
## Domain allowed access.
##
##
##
##
## Role allowed access.
##
##
##
#
interface(`dnsmasq_admin',`
gen_require(`
type dnsmasq_t, dnsmasq_lease_t, dnsmasq_var_run_t;
type dnsmasq_var_log_t;
type dnsmasq_initrc_exec_t;
type dnsmasq_unit_file_t;
')
allow $1 dnsmasq_t:process signal_perms;
ps_process_pattern($1, dnsmasq_t)
tunable_policy(`deny_ptrace',`',`
allow $1 dnsmasq_t:process ptrace;
')
init_labeled_script_domtrans($1, dnsmasq_initrc_exec_t)
domain_system_change_exemption($1)
role_transition $2 dnsmasq_initrc_exec_t system_r;
allow $2 system_r;
files_list_var_lib($1)
admin_pattern($1, dnsmasq_lease_t)
logging_search_logs($1)
admin_pattern($1, dnsmasq_var_log_t)
files_list_pids($1)
admin_pattern($1, dnsmasq_var_run_t)
dnsmasq_systemctl($1)
admin_pattern($1, dnsmasq_unit_file_t)
allow $1 dnsmasq_unit_file_t:service all_service_perms;
')
########################################
##
## Send and receive messages from
## dnsmasq over dbus.
##
##
##
## Domain allowed access.
##
##
#
interface(`dnsmasq_dbus_chat',`
gen_require(`
type dnsmasq_t;
class dbus send_msg;
')
allow $1 dnsmasq_t:dbus send_msg;
allow dnsmasq_t $1:dbus send_msg;
')