Skip to contentSkip to conversation

nsd - the RIPE name server

DISCUSSION Russell Coker 1 participant 1 message Nov 19, 2002 SELinux security module

lore
Share & tools
lore
#0 lore raw

I've been playing with nsd, the authoritative-only name server written by NLnet LABS under contract from the RIPE NCC.

I've attached a quick first-cut at a policy for it.

Steve, please do not put this in the CVS at this time. There's a few things I will have to change.

I am sending it here so that interested people can play with it.

The person who said the following should now be happier:

Quoted 1 line

FWIW, your move to BIND9 discredits your SE-Linux efforts in my eyes...

Signature · 4 lines
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page
# nsd
/etc/nsd(/.*)?       		system_u:object_r:nsd_conf_t
/usr/sbin/nsd      		system_u:object_r:nsd_exec_t
/var/run/nsd.pid		system_u:object_r:var_run_nsd_t

#DESC Authoritative only name server
#
# Author: Russell Coker
#
#

#################################
#
# Rules for the nsd_t domain.
#
ifdef(named.te', ', `
type named_port_t, port_type;
')

daemon_domain(nsd)

# A type for configuration files of nsd
type nsd_conf_t, file_type, sysadmfile;
# A type for zone files
type nsd_zone_t, file_type, sysadmfile;

r_dir_file(nsd_t, { nsd_conf_t nsd_zone_t })
r_dir_file(initrc_t, nsd_conf_t)

# Use capabilities. Surplus capabilities may be allowed.
allow nsd_t self:capability { setuid setgid net_bind_service };
#allow nsd_t self:capability { setuid setgid net_bind_service chown fowner dac_override sys_nice };

allow nsd_t etc_t:{ file lnk_file } { getattr read }; #allow nsd_t etc_runtime_t:{ file lnk_file } { getattr read }; #allow nsd_t resolv_conf_t:file { getattr read };

# nsd can use network
can_network(nsd_t)
# allow UDP transfer to/from any program
ifdef(`named.te', `
can_udp_send(nsd_t, nsd_t)
can_udp_send(nsd_t, nsd_t)
can_tcp_connect(nsd_t, nsd_t)
')

#can_udp_send(domain, nsd_t)
#can_udp_send(nsd_t, domain)
#can_tcp_connect(domain, nsd_t)

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

allow nsd_t self:unix_stream_socket create_stream_socket_perms; allow nsd_t self:unix_dgram_socket create_socket_perms;

#allow nsd_t fs_t:filesystem getattr;

# Read sysctl kernel variables.
#allow nsd_t sysctl_t:dir r_dir_perms;
#allow nsd_t sysctl_kernel_t:dir r_dir_perms;
#allow nsd_t sysctl_kernel_t:file r_file_perms;

# Read /proc/cpuinfo.
#allow nsd_t proc_t:dir r_dir_perms;
#allow nsd_t proc_t:file r_file_perms;

# Read /dev/random.
#allow nsd_t device_t:dir r_dir_perms; #allow nsd_t random_device_t:chr_file r_file_perms;

# Use a pipe created by self.
#allow nsd_t self:fifo_file rw_file_perms;

# Set own capabilities.
#allow nsd_t self:process setcap;