From 9e725d8a1a992a2c65dd9982ab73cf46c2aeb02b Mon Sep 17 00:00:00 2001 From: Chris PeBenito Date: Tue, 25 Apr 2006 14:45:14 +0000 Subject: [PATCH] add dnsmasq, bug 1524 --- refpolicy/Changelog | 1 + refpolicy/policy/modules/services/dnsmasq.fc | 4 + refpolicy/policy/modules/services/dnsmasq.if | 1 + refpolicy/policy/modules/services/dnsmasq.te | 103 +++++++++++++++++++ 4 files changed, 109 insertions(+) create mode 100644 refpolicy/policy/modules/services/dnsmasq.fc create mode 100644 refpolicy/policy/modules/services/dnsmasq.if create mode 100644 refpolicy/policy/modules/services/dnsmasq.te diff --git a/refpolicy/Changelog b/refpolicy/Changelog index e7a3afb20..db784da8d 100644 --- a/refpolicy/Changelog +++ b/refpolicy/Changelog @@ -44,6 +44,7 @@ courier dante dpkg (Erich Schubert) + dnsmasq ethereal evolution games diff --git a/refpolicy/policy/modules/services/dnsmasq.fc b/refpolicy/policy/modules/services/dnsmasq.fc new file mode 100644 index 000000000..aa52c2cee --- /dev/null +++ b/refpolicy/policy/modules/services/dnsmasq.fc @@ -0,0 +1,4 @@ +/usr/sbin/dnsmasq -- gen_context(system_u:object_r:dnsmasq_exec_t,s0) + +/var/lib/misc/dnsmasq\.leases -- gen_context(system_u:object_r:dnsmasq_lease_t,s0) +/var/run/dnsmasq\.pid -- gen_context(system_u:object_r:dnsmasq_var_run_t,s0) diff --git a/refpolicy/policy/modules/services/dnsmasq.if b/refpolicy/policy/modules/services/dnsmasq.if new file mode 100644 index 000000000..e5b09980f --- /dev/null +++ b/refpolicy/policy/modules/services/dnsmasq.if @@ -0,0 +1 @@ +## dnsmasq DNS forwarder and DHCP server diff --git a/refpolicy/policy/modules/services/dnsmasq.te b/refpolicy/policy/modules/services/dnsmasq.te new file mode 100644 index 000000000..afeb8412e --- /dev/null +++ b/refpolicy/policy/modules/services/dnsmasq.te @@ -0,0 +1,103 @@ + +policy_module(dnsmasq,1.0.0) + +######################################## +# +# Declarations +# + +type dnsmasq_t; +type dnsmasq_exec_t; +init_daemon_domain(dnsmasq_t,dnsmasq_exec_t) + +type dnsmasq_lease_t; +files_type(dnsmasq_lease_t) + +type dnsmasq_var_run_t; +files_pid_file(dnsmasq_var_run_t) + +######################################## +# +# Local policy +# + +allow dnsmasq_t self:capability { setgid setuid net_bind_service net_raw }; +dontaudit dnsmasq_t self:capability sys_tty_config; +allow dnsmasq_t self:process signal_perms; +allow dnsmasq_t self:tcp_socket create_stream_socket_perms; +allow dnsmasq_t self:udp_socket create_socket_perms; +allow dnsmasq_t self:packet_socket create_socket_perms; +allow dnsmasq_t self:rawip_socket create_socket_perms; + +# dhcp leases +allow dnsmasq_t dnsmasq_lease_t:file manage_file_perms; +files_var_lib_filetrans(dnsmasq_t,dnsmasq_lease_t,file) + +allow dnsmasq_t dnsmasq_var_run_t:file create_file_perms; +allow dnsmasq_t dnsmasq_var_run_t:dir rw_dir_perms; +files_pid_filetrans(dnsmasq_t,dnsmasq_var_run_t,file) + +kernel_read_kernel_sysctls(dnsmasq_t) +kernel_list_proc(dnsmasq_t) +kernel_read_proc_symlinks(dnsmasq_t) + +corenet_tcp_sendrecv_generic_if(dnsmasq_t) +corenet_udp_sendrecv_generic_if(dnsmasq_t) +corenet_raw_sendrecv_generic_if(dnsmasq_t) +corenet_tcp_sendrecv_all_nodes(dnsmasq_t) +corenet_udp_sendrecv_all_nodes(dnsmasq_t) +corenet_raw_sendrecv_all_nodes(dnsmasq_t) +corenet_tcp_sendrecv_all_ports(dnsmasq_t) +corenet_udp_sendrecv_all_ports(dnsmasq_t) +corenet_non_ipsec_sendrecv(dnsmasq_t) +corenet_tcp_bind_all_nodes(dnsmasq_t) +corenet_udp_bind_all_nodes(dnsmasq_t) +corenet_tcp_bind_dns_port(dnsmasq_t) +corenet_udp_bind_dns_port(dnsmasq_t) +corenet_udp_bind_dhcpd_port(dnsmasq_t) + +dev_read_sysfs(dnsmasq_t) +dev_read_urand(dnsmasq_t) + +domain_use_interactive_fds(dnsmasq_t) + +# allow access to dnsmasq.conf +files_read_etc_files(dnsmasq_t) + +fs_getattr_all_fs(dnsmasq_t) +fs_search_auto_mountpoints(dnsmasq_t) + +term_dontaudit_use_console(dnsmasq_t) + +init_use_fds(dnsmasq_t) +init_use_script_ptys(dnsmasq_t) + +libs_use_ld_so(dnsmasq_t) +libs_use_shared_libs(dnsmasq_t) + +logging_send_syslog_msg(dnsmasq_t) + +miscfiles_read_localization(dnsmasq_t) + +sysnet_read_config(dnsmasq_t) + +userdom_dontaudit_use_unpriv_user_fds(dnsmasq_t) +userdom_dontaudit_search_sysadm_home_dirs(dnsmasq_t) + +ifdef(`targeted_policy',` + term_dontaudit_use_unallocated_ttys(dnsmasq_t) + term_dontaudit_use_generic_ptys(dnsmasq_t) + files_dontaudit_read_root_files(dnsmasq_t) +') + +optional_policy(` + nis_use_ypbind(dnsmasq_t) +') + +optional_policy(` + seutil_sigchld_newrole(dnsmasq_t) +') + +optional_policy(` + udev_read_db(dnsmasq_t) +')