|
Chris PeBenito |
0fbfa5 |
#DESC Authoritative only name server
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Author: Russell Coker
|
|
Chris PeBenito |
0fbfa5 |
# X-Debian-Packages: nsd
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
#################################
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
# Rules for the nsd_t domain.
|
|
Chris PeBenito |
0fbfa5 |
#
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
daemon_domain(nsd)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# a type for nsd.db
|
|
Chris PeBenito |
0fbfa5 |
type nsd_db_t, file_type, sysadmfile;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# for zone update cron job
|
|
Chris PeBenito |
0fbfa5 |
type nsd_crond_t, domain, privlog;
|
|
Chris PeBenito |
0fbfa5 |
role system_r types nsd_crond_t;
|
|
Chris PeBenito |
0fbfa5 |
uses_shlib(nsd_crond_t)
|
|
Chris PeBenito |
0fbfa5 |
can_network_client(nsd_crond_t)
|
|
Chris PeBenito |
0fbfa5 |
can_ypbind(nsd_crond_t)
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_crond_t self:unix_dgram_socket create_socket_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_crond_t self:process { fork signal_perms };
|
|
Chris PeBenito |
0fbfa5 |
system_crond_entry(nsd_exec_t, nsd_crond_t)
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_crond_t { proc_t etc_runtime_t }:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_crond_t proc_t:lnk_file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_crond_t { bin_t sbin_t }:dir search;
|
|
Chris PeBenito |
0fbfa5 |
can_exec(nsd_crond_t, { nsd_exec_t bin_t sbin_t shell_exec_t })
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_crond_t { bin_t sbin_t shell_exec_t }:file getattr;
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_crond_t bin_t:lnk_file read;
|
|
Chris PeBenito |
0fbfa5 |
read_locale(nsd_crond_t)
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_crond_t self:fifo_file rw_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
# kill capability for root cron job and non-root daemon
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_crond_t self:capability { dac_override kill };
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_crond_t nsd_t:process signal;
|
|
Chris PeBenito |
0fbfa5 |
dontaudit nsd_crond_t sysadm_home_dir_t:dir { search getattr };
|
|
Chris PeBenito |
0fbfa5 |
dontaudit nsd_crond_t self:capability sys_nice;
|
|
Chris PeBenito |
0fbfa5 |
dontaudit nsd_crond_t domain:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_crond_t self:process setsched;
|
|
Chris PeBenito |
0fbfa5 |
can_ps(nsd_crond_t, nsd_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
file_type_auto_trans(nsd_crond_t, nsd_conf_t, nsd_zone_t, file)
|
|
Chris PeBenito |
0fbfa5 |
file_type_auto_trans({ nsd_t nsd_crond_t }, nsd_zone_t, nsd_db_t, file)
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_crond_t var_lib_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_crond_t nsd_conf_t:file { getattr read ioctl };
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_crond_t nsd_zone_t:dir rw_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_crond_t proc_t:dir r_dir_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_crond_t device_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_crond_t devtty_t:chr_file rw_file_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_crond_t etc_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_crond_t etc_t:lnk_file read;
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_crond_t { var_t var_run_t }:dir search;
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_crond_t nsd_var_run_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# for SSP
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_crond_t urandom_device_t:chr_file read;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# A type for configuration files of nsd
|
|
Chris PeBenito |
0fbfa5 |
type nsd_conf_t, file_type, sysadmfile;
|
|
Chris PeBenito |
0fbfa5 |
# A type for zone files
|
|
Chris PeBenito |
0fbfa5 |
type nsd_zone_t, file_type, sysadmfile;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
r_dir_file(nsd_t, { nsd_conf_t nsd_zone_t })
|
|
Chris PeBenito |
0fbfa5 |
# zone files may be in /var/lib/nsd
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_t var_lib_t:dir search;
|
|
Chris PeBenito |
0fbfa5 |
r_dir_file(initrc_t, nsd_conf_t)
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_t etc_runtime_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_t proc_t:file { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_t { sbin_t bin_t }:dir search;
|
|
Chris PeBenito |
0fbfa5 |
can_exec(nsd_t, { nsd_exec_t bin_t })
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Use capabilities. chown is for chowning /var/run/nsd.pid
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_t self:capability { dac_override chown setuid setgid net_bind_service };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_t etc_t:{ file lnk_file } { getattr read };
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# nsd can use network
|
|
Chris PeBenito |
0fbfa5 |
can_network_server(nsd_t)
|
|
Chris PeBenito |
0fbfa5 |
can_ypbind(nsd_t)
|
|
Chris PeBenito |
0fbfa5 |
# allow client access from caching BIND
|
|
Chris PeBenito |
0fbfa5 |
ifdef(`named.te', `
|
|
Chris PeBenito |
0fbfa5 |
can_udp_send(named_t, nsd_t)
|
|
Chris PeBenito |
0fbfa5 |
can_udp_send(nsd_t, named_t)
|
|
Chris PeBenito |
0fbfa5 |
can_tcp_connect(named_t, nsd_t)
|
|
Chris PeBenito |
0fbfa5 |
')
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# if you want to allow all programs to contact the primary name server
|
|
Chris PeBenito |
0fbfa5 |
#can_udp_send(domain, nsd_t)
|
|
Chris PeBenito |
0fbfa5 |
#can_udp_send(nsd_t, domain)
|
|
Chris PeBenito |
0fbfa5 |
#can_tcp_connect(domain, nsd_t)
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
# Bind to the named port.
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_t dns_port_t:udp_socket name_bind;
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_t dns_port_t:tcp_socket name_bind;
|
|
Chris PeBenito |
0fbfa5 |
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_t self:unix_stream_socket create_stream_socket_perms;
|
|
Chris PeBenito |
0fbfa5 |
allow nsd_t self:unix_dgram_socket create_socket_perms;
|
|
Chris PeBenito |
0fbfa5 |
|