RAID and postfix patches
Hi,
Attached is a policy for the RAID tool "mdadm", which has a daemon monitoring mode that wants to access /dev/md0 (of course). Major
caveat: I haven't tested it for creating RAID devices. I hope someone can try this out.
Also, the policy for the "postmap" program from Postfix seemed busted - it had postmap run as postfix_master_t, which doesn't have write access to /etc/postfix. postmap is very commonly run by administrators to regenerate the hash database files. I've attached a patch for the Postfix policy which creates a new domain for it.
There are also a few other fixes in the Postfix patch too.
#DESC mdadm - Linux RAID tool
#
# Author: Colin Walters <[email protected]>
#
daemon_base_domain(mdadm, `, fs_domain')
role sysadm_r types mdadm_t;
# Kernel filesystem permissionsr_dir_file(mdadm_t, proc_t)
allow mdadm_t sysctl_kernel_t:file r_file_perms;
allow mdadm_t sysctl_kernel_t:dir r_dir_perms; r_dir_file(mdadm_t, sysfs_t)
# Allow writes to /proc/mdstat - TODO: specific type for that file allow mdadm_t proc_t:file rw_file_perms;
# Configuration
allow mdadm_t { etc_t etc_runtime_t }:file { getattr read }; read_locale(mdadm_t)
# Linux capabilities
allow mdadm_t self:capability { dac_override sys_admin };
# Helper program accesscan_exec(mdadm_t, { bin_t sbin_t })
# RAID block device access
allow mdadm_t fixed_disk_device_t:blk_file create_file_perms;
# Ignore attempts to read every device file
dontaudit mdadm_t device_type:{ chr_file blk_file } getattr;
dontaudit mdadm_t device_t:{ fifo_file file dir chr_file blk_file } { read getattr }; dontaudit mdadm_t dri_device_t:dir r_dir_perms;
dontaudit mdadm_t devpts_t:dir r_dir_perms;
# Ignore attempts to read/write sysadmin tty dontaudit mdadm_t sysadm_tty_device_t:chr_file rw_file_perms;
# Other random ignores
dontaudit mdadm_t tmpfs_t:dir r_dir_perms; dontaudit mdadm_t initctl_t:fifo_file { getattr };
program/postfix.te renamed from program/postfix.te~ +15 -0
@@ -43,6 +43,7 @@ allow postfix_$1_t { sbin_t bin_t }:dir r_dir_perms; allow postfix_$1_t bin_t:lnk_file r_file_perms; +allow postfix_$1_t usr_t:lnk_file r_file_perms; allow postfix_$1_t shell_exec_t:file rx_file_perms; allow postfix_$1_t { var_t var_spool_t }:dir { search getattr }; allow postfix_$1_t postfix_exec_t:file rx_file_perms;
@@ -162,6 +163,8 @@ allow postfix_smtpd_t { postfix_private_t postfix_public_t }:dir search; allow postfix_smtpd_t { postfix_private_t postfix_public_t }:sock_file rw_file_perms; allow postfix_smtpd_t postfix_master_t:unix_stream_socket connectto; +# for OpenSSL certificates +r_dir_file(postfix_smtpd_t,usr_t) allow postfix_smtpd_t etc_aliases_t:file r_file_perms; # for prng_exch
@@ -308,3 +311,15 @@ ifdef(`procmail.te', ` domain_auto_trans(postfix_pipe_t, procmail_exec_t, procmail_t) ') + +# Program for creating database files +application_domain(postfix_map) +base_file_read_access(postfix_map_t) +allow postfix_map_t { etc_t etc_runtime_t }:{ file lnk_file } { getattr read }; +tmp_domain(postfix_map) +create_dir_file(postfix_map_t, postfix_etc_t) +allow postfix_map_t self:unix_stream_socket create_stream_socket_perms; +dontaudit postfix_map_t proc_t:dir { getattr read search }; +dontaudit postfix_map_t local_login_t:fd { use }; +allow postfix_master_t postfix_map_exec_t:file rx_file_perms; +
program/postfix.fc renamed from program/postfix.fc~ +1 -1
@@ -21,7 +21,7 @@ /usr/sbin/postkick -- system_u:object_r:postfix_master_exec_t /usr/sbin/postlock -- system_u:object_r:postfix_master_exec_t /usr/sbin/postlog -- system_u:object_r:postfix_master_exec_t -/usr/sbin/postmap -- system_u:object_r:postfix_master_exec_t +/usr/sbin/postmap -- system_u:object_r:postfix_map_exec_t /usr/sbin/postqueue -- system_u:object_r:postfix_postqueue_exec_t /usr/sbin/postsuper -- system_u:object_r:postfix_master_exec_t /usr/sbin/rmail -- system_u:object_r:sendmail_exec_t