Skip to contentSkip to conversation

named.te

DISCUSSION Russell Coker 1 participant 1 message Apr 23, 2002 SELinux security module

lore
Share & tools
lore
#0 lore raw

Here's my latest BIND policy.

/var/named(|/.*)                system_u:object_r:named_conf_t
/var/cache/bind(|/.*)           system_u:object_r:named_cache_t
/etc/named.conf                 system_u:object_r:named_conf_t
/etc/bind(|/.*)                 system_u:object_r:named_zone_t
/etc/bind/named.conf            system_u:object_r:named_conf_t
/usr/sbin/named.*               system_u:object_r:named_exec_t

It supports secondary domains and has a comment mentioning how to allow updates to primary zones.

Signature · 4 lines
If you send email to me or to a mailing list that I use which has >4 lines
of legalistic junk at the end then you are specifically authorizing me to do
whatever I wish with the message and all other messages from your domain, by
posting the message you agree that your long legalistic sig is void.

#
# Author: Yuichi Nakamura <[email protected]> #

#################################
#
# Rules for the named_t domain.
#

#named_t is general domain label and can communicate with syslog. type named_t, domain, privlog;
role system_r types named_t;
every_domain(named_t)

# ndc_t is the domain for thendc program
type ndc_t, domain, privlog;
role sysadm_r types ndc_t;

#A type for /usr/sbin/named
type named_exec_t, file_type,sysadmfile, exec_type; domain_auto_trans(initrc_t, named_exec_t, named_t) type_transition init_t named_exec_t:process named_t;

can_exec(named_t, named_exec_t)

# A type for configuration files of named.
type named_conf_t, file_type,sysadmfile;

# for primary zone files
type named_zone_t, file_type, sysadmfile;
# for secondary zone files
type named_cache_t, file_type, sysadmfile;

# A type for files in /var/run specific to named type named_var_run_t, file_type, sysadmfile, pidfile;

# Use capabilities. Surplus capabilities may be allowed. allow named_t named_t:capability { setuid setgid net_bind_service };

# Inherit and use descriptors from init.
allow named_t init_t:fd inherit_fd_perms;

#Named can use network
can_network(named_t)

# allow UDP transfer to/from any program
can_udp_send(domain, named_t)
can_udp_send(named_t, domain)

# Bind to the named port.
allow named_t named_port_t:udp_socket name_bind;

# Allow named_t to put a pid file in /var/run file_type_auto_trans(named_t, var_run_t, named_var_run_t)

#named can append to log files.
allow named_t var_log_t:file ra_file_perms;

#read configuration files
allow named_t named_conf_t:file r_file_perms;

#read zone files - change this to rw_ for the dir and create_ for the file to

# enable domain auto updates.
allow named_t named_zone_t:dir r_dir_perms;
allow named_t named_zone_t:file r_file_perms;

#write cache for secondary zones
allow named_t named_cache_t:dir rw_dir_perms; allow named_t named_cache_t:file create_file_perms;

uses_authbind(named_t)

#A type for /usr/sbin/ndc
type ndc_exec_t, file_type,sysadmfile, exec_type;
domain_auto_trans(sysadm_t, ndc_exec_t, ndc_t)
uses_shlib(ndc_t)

allow ndc_t etc_t:dir r_dir_perms;
allow ndc_t self:unix_stream_socket create_stream_socket_perms; allow ndc_t self:unix_stream_socket connect;
allow ndc_t self:capability dac_override;
allow ndc_t named_var_run_t:sock_file rw_file_perms; allow ndc_t named_t:unix_stream_socket connectto;