Chris PeBenito 0fbfa5
#DESC TINYDNS - Name server for djbdns
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Authors:  Matthew J. Fanto <mattjf@uncompiled.com>
Chris PeBenito 0fbfa5
# 
Chris PeBenito 0fbfa5
# Based off Named policy file written by
Chris PeBenito 0fbfa5
# 	Yuichi Nakamura <ynakam@ori.hitachi-sk.co.jp>,
Chris PeBenito 0fbfa5
# 	Russell Coker
Chris PeBenito 0fbfa5
# X-Debian-Packages: djbdns-installer djbdns
Chris PeBenito 0fbfa5
# 
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
#################################
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Rules for the tinydns_t domain.
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
daemon_domain(tinydns)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
can_exec(tinydns_t, tinydns_exec_t)
Chris PeBenito 0fbfa5
allow tinydns_t sbin_t:dir search;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow tinydns_t self:process setsched;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# A type for configuration files of tinydns.
Chris PeBenito 0fbfa5
type tinydns_conf_t, file_type, sysadmfile;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# for primary zone files - the data file
Chris PeBenito 0fbfa5
type tinydns_zone_t, file_type, sysadmfile;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow tinydns_t etc_t:file { getattr read };
Chris PeBenito 0fbfa5
allow tinydns_t etc_runtime_t:{ file lnk_file } { getattr read };
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
#tinydns can use network
Chris PeBenito 0fbfa5
can_network_server(tinydns_t)
Chris PeBenito 0fbfa5
allow tinydns_t dns_port_t:{ udp_socket tcp_socket } name_bind;
Chris PeBenito 0fbfa5
# allow UDP transfer to/from any program
Chris PeBenito 0fbfa5
can_udp_send(domain, tinydns_t)
Chris PeBenito 0fbfa5
can_udp_send(tinydns_t, domain)
Chris PeBenito 0fbfa5
# tinydns itself doesn't do zone transfers
Chris PeBenito 2705f9
# so we do not need to have it tcp_connect
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
#read configuration files
Chris PeBenito 0fbfa5
r_dir_file(tinydns_t, tinydns_conf_t)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
r_dir_file(tinydns_t, tinydns_zone_t)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# allow tinydns to create datagram sockets (udp)
Chris PeBenito 0fbfa5
# allow tinydns_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 0fbfa5
allow tinydns_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Read /dev/random.
Chris PeBenito 0fbfa5
allow tinydns_t device_t:dir r_dir_perms;
Chris PeBenito 0fbfa5
allow tinydns_t random_device_t:chr_file r_file_perms;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Set own capabilities.
Chris PeBenito 0fbfa5
allow tinydns_t self:process setcap;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# for chmod in start script
Chris PeBenito 0fbfa5
dontaudit initrc_t tinydns_var_run_t:dir setattr;