Index: /selinux/build/afsd.fc
===================================================================
--- /selinux/build/afsd.fc	(revision 89)
+++ /selinux/build/afsd.fc	(revision 90)
@@ -1,6 +1,5 @@
-# afs executable will have:
-# label: system_u:object_r:afsd_exec_t
-# MLS sensitivity: s0
-# MCS categories: <none>
+# Joe Presbrey
+# presbrey@mit.edu
+# 2006/1/15
 
 /afs			-d	gen_context(system_u:object_r:default_t,s0)
@@ -9,2 +8,33 @@
 /usr/vice/etc/afsd	--	gen_context(system_u:object_r:afsd_exec_t,s0)
 /usr/vice/cache(/.*)?		gen_context(system_u:object_r:afsd_cache_t,s0)
+
+/usr/bin/afsmonitor		gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/bin/bos			gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/bin/fs			gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/bin/kapasswd		gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/bin/klog			gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/bin/klog.krb		gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/bin/kpasswd		gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/bin/pagsh			gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/bin/pagsh.krb		gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/bin/pts			gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/bin/scout			gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/bin/sys			gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/bin/tokens			gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/bin/tokens.krb		gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/bin/translate_et		gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/bin/udebug			gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/bin/unlog			gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/sbin/backup		gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/sbin/butc			gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/sbin/copyauth		gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/sbin/fms			gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/sbin/fstrace		gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/sbin/kas			gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/sbin/kseal			gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/sbin/read_tape		gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/sbin/restorevol		gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/sbin/rxdebug		gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/sbin/uss			gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/sbin/vos			gen_context(system_u:object_r:afs_bin_t,s0)
+/usr/sbin/vsys			gen_context(system_u:object_r:afs_bin_t,s0)
Index: /selinux/build/afsd.if
===================================================================
--- /selinux/build/afsd.if	(revision 89)
+++ /selinux/build/afsd.if	(revision 90)
@@ -1,14 +1,6 @@
-## <summary>policy for afs</summary>
+# Joe Presbrey
+# presbrey@mit.edu
+# 2006/1/15
 
