Chris PeBenito 134191
ifdef(`enable_mls',`
Chris PeBenito 134191
#
Chris PeBenito 134191
# Define sensitivities 
Chris PeBenito 134191
#
Chris PeBenito e070dd
# Domination of sensitivities is in increasin
Chris PeBenito e070dd
# numerical order, with s0 being the lowest
Chris PeBenito 134191
Chris PeBenito e070dd
gen_sens(mls_num_sens)
Chris PeBenito 2705f9
Chris PeBenito 134191
#
Chris PeBenito 134191
# Define the categories
Chris PeBenito 134191
#
Chris PeBenito e070dd
# Generate declarations
Chris PeBenito 134191
Chris PeBenito e070dd
gen_cats(mls_num_cats)
Chris PeBenito 134191
Chris PeBenito 134191
#
Chris PeBenito 134191
# Each MLS level specifies a sensitivity and zero or more categories which may
Chris PeBenito 134191
# be associated with that sensitivity.
Chris PeBenito 134191
#
Chris PeBenito e070dd
# Generate levels from all sensitivities
Chris PeBenito e070dd
# with all categories
Chris PeBenito 134191
Chris PeBenito e070dd
gen_levels(mls_num_sens,mls_num_cats)
Chris PeBenito 134191
Chris PeBenito 134191
#
Chris PeBenito 134191
# Define the MLS policy
Chris PeBenito 134191
#
Chris PeBenito 134191
# mlsconstrain class_set perm_set expression ;
Chris PeBenito 134191
#
Chris PeBenito 134191
# mlsvalidatetrans class_set expression ;
Chris PeBenito 134191
#
Chris PeBenito 134191
# expression : ( expression )
Chris PeBenito 134191
#	     | not expression
Chris PeBenito 134191
#	     | expression and expression
Chris PeBenito 134191
#	     | expression or expression
Chris PeBenito 134191
#	     | u1 op u2
Chris PeBenito 134191
#	     | r1 role_mls_op r2
Chris PeBenito 134191
#	     | t1 op t2
Chris PeBenito 134191
#	     | l1 role_mls_op l2
Chris PeBenito 134191
#	     | l1 role_mls_op h2
Chris PeBenito 134191
#	     | h1 role_mls_op l2
Chris PeBenito 134191
#	     | h1 role_mls_op h2
Chris PeBenito 134191
#	     | l1 role_mls_op h1
Chris PeBenito 134191
#	     | l2 role_mls_op h2
Chris PeBenito 134191
#	     | u1 op names
Chris PeBenito 134191
#	     | u2 op names
Chris PeBenito 134191
#	     | r1 op names
Chris PeBenito 134191
#	     | r2 op names
Chris PeBenito 134191
#	     | t1 op names
Chris PeBenito 134191
#	     | t2 op names
Chris PeBenito 134191
#	     | u3 op names (NOTE: this is only available for mlsvalidatetrans)
Chris PeBenito 134191
#	     | r3 op names (NOTE: this is only available for mlsvalidatetrans)
Chris PeBenito 134191
#	     | t3 op names (NOTE: this is only available for mlsvalidatetrans)
Chris PeBenito 134191
#
Chris PeBenito 134191
# op : == | !=
Chris PeBenito 134191
# role_mls_op : == | != | eq | dom | domby | incomp
Chris PeBenito 134191
#
Chris PeBenito 134191
# names : name | { name_list }
Chris PeBenito 2705f9
# name_list : name | name_list name
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito 134191
#
Chris PeBenito 134191
# MLS policy for the file classes
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito 134191
# make sure these file classes are "single level"
Chris PeBenito 134191
mlsconstrain { file lnk_file fifo_file } { create relabelto }
Chris PeBenito 134191
	( l2 eq h2 );
Chris PeBenito 134191
Chris PeBenito bf080a
# new file labels must be dominated by the relabeling subjects clearance
Chris PeBenito 134191
mlsconstrain { dir file lnk_file chr_file blk_file sock_file fifo_file } relabelto
Chris PeBenito 134191
	( h1 dom h2 );
Chris PeBenito 134191
Chris PeBenito 134191
# the file "read" ops (note the check is dominance of the low level)
Chris PeBenito 134191
mlsconstrain { dir file lnk_file chr_file blk_file sock_file fifo_file } { read getattr execute }
Chris PeBenito 134191
	(( l1 dom l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsfilereadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsfileread ) or
Chris PeBenito 134191
	 ( t2 == mlstrustedobject ));
Chris PeBenito 134191
Chris PeBenito 134191
mlsconstrain dir search
Chris PeBenito 134191
	(( l1 dom l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsfilereadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsfileread ) or
Chris PeBenito 134191
	 ( t2 == mlstrustedobject ));
Chris PeBenito 134191
Chris PeBenito 134191
# the "single level" file "write" ops
Chris PeBenito a5e213
mlsconstrain { file lnk_file fifo_file dir chr_file blk_file sock_file } { write create setattr relabelfrom append unlink link rename mounton }
Chris PeBenito 134191
	(( l1 eq l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsfilewritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito f497b8
	 (( t2 == mlsfilewriteinrange ) and ( l1 dom l2 ) and ( h1 domby h2 )) or
Chris PeBenito 134191
	 ( t1 == mlsfilewrite ) or
Chris PeBenito 134191
	 ( t2 == mlstrustedobject ));
Chris PeBenito 134191
Chris PeBenito d62c08
# Directory "write" ops
Chris PeBenito 134191
mlsconstrain dir { add_name remove_name reparent rmdir }
Chris PeBenito d62c08
	(( l1 eq l2 ) or
Chris PeBenito d62c08
	 (( t1 == mlsfilewriteinrange ) and ( l1 dom l2 ) and ( l1 domby h2 )) or
Chris PeBenito 134191
	 (( t1 == mlsfilewritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsfilewrite ) or
Chris PeBenito 134191
	 ( t2 == mlstrustedobject ));
Chris PeBenito 134191
Chris PeBenito 134191
# these access vectors have no MLS restrictions
Chris PeBenito 134191
# { dir file lnk_file chr_file blk_file sock_file fifo_file } { ioctl lock swapon quotaon }
Chris PeBenito 134191
#
Chris PeBenito 2705f9
# { file chr_file } { execute_no_trans entrypoint execmod }
Chris PeBenito 134191
Chris PeBenito 134191
# the file upgrade/downgrade rule
Chris PeBenito 2705f9
mlsvalidatetrans { dir file lnk_file chr_file blk_file sock_file fifo_file }
Chris PeBenito 134191
	((( l1 eq l2 ) or
Chris PeBenito 134191
	  (( t3 == mlsfileupgrade ) and ( l1 domby l2 )) or
Chris PeBenito 134191
	  (( t3 == mlsfiledowngrade ) and ( l1 dom l2 )) or
Chris PeBenito 134191
	  (( t3 == mlsfiledowngrade ) and ( l1 incomp l2 ))) and
Chris PeBenito 134191
	 (( h1 eq h2 ) or
Chris PeBenito 134191
	  (( t3 == mlsfileupgrade ) and ( h1 domby h2 )) or
Chris PeBenito 134191
	  (( t3 == mlsfiledowngrade ) and ( h1 dom h2 )) or
Chris PeBenito 134191
	  (( t3 == mlsfiledowngrade ) and ( h1 incomp h2 ))));
Chris PeBenito 134191
Chris PeBenito 134191
# create can also require the upgrade/downgrade checks if the creating process
Chris PeBenito 134191
# has used setfscreate (note that both the high and low level of the object
Chris PeBenito 134191
# default to the process sensitivity level)
Chris PeBenito 134191
mlsconstrain { dir file lnk_file chr_file blk_file sock_file fifo_file } create
Chris PeBenito 134191
	((( l1 eq l2 ) or
Chris PeBenito 134191
	  (( t1 == mlsfileupgrade ) and ( l1 domby l2 )) or
Chris PeBenito 134191
	  (( t1 == mlsfiledowngrade ) and ( l1 dom l2 )) or
Chris PeBenito 134191
	  (( t1 == mlsfiledowngrade ) and ( l1 incomp l2 ))) and
Chris PeBenito 134191
	 (( l1 eq h2 ) or
Chris PeBenito 134191
	  (( t1 == mlsfileupgrade ) and ( l1 domby h2 )) or
Chris PeBenito 134191
	  (( t1 == mlsfiledowngrade ) and ( l1 dom h2 )) or
Chris PeBenito 134191
	  (( t1 == mlsfiledowngrade ) and ( l1 incomp h2 ))));
Chris PeBenito 134191
Chris PeBenito 134191
Chris PeBenito 2705f9
Chris PeBenito 2705f9
Chris PeBenito 134191
#
Chris PeBenito 134191
# MLS policy for the filesystem class
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito bf080a
# new filesystem labels must be dominated by the relabeling subjects clearance
Chris PeBenito 134191
mlsconstrain filesystem relabelto
Chris PeBenito 134191
	( h1 dom h2 );
Chris PeBenito 134191
Chris PeBenito 134191
# the filesystem "read" ops (implicit single level)
Chris PeBenito 134191
mlsconstrain filesystem { getattr quotaget }
Chris PeBenito 134191
	(( l1 dom l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsfilereadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsfileread ));
Chris PeBenito 134191
Chris PeBenito 134191
# all the filesystem "write" ops (implicit single level)
Chris PeBenito 134191
mlsconstrain filesystem { mount remount unmount relabelfrom quotamod }
Chris PeBenito 134191
	(( l1 eq l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsfilewritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsfilewrite ));
Chris PeBenito 134191
Chris PeBenito 134191
# these access vectors have no MLS restrictions
Chris PeBenito 134191
# filesystem { transition associate }
Chris PeBenito 134191
Chris PeBenito 134191
Chris PeBenito 2705f9
Chris PeBenito 2705f9
Chris PeBenito 134191
#
Chris PeBenito 134191
# MLS policy for the socket classes
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito bf080a
# new socket labels must be dominated by the relabeling subjects clearance
Chris PeBenito 134191
mlsconstrain { socket tcp_socket udp_socket rawip_socket netlink_socket packet_socket key_socket unix_stream_socket unix_dgram_socket netlink_route_socket netlink_firewall_socket netlink_tcpdiag_socket netlink_nflog_socket netlink_xfrm_socket netlink_selinux_socket netlink_audit_socket netlink_ip6fw_socket netlink_dnrt_socket } relabelto
Chris PeBenito 134191
	( h1 dom h2 );
Chris PeBenito 134191
Chris PeBenito d62c08
# the socket "read+write" ops
Chris PeBenito d62c08
# (Socket FDs are generally bidirectional, equivalent to open(..., O_RDWR),
Chris PeBenito d62c08
# require equal levels for unprivileged subjects, or read *and* write overrides)
Chris PeBenito d62c08
mlsconstrain { socket tcp_socket udp_socket rawip_socket netlink_socket packet_socket key_socket unix_stream_socket unix_dgram_socket netlink_route_socket netlink_firewall_socket netlink_tcpdiag_socket netlink_nflog_socket netlink_xfrm_socket netlink_selinux_socket netlink_audit_socket netlink_ip6fw_socket netlink_dnrt_socket } { accept connect }
Chris PeBenito d62c08
	(( l1 eq l2 ) or
Chris PeBenito d62c08
	 (((( t1 == mlsnetreadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito d62c08
	   ( t1 == mlsnetread )) and
Chris PeBenito d62c08
	  ((( t1 == mlsnetwriteranged ) and ( l1 dom l2 ) and ( l1 domby h2 )) or
Chris PeBenito d62c08
	   (( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito d62c08
	   ( t1 == mlsnetwrite ))));
Chris PeBenito d62c08
Chris PeBenito d62c08
Chris PeBenito 2705f9
# the socket "read" ops (note the check is dominance of the low level)
Chris PeBenito 130f8a
mlsconstrain { socket tcp_socket udp_socket rawip_socket netlink_socket packet_socket key_socket unix_stream_socket unix_dgram_socket netlink_route_socket netlink_firewall_socket netlink_tcpdiag_socket netlink_nflog_socket netlink_xfrm_socket netlink_selinux_socket netlink_audit_socket netlink_ip6fw_socket netlink_dnrt_socket } { read getattr listen accept getopt recv_msg }
Chris PeBenito 134191
	(( l1 dom l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsnetreadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsnetread ));
Chris PeBenito 134191
Chris PeBenito 134191
mlsconstrain { netlink_route_socket netlink_firewall_socket netlink_tcpdiag_socket netlink_xfrm_socket netlink_audit_socket netlink_ip6fw_socket } nlmsg_read
Chris PeBenito 134191
	(( l1 dom l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsnetreadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsnetread ));
Chris PeBenito 134191
Chris PeBenito 134191
# the socket "write" ops
Chris PeBenito 2705f9
mlsconstrain { socket tcp_socket udp_socket rawip_socket netlink_socket packet_socket key_socket unix_stream_socket unix_dgram_socket netlink_route_socket netlink_firewall_socket netlink_tcpdiag_socket netlink_nflog_socket netlink_xfrm_socket netlink_selinux_socket netlink_audit_socket netlink_ip6fw_socket netlink_dnrt_socket } { write setattr relabelfrom connect setopt shutdown }
Chris PeBenito d62c08
	(( l1 eq l2 ) or 
Chris PeBenito d62c08
	 (( t1 == mlsnetwriteranged ) and ( l1 dom l2 ) and ( l1 domby h2 )) or
Chris PeBenito 134191
	 (( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsnetwrite ));
Chris PeBenito 134191
Chris PeBenito d62c08
# used by netlabel to restrict normal domains to same level connections
Chris PeBenito b50f2e
mlsconstrain { tcp_socket udp_socket rawip_socket } recvfrom
Chris PeBenito 130f8a
	(( l1 eq l2 ) or
Chris PeBenito 130f8a
	 (( t1 == mlsnetreadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito d62c08
	 ( t1 == mlsnetread ));
Chris PeBenito 130f8a
Chris PeBenito 134191
# these access vectors have no MLS restrictions
Chris PeBenito 2705f9
# { socket tcp_socket udp_socket rawip_socket netlink_socket packet_socket key_socket unix_stream_socket unix_dgram_socket netlink_route_socket netlink_firewall_socket netlink_tcpdiag_socket netlink_nflog_socket netlink_xfrm_socket netlink_selinux_socket netlink_audit_socket netlink_ip6fw_socket netlink_dnrt_socket } { ioctl create lock append bind sendto send_msg name_bind }
Chris PeBenito 134191
#
Chris PeBenito 134191
# { tcp_socket udp_socket rawip_socket } node_bind
Chris PeBenito 134191
#
Chris PeBenito 2705f9
# { tcp_socket unix_stream_socket } { connectto newconn acceptfrom }
Chris PeBenito 2705f9
#
Chris PeBenito 63e0a1
# tcp_socket name_connect
Chris PeBenito 63e0a1
#
Chris PeBenito 134191
# { netlink_route_socket netlink_firewall_socket netlink_tcpdiag_socket netlink_xfrm_socket netlink_audit_socket netlink_ip6fw_socket } nlmsg_write
Chris PeBenito 134191
#
Chris PeBenito 63e0a1
# netlink_audit_socket { nlmsg_relay nlmsg_readpriv }
Chris PeBenito 63e0a1
#
Chris PeBenito 63e0a1
# netlink_kobject_uevent_socket *
Chris PeBenito 63e0a1
#
Chris PeBenito 134191
Chris PeBenito 134191
Chris PeBenito 2705f9
Chris PeBenito 2705f9
Chris PeBenito 134191
#
Chris PeBenito 134191
# MLS policy for the ipc classes
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito 134191
# the ipc "read" ops (implicit single level)
Chris PeBenito 134191
mlsconstrain { ipc sem msgq shm } { getattr read unix_read }
Chris PeBenito 134191
	(( l1 dom l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsipcreadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsipcread ));
Chris PeBenito 134191
Chris PeBenito 134191
mlsconstrain msg receive
Chris PeBenito 134191
	(( l1 dom l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsipcreadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsipcread ));
Chris PeBenito 134191
Chris PeBenito 134191
# the ipc "write" ops (implicit single level)
Chris PeBenito 134191
mlsconstrain { ipc sem msgq shm } { create destroy setattr write unix_write }
Chris PeBenito 134191
	(( l1 eq l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsipcwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsipcwrite ));
Chris PeBenito 134191
Chris PeBenito 134191
mlsconstrain msgq enqueue
Chris PeBenito 134191
	(( l1 eq l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsipcwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsipcwrite ));
Chris PeBenito 134191
Chris PeBenito 134191
mlsconstrain shm lock
Chris PeBenito 134191
	(( l1 eq l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsipcwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsipcwrite ));
Chris PeBenito 134191
Chris PeBenito 134191
mlsconstrain msg send
Chris PeBenito 134191
	(( l1 eq l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsipcwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsipcwrite ));
Chris PeBenito 134191
Chris PeBenito 134191
# these access vectors have no MLS restrictions
Chris PeBenito 134191
# { ipc sem msgq shm } associate
Chris PeBenito 134191
Chris PeBenito 134191
Chris PeBenito 2705f9
Chris PeBenito 2705f9
Chris PeBenito 134191
#
Chris PeBenito 134191
# MLS policy for the fd class
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito cf7af1
# No sharing of open file descriptors between levels unless
Chris PeBenito cf7af1
# the process type is authorized to use fds created by 
Chris PeBenito cf7af1
# other levels (mlsfduse) or the fd type is authorized to
Chris PeBenito cf7af1
# shared among levels (mlsfdshare). 
Chris PeBenito cf7af1
mlsconstrain fd use (
Chris PeBenito cf7af1
	l1 eq l2
Chris PeBenito cf7af1
	or t1 == mlsfduse
Chris PeBenito cf7af1
	or t2 == mlsfdshare
Chris PeBenito cf7af1
);
Chris PeBenito 134191
Chris PeBenito 134191
#
Chris PeBenito 2705f9
# MLS policy for the network object classes
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito 2705f9
# the netif/node "read" ops (implicit single level socket doing the read)
Chris PeBenito 2705f9
#                           (note the check is dominance of the low level)
Chris PeBenito 2705f9
mlsconstrain { node netif } { tcp_recv udp_recv rawip_recv }
Chris PeBenito 2705f9
	(( l1 dom l2 ) or ( t1 == mlsnetrecvall ));
Chris PeBenito 2705f9
Chris PeBenito 2705f9
# the netif/node "write" ops (implicit single level socket doing the write)
Chris PeBenito 2705f9
mlsconstrain { netif node } { tcp_send udp_send rawip_send }
Chris PeBenito d62c08
	(( l1 eq l2 ) or
Chris PeBenito d62c08
	(( t1 == mlsnetwriteranged ) and ( l1 dom l2 ) and ( l1 domby h2 )));
Chris PeBenito 2705f9
Chris PeBenito 134191
# these access vectors have no MLS restrictions
Chris PeBenito 63e0a1
# node enforce_dest
Chris PeBenito 2705f9
Chris PeBenito 2705f9
Chris PeBenito 134191
Chris PeBenito 134191
Chris PeBenito 134191
#
Chris PeBenito 134191
# MLS policy for the process class
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito bf080a
# new process labels must be dominated by the relabeling subjects clearance
Chris PeBenito 2705f9
# and sensitivity level changes require privilege
Chris PeBenito 2705f9
mlsconstrain process transition
Chris PeBenito 2705f9
	(( h1 dom h2 ) and
Chris PeBenito 2705f9
	 (( l1 eq l2 ) or ( t1 == mlsprocsetsl ) or
Chris PeBenito 2705f9
	  (( t1 == privrangetrans ) and ( t2 == mlsrangetrans ))));
Chris PeBenito 2705f9
mlsconstrain process dyntransition
Chris PeBenito 134191
	(( h1 dom h2 ) and
Chris PeBenito 134191
	 (( l1 eq l2 ) or ( t1 == mlsprocsetsl )));
Chris PeBenito 134191
Chris PeBenito 134191
# all the process "read" ops
Chris PeBenito 134191
mlsconstrain process { getsched getsession getpgid getcap getattr ptrace share }
Chris PeBenito 134191
	(( l1 dom l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsprocreadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsprocread ));
Chris PeBenito 134191
Chris PeBenito 134191
# all the process "write" ops (note the check is equality on the low level)
Chris PeBenito 134191
mlsconstrain process { sigkill sigstop signal setsched setpgid setcap setexec setfscreate setcurrent ptrace share }
Chris PeBenito 134191
	(( l1 eq l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsprocwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsprocwrite ));
Chris PeBenito 134191
Chris PeBenito 134191
# these access vectors have no MLS restrictions
Chris PeBenito 63e0a1
# process { fork sigchld signull noatsecure siginh setrlimit rlimitinh execmem execstack execheap }
Chris PeBenito 2705f9
Chris PeBenito 2705f9
Chris PeBenito 134191
Chris PeBenito 134191
Chris PeBenito 134191
#
Chris PeBenito 134191
# MLS policy for the security class
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito 134191
# these access vectors have no MLS restrictions
Chris PeBenito 134191
# security *
Chris PeBenito 134191
Chris PeBenito 134191
Chris PeBenito 2705f9
Chris PeBenito 2705f9
Chris PeBenito 134191
#
Chris PeBenito 134191
# MLS policy for the system class
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito 134191
# these access vectors have no MLS restrictions
Chris PeBenito 134191
# system *
Chris PeBenito 134191
Chris PeBenito 134191
Chris PeBenito 2705f9
Chris PeBenito 2705f9
Chris PeBenito 134191
#
Chris PeBenito 134191
# MLS policy for the capability class
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito 134191
# these access vectors have no MLS restrictions
Chris PeBenito 134191
# capability *
Chris PeBenito 134191
Chris PeBenito 134191
Chris PeBenito 134191
Chris PeBenito 2705f9
Chris PeBenito 134191
#
Chris PeBenito 134191
# MLS policy for the passwd class
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito 134191
# these access vectors have no MLS restrictions
Chris PeBenito 134191
# passwd *
Chris PeBenito 134191
Chris PeBenito 134191
Chris PeBenito 2705f9
Chris PeBenito 2705f9
Chris PeBenito 134191
#
Chris PeBenito 2c12b4
# MLS policy for the x_drawable class
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito 2c12b4
# the x_drawable "read" ops (implicit single level)
Chris PeBenito 2c12b4
mlsconstrain x_drawable { read blend getattr list_child list_property get_property receive }
Chris PeBenito 134191
	(( l1 dom l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsxwinreadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsxwinread ));
Chris PeBenito 134191
Chris PeBenito 2c12b4
# the x_drawable "write" ops (implicit single level)
Chris PeBenito 2c12b4
mlsconstrain x_drawable { create destroy write setattr add_child remove_child send manage }
Chris PeBenito 134191
	(( l1 eq l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsxwinwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsxwinwrite ));
Chris PeBenito 134191
Chris PeBenito 2c12b4
# No MLS restrictions: x_drawable { show hide override }
Chris PeBenito 2705f9
Chris PeBenito 2705f9
Chris PeBenito 134191
#
Chris PeBenito 2c12b4
# MLS policy for the x_gc class
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito 2c12b4
# the x_gc "read" ops (implicit single level)
Chris PeBenito 2c12b4
mlsconstrain x_gc { getattr use }
Chris PeBenito 134191
	(( l1 dom l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsxwinreadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsxwinread ));
Chris PeBenito 134191
Chris PeBenito 2c12b4
# the x_gc "write" ops (implicit single level)
Chris PeBenito 2c12b4
mlsconstrain x_gc { create destroy setattr }
Chris PeBenito 134191
	(( l1 eq l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsxwinwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsxwinwrite ));
Chris PeBenito 134191
Chris PeBenito 134191
Chris PeBenito 134191
#
Chris PeBenito 2c12b4
# MLS policy for the x_font class
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito 2c12b4
# the x_font "read" ops (implicit single level)
Chris PeBenito 2c12b4
mlsconstrain x_font { use }
Chris PeBenito 134191
	(( l1 dom l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsxwinreadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsxwinread ));
Chris PeBenito 134191
Chris PeBenito 2c12b4
# the x_font "write" ops (implicit single level)
Chris PeBenito 2c12b4
mlsconstrain x_font { create destroy add_glyph remove_glyph }
Chris PeBenito 134191
	(( l1 eq l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsxwinwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsxwinwrite ));
Chris PeBenito 134191
Chris PeBenito 134191
# these access vectors have no MLS restrictions
Chris PeBenito 134191
# font use
Chris PeBenito 134191
Chris PeBenito 134191
Chris PeBenito 134191
#
Chris PeBenito 2c12b4
# MLS policy for the x_colormap class
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito 2c12b4
# the x_colormap "read" ops (implicit single level)
Chris PeBenito 2c12b4
mlsconstrain x_colormap { read getattr use }
Chris PeBenito 134191
	(( l1 dom l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsxwinreadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito bf080a
	 ( t1 == mlsxwinreadcolormap ) or
Chris PeBenito 134191
	 ( t1 == mlsxwinread ));
Chris PeBenito 134191
Chris PeBenito 2c12b4
# the x_colormap "write" ops (implicit single level)
Chris PeBenito 2c12b4
mlsconstrain x_colormap { create destroy write add_color remove_color install uninstall }
Chris PeBenito 134191
	(( l1 eq l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsxwinwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito bf080a
	 ( t1 == mlsxwinwritecolormap ) or
Chris PeBenito 134191
	 ( t1 == mlsxwinwrite ));
Chris PeBenito 134191
Chris PeBenito 134191
Chris PeBenito 134191
#
Chris PeBenito 2c12b4
# MLS policy for the x_property class
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito 2c12b4
# the x_property "read" ops (implicit single level)
Chris PeBenito 2c12b4
mlsconstrain x_property { read getattr }
Chris PeBenito 134191
	(( l1 dom l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsxwinreadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito bf080a
	 ( t1 == mlsxwinreadproperty ) or
Chris PeBenito 134191
	 ( t1 == mlsxwinread ));
Chris PeBenito 134191
Chris PeBenito 2c12b4
# the x_property "write" ops (implicit single level)
Chris PeBenito 2c12b4
mlsconstrain x_property { create destroy write append setattr }
Chris PeBenito 134191
	(( l1 eq l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsxwinwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito bf080a
	 ( t1 == mlsxwinwriteproperty ) or
Chris PeBenito 134191
	 ( t1 == mlsxwinwrite ));
Chris PeBenito 134191
Chris PeBenito 2705f9
Chris PeBenito 134191
#
Chris PeBenito 2c12b4
# MLS policy for the x_cursor class
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito 2c12b4
# the x_cursor "read" ops (implicit single level)
Chris PeBenito 2c12b4
mlsconstrain x_cursor { read getattr use }
Chris PeBenito 2c12b4
	(( l1 dom l2 ) or
Chris PeBenito 2c12b4
	 (( t1 == mlsxwinreadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito 2c12b4
	 ( t1 == mlsxwinread ));
Chris PeBenito 2c12b4
	
Chris PeBenito 2c12b4
# the x_cursor "write" ops (implicit single level)
Chris PeBenito 2c12b4
mlsconstrain x_cursor { create destroy write setattr }
Chris PeBenito 134191
	(( l1 eq l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsxwinwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsxwinwrite ));
Chris PeBenito 134191
Chris PeBenito 134191
Chris PeBenito 134191
#
Chris PeBenito 2c12b4
# MLS policy for the x_client class
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito 2c12b4
# the x_client "read" ops (implicit single level)
Chris PeBenito 2c12b4
mlsconstrain x_client { getattr }
Chris PeBenito 2c12b4
	(( l1 dom l2 ) or
Chris PeBenito 2c12b4
	 (( t1 == mlsxwinreadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito 2c12b4
	 ( t1 == mlsxwinread ));
Chris PeBenito 2c12b4
Chris PeBenito 2c12b4
# the x_client "write" ops (implicit single level)
Chris PeBenito 2c12b4
mlsconstrain x_client { destroy setattr manage }
Chris PeBenito 134191
	(( l1 eq l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsxwinwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito 134191
	 ( t1 == mlsxwinwrite ));
Chris PeBenito 134191
Chris PeBenito 134191
Chris PeBenito 134191
#
Chris PeBenito 2c12b4
# MLS policy for the x_device class
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito 2c12b4
# the x_device "read" ops (implicit single level)
Chris PeBenito 2c12b4
mlsconstrain x_device { getattr use read getfocus grab }
Chris PeBenito 2c12b4
	(( l1 dom l2 ) or
Chris PeBenito 2c12b4
	 (( t1 == mlsxwinreadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito 2c12b4
	 ( t1 == mlsxwinread ));
Chris PeBenito 134191
Chris PeBenito 2c12b4
# the x_device "write" ops (implicit single level)
Chris PeBenito 2c12b4
mlsconstrain x_device { setattr write setfocus bell force_cursor freeze manage }
Chris PeBenito 134191
	(( l1 eq l2 ) or
Chris PeBenito 134191
	 (( t1 == mlsxwinwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito bf080a
	 ( t1 == mlsxwinwritexinput ) or
Chris PeBenito 134191
	 ( t1 == mlsxwinwrite ));
Chris PeBenito 134191
Chris PeBenito 134191
Chris PeBenito 2c12b4
#
Chris PeBenito 2c12b4
# MLS policy for the x_server class
Chris PeBenito 2c12b4
#
Chris PeBenito 2c12b4
Chris PeBenito 2c12b4
# these access vectors have no MLS restrictions
Chris PeBenito 2c12b4
# x_server *
Chris PeBenito 134191
Chris PeBenito 134191
Chris PeBenito 134191
#
Chris PeBenito 2c12b4
# MLS policy for the x_extension class
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito bf080a
# these access vectors have no MLS restrictions
Chris PeBenito 2c12b4
# x_extension { query use }
Chris PeBenito 2c12b4
Chris PeBenito 134191
Chris PeBenito 2c12b4
#
Chris PeBenito 2c12b4
# MLS policy for the x_resource class
Chris PeBenito 2c12b4
#
Chris PeBenito 2c12b4
Chris PeBenito 2c12b4
# the x_resource "read" ops (implicit single level)
Chris PeBenito 2c12b4
mlsconstrain x_resource { read }
Chris PeBenito 2c12b4
	(( l1 dom l2 ) or
Chris PeBenito 2c12b4
	 (( t1 == mlsxwinreadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito 2c12b4
	 ( t1 == mlsxwinread ));
Chris PeBenito 134191
Chris PeBenito 2c12b4
# the x_resource "write" ops (implicit single level)
Chris PeBenito 2c12b4
mlsconstrain x_resource { write }
Chris PeBenito 2c12b4
	(( l1 eq l2 ) or
Chris PeBenito 2c12b4
	 (( t1 == mlsxwinwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito 2c12b4
	 ( t1 == mlsxwinwritexinput ) or
Chris PeBenito 2c12b4
	 ( t1 == mlsxwinwrite ));
Chris PeBenito 2705f9
Chris PeBenito 2705f9
Chris PeBenito 134191
#
Chris PeBenito 2c12b4
# MLS policy for the x_event class
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito 2c12b4
# the x_event "read" ops (implicit single level)
Chris PeBenito 2c12b4
mlsconstrain x_event { receive }
Chris PeBenito 2c12b4
	(( l1 dom l2 ) or
Chris PeBenito 2c12b4
	 (( t1 == mlsxwinreadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito 2c12b4
	 ( t1 == mlsxwinread ));
Chris PeBenito 2c12b4
Chris PeBenito 2c12b4
# the x_event "write" ops (implicit single level)
Chris PeBenito 2c12b4
mlsconstrain x_event { send }
Chris PeBenito 2c12b4
	(( l1 eq l2 ) or
Chris PeBenito 2c12b4
	 (( t1 == mlsxwinwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito 2c12b4
	 ( t1 == mlsxwinwritexinput ) or
Chris PeBenito 2c12b4
	 ( t1 == mlsxwinwrite ));
Chris PeBenito 2c12b4
Chris PeBenito 134191
Chris PeBenito d923d5
#
Chris PeBenito d923d5
# MLS policy for the x_application_data class
Chris PeBenito d923d5
#
Chris PeBenito d923d5
Chris PeBenito 6a824f
# the x_application_data "paste" ops
Chris PeBenito d923d5
mlsconstrain x_application_data { paste }
Chris PeBenito 6a824f
	( l1 domby l2 );
Chris PeBenito d923d5
Chris PeBenito 6a824f
# the x_application_data "paste_after_confirm" ops
Chris PeBenito d923d5
mlsconstrain x_application_data { paste_after_confirm }
Chris PeBenito 6a824f
	( l1 dom l2 );
Chris PeBenito d923d5
Chris PeBenito 134191
Chris PeBenito 134191
#
Chris PeBenito 134191
# MLS policy for the pax class
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito 134191
# these access vectors have no MLS restrictions
Chris PeBenito 134191
# pax { pageexec emutramp mprotect randmmap randexec segmexec }
Chris PeBenito 134191
Chris PeBenito 134191
Chris PeBenito 2705f9
Chris PeBenito 2705f9
Chris PeBenito 134191
#
Chris PeBenito 134191
# MLS policy for the dbus class
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito 936f28
mlsconstrain dbus { send_msg }
Chris PeBenito 936f28
	(( l1 eq l2 ) or
Chris PeBenito 936f28
	 ( t1 == mlsdbussend ) or
Chris PeBenito 936f28
	 ( t2 == mlsdbusrecv ));
Chris PeBenito 936f28
Chris PeBenito 134191
# these access vectors have no MLS restrictions
Chris PeBenito 936f28
# dbus { acquire_svc }
Chris PeBenito 134191
Chris PeBenito 134191
Chris PeBenito 2705f9
Chris PeBenito 2705f9
Chris PeBenito 134191
#
Chris PeBenito 134191
# MLS policy for the nscd class
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito 134191
# these access vectors have no MLS restrictions
Chris PeBenito 134191
# nscd { getpwd getgrp gethost getstat admin shmempwd shmemgrp shmemhost }
Chris PeBenito 134191
Chris PeBenito 134191
Chris PeBenito 2705f9
Chris PeBenito 2705f9
Chris PeBenito 134191
#
Chris PeBenito 134191
# MLS policy for the association class
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito 9b45c6
mlsconstrain association { recvfrom }
Chris PeBenito 9b45c6
	((( l1 dom l2 ) and ( l1 domby h2 )) or
Chris PeBenito 9b45c6
	 (( t1 == mlsnetreadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito 9b45c6
	 ( t1 == mlsnetread ) or
Chris PeBenito 9b45c6
	 ( t2 == unlabeled_t ));
Chris PeBenito 9b45c6
Chris PeBenito 9b45c6
mlsconstrain association { sendto }
Chris PeBenito d62c08
	(( l1 eq l2 ) or
Chris PeBenito d62c08
	 (( t1 == mlsnetwriteranged ) and ( l1 dom l2 ) and ( l1 domby h2 )) or
Chris PeBenito 9b45c6
	 ( t2 == unlabeled_t ));
Chris PeBenito 9b45c6
Chris PeBenito 9b45c6
mlsconstrain association { polmatch }
Chris PeBenito d31d3c
	(( l1 dom l2 ) and ( h1 domby h2 ));
Chris PeBenito 134191
Chris PeBenito a8671a
Chris PeBenito a8671a
Chris PeBenito a8671a
#
Chris PeBenito a8671a
# MLS policy for the context class
Chris PeBenito a8671a
#
Chris PeBenito a8671a
Chris PeBenito a8671a
mlsconstrain context translate
Chris PeBenito a8671a
	(( h1 dom h2 ) or ( t1 == mlstranslate ));
Chris PeBenito a8671a
Chris PeBenito c6a60b
mlsconstrain context contains
Chris PeBenito c6a60b
	( h1 dom h2 );
Chris PeBenito c6a60b
Chris PeBenito 9760cb
#
Chris PeBenito 9760cb
# MLS policy for database classes
Chris PeBenito 9760cb
#
Chris PeBenito 9760cb
Chris PeBenito 9760cb
# make sure these database classes are "single level"
Chris PeBenito 9760cb
mlsconstrain { db_database db_table db_procedure db_column db_blob } { create relabelto }
Chris PeBenito 9760cb
	( l2 eq h2 );
Chris PeBenito 9760cb
mlsconstrain { db_tuple } { insert relabelto }
Chris PeBenito 9760cb
	( l2 eq h2 );
Chris PeBenito 9760cb
Chris PeBenito 9760cb
# new database labels must be dominated by the relabeling subjects clearance
Chris PeBenito 9760cb
mlsconstrain { db_database db_table db_procedure db_column db_tuple db_blob } { relabelto }
Chris PeBenito 9760cb
	( h1 dom h2 );
Chris PeBenito 9760cb
Chris PeBenito 9760cb
# the database "read" ops (note the check is dominance of the low level)
Chris PeBenito 9760cb
mlsconstrain { db_database } { getattr access get_param }
Chris PeBenito 9760cb
	(( l1 dom l2 ) or
Chris PeBenito 9760cb
	 (( t1 == mlsdbreadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito 9760cb
	 ( t1 == mlsdbread ) or
Chris PeBenito 9760cb
	 ( t2 == mlstrustedobject ));
Chris PeBenito 9760cb
Chris PeBenito 9760cb
mlsconstrain { db_table db_column } { getattr use select }
Chris PeBenito 9760cb
	(( l1 dom l2 ) or
Chris PeBenito 9760cb
	 (( t1 == mlsdbreadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito 9760cb
	 ( t1 == mlsdbread ) or
Chris PeBenito 9760cb
	 ( t2 == mlstrustedobject ));
Chris PeBenito 9760cb
Chris PeBenito 9760cb
mlsconstrain { db_procedure } { getattr execute }
Chris PeBenito 9760cb
	(( l1 dom l2 ) or
Chris PeBenito 9760cb
	 (( t1 == mlsdbreadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito 9760cb
	 ( t1 == mlsdbread ) or
Chris PeBenito 9760cb
	 ( t2 == mlstrustedobject ));
Chris PeBenito 9760cb
Chris PeBenito 9760cb
mlsconstrain { db_blob } { getattr read }
Chris PeBenito 9760cb
	(( l1 dom l2 ) or
Chris PeBenito 9760cb
	 (( t1 == mlsdbreadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito 9760cb
	 ( t1 == mlsdbread ) or
Chris PeBenito 9760cb
	 ( t2 == mlstrustedobject ));
Chris PeBenito 9760cb
Chris PeBenito 9760cb
mlsconstrain { db_tuple } { use select }
Chris PeBenito 9760cb
	(( l1 dom l2 ) or
Chris PeBenito 9760cb
	 (( t1 == mlsdbreadtoclr ) and ( h1 dom l2 )) or
Chris PeBenito 9760cb
	 ( t1 == mlsdbread ) or
Chris PeBenito 9760cb
	 ( t2 == mlstrustedobject ));
Chris PeBenito 9760cb
Chris PeBenito 9760cb
# the "single level" file "write" ops
Chris PeBenito 9760cb
mlsconstrain { db_database } { create drop setattr relabelfrom install_module load_module set_param }
Chris PeBenito 9760cb
	(( l1 eq l2 ) or
Chris PeBenito 9760cb
	 (( t1 == mlsdbwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito 9760cb
	 (( t2 == mlsdbwriteinrange ) and ( l1 dom l2 ) and ( h1 domby h2 )) or
Chris PeBenito 9760cb
	 ( t1 == mlsdbwrite ) or
Chris PeBenito 9760cb
	 ( t2 == mlstrustedobject ));
Chris PeBenito 9760cb
Chris PeBenito 9760cb
mlsconstrain { db_table } { create drop setattr relabelfrom update insert delete lock }
Chris PeBenito 9760cb
	(( l1 eq l2 ) or
Chris PeBenito 9760cb
	 (( t1 == mlsdbwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito 9760cb
	 (( t2 == mlsdbwriteinrange ) and ( l1 dom l2 ) and ( h1 domby h2 )) or
Chris PeBenito 9760cb
	 ( t1 == mlsdbwrite ) or
Chris PeBenito 9760cb
	 ( t2 == mlstrustedobject ));
Chris PeBenito 9760cb
Chris PeBenito 9760cb
mlsconstrain { db_column } { create drop setattr relabelfrom update insert }
Chris PeBenito 9760cb
	(( l1 eq l2 ) or
Chris PeBenito 9760cb
	 (( t1 == mlsdbwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito 9760cb
	 (( t2 == mlsdbwriteinrange ) and ( l1 dom l2 ) and ( h1 domby h2 )) or
Chris PeBenito 9760cb
	 ( t1 == mlsdbwrite ) or
Chris PeBenito 9760cb
	 ( t2 == mlstrustedobject ));
Chris PeBenito 9760cb
Chris PeBenito 9760cb
mlsconstrain { db_blob } { create drop setattr relabelfrom write import export }
Chris PeBenito 9760cb
	(( l1 eq l2 ) or
Chris PeBenito 9760cb
	 (( t1 == mlsdbwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito 9760cb
	 (( t2 == mlsdbwriteinrange ) and ( l1 dom l2 ) and ( h1 domby h2 )) or
Chris PeBenito 9760cb
	 ( t1 == mlsdbwrite ) or
Chris PeBenito 9760cb
	 ( t2 == mlstrustedobject ));
Chris PeBenito 9760cb
Chris PeBenito 9760cb
mlsconstrain { db_tuple } { relabelfrom update insert delete }
Chris PeBenito 9760cb
	(( l1 eq l2 ) or
Chris PeBenito 9760cb
	 (( t1 == mlsdbwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2 )) or
Chris PeBenito 9760cb
	 (( t2 == mlsdbwriteinrange ) and ( l1 dom l2 ) and ( h1 domby h2 )) or
Chris PeBenito 9760cb
	 ( t1 == mlsdbwrite ) or
Chris PeBenito 9760cb
	 ( t2 == mlstrustedobject ));
Chris PeBenito 9760cb
Chris PeBenito 9760cb
# the database upgrade/downgrade rule
Chris PeBenito 9760cb
mlsvalidatetrans { db_database db_table db_procedure db_column db_tuple db_blob }
Chris PeBenito 9760cb
	((( l1 eq l2 ) or
Chris PeBenito 9760cb
	  (( t3 == mlsdbupgrade ) and ( l1 domby l2 )) or
Chris PeBenito 9760cb
	  (( t3 == mlsdbdowngrade ) and ( l1 dom l2 )) or
Chris PeBenito 9760cb
	  (( t3 == mlsdbdowngrade ) and ( l1 incomp l2 ))) and
Chris PeBenito 9760cb
	 (( l1 eq h2 ) or
Chris PeBenito 9760cb
	  (( t3 == mlsdbupgrade ) and ( h1 domby h2 )) or
Chris PeBenito 9760cb
	  (( t3 == mlsdbdowngrade ) and ( h1 dom h2 )) or
Chris PeBenito 9760cb
	  (( t3 == mlsdbdowngrade ) and ( h1 incomp h2 ))));
Chris PeBenito 9760cb
Chris PeBenito 134191
') dnl end enable_mls