-########################################
-## <summary>
-##	Execute a domain transition to run afs.
-## </summary>
-## <param name="domain">
-## <summary>
-##	Domain allowed to transition.
-## </summary>
-## </param>
-#
 interface(`afsd_domtrans',`
 	gen_require(`
@@ -26,19 +18,22 @@
 interface(`afs_access',`
 	gen_require(`
+		type afs_t, afs_bin_t;
 		type afsd_t, afsd_etc_t;
-		type autofs_t, nfs_t;
 	')
-	allow $1 afsd_t:udp_socket all_udp_socket_perms;
+
+	allow $1 afs_bin_t:file rx_file_perms;
+	domain_auto_trans($1, afs_bin_t, afs_t)
+	allow afs_t $1:fd use;
+	allow afs_t $1:process sigchld;
+
+	allow $1 afsd_t:udp_socket write;
 	allow $1 afsd_etc_t:dir r_dir_perms;
 	allow $1 afsd_etc_t:file r_file_perms;
 	allow $1 afsd_etc_t:lnk_file r_file_perms;
-	allow $1 autofs_t:dir all_dir_perms;
-	allow $1 autofs_t:lnk_file all_lnk_file_perms;
-	allow $1 nfs_t:dir all_dir_perms;
-	allow $1 nfs_t:file all_file_perms;
-	allow $1 nfs_t:lnk_file all_lnk_file_perms;
-	allow $1 nfs_t:sock_file all_sock_file_perms;
-	allow $1 nfs_t:fifo_file all_fifo_file_perms;
-	allow $1 nfs_t:chr_file all_chr_file_perms;
-	allow $1 nfs_t:blk_file all_blk_file_perms;
+	fs_manage_autofs_symlinks($1)
+	fs_manage_nfs_dirs($1)
+	fs_manage_nfs_files($1)
+	fs_manage_nfs_symlinks($1)
+	fs_manage_nfs_named_pipes($1)
+	fs_manage_nfs_named_sockets($1)
 ')
Index: /selinux/build/afsd.te
===================================================================
--- /selinux/build/afsd.te	(revision 89)
+++ /selinux/build/afsd.te	(revision 90)
@@ -1,8 +1,16 @@
-policy_module(afsd,1.0.0)
+# Joe Presbrey
+# presbrey@mit.edu
+# 2006/1/15
 
-########################################
-#
-# Declarations
-#
+policy_module(openafs,1.0.0)
+
+type afs_t;
+type afs_bin_t;
+domain_type(afs_t)
+domain_entry_file(afs_t, afs_bin_t)
+corecmd_executable_file(afs_bin_t)
+
+role system_r types afs_t;
+role user_r types afs_t;
 
 type afsd_t;
@@ -11,8 +19,6 @@
 init_daemon_domain(afsd_t, afsd_exec_t)
 
-# var/lib files
 type afsd_etc_t;
 type afsd_cache_t;
-#files_type(afsd_etc_t)
 files_type(afsd_etc_t)
 files_type(afsd_cache_t)
@@ -20,9 +26,14 @@
 allow afsd_t { afsd_etc_t afsd_cache_t }:dir manage_dir_perms;
 allow afsd_t { afsd_etc_t afsd_cache_t }:file_class_set manage_file_perms;
-#files_var_lib_filetrans(afsd_t,afsd_cache_t, { file dir sock_file })
 
 ########################################
 #
 # AFS local policy
+
+files_read_etc_files(afs_t)
+files_read_etc_runtime_files(afs_t)
+libs_use_ld_so(afs_t)
+libs_use_shared_libs(afs_t)
+miscfiles_read_localization(afs_t)
 
 files_read_etc_files(afsd_t)
@@ -32,5 +43,4 @@
 miscfiles_read_localization(afsd_t)
 
-# Init script handling
 init_use_fds(afsd_t)
 init_use_script_ptys(afsd_t)
@@ -44,4 +54,5 @@
 fs_remount_nfs(afsd_t)
 fs_unmount_nfs(afsd_t)
+fs_manage_nfs_dirs(afsd_t)
 fs_manage_nfs_files(afsd_t)
 fs_manage_nfs_symlinks(afsd_t)
@@ -49,16 +60,13 @@
 fs_manage_nfs_named_sockets(afsd_t)
 
-fs_getattr_xattr_fs(afsd_t);
-
 allow afsd_t self:dir mounton;
 allow afsd_t self:process setsched;
-allow afsd_t self:capability { sys_admin sys_nice sys_tty_config};
+allow afsd_t self:capability { sys_admin sys_nice sys_tty_config };
 
-#allow afsd_t lo_node_t:node all_node_perms;
-#allow afsd_t net_conf_t:file read;
 sysnet_dns_name_resolve(afsd_t)
 corenet_tcp_sendrecv_all_nodes(afsd_t)
 corenet_udp_sendrecv_all_nodes(afsd_t)
 
+# some redundancy here
 afs_access(afsd_t);
 
@@ -73,3 +81,20 @@
 allow afsd_t node_t:node { udp_recv udp_send };
 
+allow kernel_t afsd_t:udp_socket all_udp_socket_perms;
+
 allow afsd_t kernel_t:key all_key_perms;
+allow kernel_t self:key all_key_perms;
+
+require {
+	type inaddr_any_node_t;
+};
+
+afs_access(afs_t)
+allow afs_t afs_pt_port_t:udp_socket all_udp_socket_perms;
+allow afs_t self:udp_socket all_udp_socket_perms;
+allow afs_t afsd_t:udp_socket all_udp_socket_perms; 
+allow afs_t inaddr_any_node_t:udp_socket all_udp_socket_perms;
+allow afs_t netif_t:netif { udp_recv udp_send };
+allow afs_t node_t:node { udp_recv udp_send };
+allow afs_t proc_t:file { ioctl read write };
+term_use_all_user_ptys(afs_t)
